authentik setup and tracing #2

Merged
dan merged 69 commits from working-setup into dev 2023-11-27 17:01:47 +01:00
Showing only changes of commit f4cb16a162 - Show all commits

View file

@ -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)
"""