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

feat: add playwright tests #64

Merged
merged 6 commits into from
Dec 4, 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
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
Loading