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

Set up Playwright for e2e tests, add landing page e2e tests #529

Merged
merged 12 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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
7 changes: 5 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ indent_style = space
# on these file types.
[src/**.{ts,scss}]
indent_size = 4
[test/**.{ts}]
[tests/**.{ts}]
indent_size = 4
MattyMay marked this conversation as resolved.
Show resolved Hide resolved

[*.{html,yml,yaml,vue,json,js,cy.ts}]
[tests/e2e/**.ts]
indent_size = 2

[*.{html,yml,yaml,vue,json,js}]
indent_size = 2
38 changes: 35 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ jobs:

- run: npm ci
- run: npm run lint
- run: npm run build

component-tests:
unit-tests:
# Lint is fast. If we wait for it we guarantee a cache hit on dependencies.
needs: lint

Expand All @@ -50,5 +51,36 @@ jobs:
cache: 'npm'

- run: npm ci
- run: npm run build
- run: npm run test
- run: npm test

e2e-tests:
# Lint is fast. If we wait for it we guarantee a cache hit on dependencies.
needs: lint

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
with:
submodules: 'true'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: docker compose -f e2e_test_stack/docker-compose.yml build
- run: docker compose -f e2e_test_stack/docker-compose.yml pull

- run: npm ci

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

- run: npm run e2e:once
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ yarn-error.log*
*.sln
*.sw*
coverage

/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ For information about contributing to Autograder.io, see our
## Setup
Follow the [dev stack setup tutorial](https://github.com/eecs-autograder/autograder-full-stack/blob/master/docs/development_setup.md) for the [autograder-full-stack repo](https://github.com/eecs-autograder/autograder-full-stack).

## Dev commands
Our CI is currently configured to use NodeJS 16.
The component tests (which now use vitest as their runner) should work with Node 20,
but `npm run build` (which still uses vue-cli-services) will ONLY work with Node 16
Expand All @@ -17,15 +16,39 @@ by running:
nvm install 16
```

To run the component tests:
## Linting and Testing
To run linters (eslint, Prettier, type checking, etc.):
```
npm run lint
npm run build
```

To run the unit tests:
```
npm test
```

To run linters (eslint, Prettier, type checking, etc.):
We recently started adding end-to-end tests written with Playwright.
Running them requires building and starting the end-to-end test stack:
```
npm run lint
npm run build
# Build the stack
docker compose -f e2e_test_stack/docker-compose.yml build

# Start the stack in the foreground
npm run e2e:serve

# Or start the stack in the background
npm run e2e:served
```

To run the e2e tests headless:
```
npm run e2e
```

To run the e2e tests in UI mode:
```
npm run e2e -- --ui
```

## Coding Standards
Expand Down
Loading
Loading