Skip to content

Commit

Permalink
feat: add playwright tests (#64)
Browse files Browse the repository at this point in the history
* feat(test): add Playwright
* feat(test): test the wall insulation
* feat(test): test the window control dialog
* feat(test): use PageModelObject to simplify the tests
* feat(test): remove cypress
* fix: update the HouseComponentContext to not override the material's composition
  • Loading branch information
ReidyT authored Dec 4, 2024
1 parent a42b66b commit f86b37e
Show file tree
Hide file tree
Showing 35 changed files with 624 additions and 1,317 deletions.
60 changes: 32 additions & 28 deletions .github/workflows/cypress.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cypress UI tests
name: Tests

on:
push:
Expand All @@ -7,55 +7,59 @@ on:
merge_group:
pull_request:

env:
VITE_PORT: 3000
VITE_API_HOST: http://localhost:3636
VITE_GRAASP_APP_KEY: id-1234567890
VITE_ENABLE_MOCK_API: true
VITE_VERSION: ci-tests
CI: true

jobs:
cypress-run:
concurrency: cypress-${{ github.head_ref || github.ref }}
run-tests:
concurrency: tests-${{ github.head_ref || github.ref }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Yarn Install and Cache
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
with:
cypress: true

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Build App
run: yarn build:test
shell: bash
env:
VITE_PORT: 3000
VITE_API_HOST: http://localhost:3636
VITE_GRAASP_APP_KEY: id-1234567890
VITE_ENABLE_MOCK_API: true
VITE_VERSION: cypress-tests
VITE_PORT: ${{ env.VITE_PORT }}
VITE_API_HOST: ${{ env.VITE_API_HOST }}
VITE_GRAASP_APP_KEY: ${{ env.VITE_GRAASP_APP_KEY }}
VITE_ENABLE_MOCK_API: ${{ env.VITE_ENABLE_MOCK_API }}
VITE_VERSION: ${{ env.VITE_VERSION }}
CI: ${{ env.CI }}

- name: Vitest Run
run: yarn vitest
run: yarn unittest
shell: bash

- name: Cypress Run
uses: cypress-io/github-action@v5
- name: Playwright Run
run: yarn playwright
shell: bash
env:
VITE_PORT: 3000
VITE_API_HOST: http://localhost:3636
VITE_GRAASP_APP_KEY: id-1234567890
VITE_ENABLE_MOCK_API: true
VITE_VERSION: cypress-tests
with:
install: false
config: baseUrl=http://localhost:3000
start: yarn preview:test
browser: chrome
quiet: true
# point to new cypress@10 config file
config-file: cypress.config.ts
VITE_PORT: ${{ env.VITE_PORT }}
VITE_API_HOST: ${{ env.VITE_API_HOST }}
VITE_GRAASP_APP_KEY: ${{ env.VITE_GRAASP_APP_KEY }}
VITE_ENABLE_MOCK_API: ${{ env.VITE_ENABLE_MOCK_API }}
VITE_VERSION: ${{ env.VITE_VERSION }}
CI: ${{ env.CI }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
name: playwright-report
path: playwright-report

- name: coverage report
run: npx nyc report --reporter=text-summary
Expand Down
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ yarn-debug.log*
.vscode/*
!.vscode/settings.json

# cypress
cypress/screenshots/
cypress/videos/
cypress/downloads/
# Playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
29 changes: 0 additions & 29 deletions cypress.config.ts

This file was deleted.

23 changes: 0 additions & 23 deletions cypress/e2e/analytics/main.cy.ts

This file was deleted.

23 changes: 0 additions & 23 deletions cypress/e2e/builder/main.cy.ts

This file was deleted.

20 changes: 0 additions & 20 deletions cypress/e2e/player/main.cy.ts

This file was deleted.

24 changes: 0 additions & 24 deletions cypress/fixtures/members.ts

This file was deleted.

12 changes: 0 additions & 12 deletions cypress/fixtures/mockItem.ts

This file was deleted.

43 changes: 0 additions & 43 deletions cypress/support/commands.ts

This file was deleted.

12 changes: 0 additions & 12 deletions cypress/support/component-index.html

This file was deleted.

38 changes: 0 additions & 38 deletions cypress/support/component.ts

This file was deleted.

30 changes: 0 additions & 30 deletions cypress/support/e2e.ts

This file was deleted.

10 changes: 0 additions & 10 deletions cypress/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default [
'**/.nyc_output',
'**/.yarn',
'**/commitlint.config.cjs',
'playwright-report/**/*',
],
},
...fixupConfigRules(
Expand All @@ -39,7 +40,6 @@ export default [
'airbnb-typescript',
'plugin:import/typescript',
'prettier',
'plugin:cypress/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
Expand Down
Loading

0 comments on commit f86b37e

Please sign in to comment.