Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI adding a trace viewer #7

Merged
merged 5 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/auto_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ jobs:
env:
PARABANK_USERNAME: ${{ secrets.PARABANK_USERNAME }}
PARABANK_PASSWORD: ${{ secrets.PARABANK_PASSWORD }}
run: pytest --alluredir=allure-results
run: |
mkdir -p test-results
pytest --alluredir=allure-results --tracing=retain-on-failure

- name: Upload Playwright traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-traces
path: test-results/
retention-days: 20

- uses: actions/upload-artifact@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ pytest.log

/.venv
/.vscode
/traces
/test-results
6 changes: 3 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def page(browser: Browser, request: SubRequest) -> Generator[Page, None, None]:
yield page

if request.node.rep_call.failed: # type: ignore
context.tracing.stop(path=f"traces/trace-{request.node.name}.zip")
context.tracing.stop(path=f"test-results/trace-{request.node.name}.zip")
allure.attach(
body=page.screenshot(),
name="screenshot",
Expand All @@ -53,8 +53,8 @@ def page(browser: Browser, request: SubRequest) -> Generator[Page, None, None]:

@pytest.fixture(autouse=True, scope="session")
def clear_traces() -> None:
"""Clear traces directory before test run."""
traces_dir = Path("traces")
"""Clear test-results directory before test run."""
traces_dir = Path("test-results")
if traces_dir.exists():
shutil.rmtree(traces_dir)
traces_dir.mkdir(exist_ok=True)
Expand Down
Loading