Skip to content

Commit

Permalink
#203 Update GitHub actions to use Playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhad6 committed Jan 3, 2024
1 parent eaee781 commit e08fbfa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 61 deletions.
48 changes: 9 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: poetry run mypy ${{ env.PACKAGE_NAME }} tests

- name: Test (Pytest)
run: poetry run pytest
run: poetry run pytest tests/unit

frontend:
runs-on: ubuntu-latest
Expand All @@ -71,29 +71,14 @@ jobs:
- name: Enable Yarn
run: corepack enable

- name: Get Cypress version
id: cypress-version
run: echo VERSION=$(yarn info cypress --json | jq ".children.Version" -r) >> $GITHUB_OUTPUT

- name: Cypress cache
uses: actions/cache@v3
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-${{ steps.cypress-version.outputs.VERSION }}
restore-keys: |
cypress-${{ runner.os }}-
- name: Install Node.js dependencies
run: yarn

- name: Prune Cypress cache
run: yarn cypress cache prune

- name: Lint
run: yarn lint

- name: Unit tests
run: yarn test:unit
run: yarn test

e2e:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -122,39 +107,24 @@ jobs:
- name: Enable Yarn
run: corepack enable

- name: Get Cypress version
id: cypress-version
run: echo VERSION=$(yarn info cypress --json | jq ".children.Version" -r) >> $GITHUB_OUTPUT

- name: Cypress cache
uses: actions/cache@v3
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-${{ steps.cypress-version.outputs.VERSION }}
restore-keys: |
cypress-${{ runner.os }}-
- name: Install Node.js dependencies
run: yarn

- name: Prune Cypress cache
run: yarn cypress cache prune
- name: Install Playwright browsers
run: poetry run playwright install --with-deps chromium

- name: Build frontend
run: yarn build

- name: Start backend server
run: yarn backend start &

- name: Start frontend server
run: yarn preview &
- name: Start E2E server
run: poetry run python tests/e2e/start_server.py &

- name: E2E tests
run: yarn test:e2e
run: poetry run pytest tests/e2e

- name: Upload failure screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: e2e-failure-screenshots
path: cypress/screenshots
name: e2e-failed-traces
path: test-results
15 changes: 0 additions & 15 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,9 @@ jobs:
- name: Enable Yarn
run: corepack enable

- name: Get Cypress version
id: cypress-version
run: echo VERSION=$(yarn info cypress --json | jq ".children.Version" -r) >> $GITHUB_OUTPUT

- name: Cypress cache
uses: actions/cache@v3
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-${{ steps.cypress-version.outputs.VERSION }}
restore-keys: |
cypress-${{ runner.os }}-
- name: Install Node.js dependencies
run: yarn

- name: Prune Cypress cache
run: yarn cypress cache prune

- name: Build frontend
run: yarn build

Expand Down
10 changes: 3 additions & 7 deletions tests/e2e/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,10 @@ def commit_to_db(data: Any | None = None, message: str | None = None) -> None:
def reset_db(num_commits: int = 1) -> None:
"""Clear the database and make some initial commits."""
clear_db()
with freeze_time(get_datetime(1)):
with freeze_time(_START_DATETIME):
param = CustomParam(int=123, str="test")
# Convert last updated from freezegun.api.FakeDatetime to a true datetime
setattr(
param,
"_Param__last_updated",
datetime.fromtimestamp(param.last_updated.timestamp()),
)
# Use real datetime for last updated (rather than freezegun.api.FakeDatetime)
setattr(param, "_Param__last_updated", _START_DATETIME)
initial_data = ParamDict(
{
"commit_id": 1,
Expand Down

0 comments on commit e08fbfa

Please sign in to comment.