Closed EldoradoEU closed 1 day ago
You can already open multiple trace files in the same viewer today, it will show all actions on the same timeline. Does it not work for you?
npx playwright show-trace trace-1.zip trace-2.zip
Hi @yury-s ,
I didn't know about this option. Sounds good. How can I open multiple traces using Viewing remote traces https://playwright.dev/python/docs/trace-viewer#viewing-remote-traces? In our project we want generate unique link to Trace for every test case. How can I create pattern for Viewing remote traces to open all traces in some location? e.g. folder in Jenkins server has the same name as test and inside we have few trace files.
Also for creating pytest fixtures this solution is more complicated. In proposed version we would be able to create single fixture for tracing.
Current fixture - for single context (we must create another for every new context)
@ pytest.fixture(scope='function', autouse=True)
def tracing(context: BrowserContext, request):
context.tracing.start(screenshots=True, snapshots=True, sources=True)
yield
trace_name = request.node.name + '.zip'
trace_name = re.sub(r'\[[^]]*](?=\.zip)', '', trace_name)
context.tracing.stop(path=trace_name)
Fixture with proposed option - single trace file with the same name as test case. Simple way to create a unique link for Viewing remote traces.
@ pytest.fixture(scope='function', autouse=True)
def tracing(browser: Browser, request):
browser.tracing.start(screenshots=True, snapshots=True, sources=True)
yield
trace_name = request.node.name + '.zip'
trace_name = re.sub(r'\[[^]]*](?=\.zip)', '', trace_name)
browser.tracing.stop(path=trace_name)
How can I open multiple traces using Viewing remote traces https://playwright.dev/python/docs/trace-viewer#viewing-remote-traces? In our project we want generate unique link to Trace for every test case.
npx playwright show-trace https://demo.playwright.dev/reports/todomvc/data/cb0fa77ebd9487a5c899f3ae65a7ffdbac681182.zip https://demo.playwright.dev/reports/todomvc/data/00dd445d331b5bb8e6529eb52ffedba5df80b19d.zip https://demo.playwright.dev/reports/todomvc/data/710aff711a9fe3bbddd5ffc53e3318f7228216a3.zip
or the same in the web viewer:
https://trace.playwright.dev/?trace=https://demo.playwright.dev/reports/todomvc/data/cb0fa77ebd9487a5c899f3ae65a7ffdbac681182.zip&trace=https://demo.playwright.dev/reports/todomvc/data/00dd445d331b5bb8e6529eb52ffedba5df80b19d.zip&trace=https://demo.playwright.dev/reports/todomvc/data/710aff711a9fe3bbddd5ffc53e3318f7228216a3.zip
Okay, maybe can we merge them in one Trace Viewer .zip ?
You can merge them into one file too.
@pavelfeldman could you show example? I didn't find information about merging multiple traces into one.
trace is a zip file, so if you unzip and merge the content, while maintaining the naming convention, zip it again it should work
🚀 Feature Request
Option to record single Trace Viewer for multiple BrowserContexts. Is it possible to add tracing.start and tracing.stop for Browser?
Example (Playwright Python)
Current option - for single context context.tracing.start(screenshots=True, snapshots=True, sources=True) context.tracing.stop(path=trace.zip)
Proposed option - for multiple contexts browser.tracing.start(screenshots=True, snapshots=True, sources=True) browser.tracing.stop(path=trace.zip)
Motivation
Built-in Trace Viewer for Playwright Test show informations for multiple contexts.
Sometimes test cases require one context with http_credentials and second without them or with another. It would be really nice to have all informations in one place.