Skip to content

Commit

Permalink
Merge pull request #7 from ZhikharevAl/ci/traces
Browse files Browse the repository at this point in the history
CI adding a trace viewer
  • Loading branch information
ZhikharevAl authored Nov 16, 2024
2 parents ff0d2cc + f37f76d commit fa74eea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
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

0 comments on commit fa74eea

Please sign in to comment.