authentik setup and tracing #2
1 changed files with 0 additions and 35 deletions
|
|
@ -84,38 +84,3 @@ def pytest_runtest_makereport(item, call):
|
|||
filepath = item.funcargs["RESULTS"] / filename
|
||||
with open(filepath, "a") as f:
|
||||
f.write(rep.longreprtext + "\n")
|
||||
|
||||
|
||||
# trace chrome on failed test
|
||||
|
||||
|
||||
# inspired from https://docs.pytest.org/en/6.2.x/example/simple.html#request-example
|
||||
"""
|
||||
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
|
||||
def pytest_runtest_makereport(item, call):
|
||||
outcome = yield
|
||||
rep = outcome.get_result()
|
||||
# set a report attribute for each phase of a call, which can
|
||||
# be "setup", "call", "teardown"
|
||||
setattr(item, "rep_" + rep.when, rep)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def setup(request, context: BrowserContext):
|
||||
# before test
|
||||
context.tracing.start(screenshots=True, snapshots=True, sources=True)
|
||||
context.set_default_timeout(TIMEOUT)
|
||||
|
||||
# test execution
|
||||
yield context
|
||||
|
||||
# after test
|
||||
if request.node.rep_setup.failed:
|
||||
# test setup failed
|
||||
pass
|
||||
else:
|
||||
if request.node.rep_call.failed:
|
||||
# test execution failed
|
||||
filename = "trace-" + request.node.originalname + ".zip"
|
||||
context.tracing.stop(path=filename)
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue