-
Notifications
You must be signed in to change notification settings - Fork 2
playwright tests #829
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
base: develop
Are you sure you want to change the base?
playwright tests #829
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,10 @@ jobs: | |
| - run: npx eslint . | ||
| - run: npx vite build | ||
| - run: npx vitest | ||
| - run: npx vite build --config vite.config.demo.js | ||
| - run: npx playwright install chromium --with-deps | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the default be chrome? Maybe it would make sense for pull request to also test in firefox and webkit(safari) |
||
| - run: npx playwright test | ||
|
|
||
| - run: bash scripts/generate-json-schema.bash --check | ||
| - run: npx typedoc src/index.ts | ||
| - name: Install latest mdbook | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,3 +20,12 @@ jobs: | |
| echo "::error:: Please run `npm run version` before merging to main!"; \ | ||
| exit 1; \ | ||
| fi | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: latest | ||
| - run: npm ci | ||
| - run: npx playwright install chromium --with-deps | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be using --only-shell to only install headless |
||
| - name: "E2E tests against live demo" | ||
| run: npx playwright test | ||
| env: | ||
| DEMO_URL: https://samply.github.io/lens/demo/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,8 @@ node_modules | |
| dist | ||
| dist-ssr | ||
| *.local | ||
| test-results/ | ||
| coverage/ | ||
| TODO | ||
| book/book | ||
| docs | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Testing | ||
|
|
||
| ## End-to-end tests | ||
|
|
||
| Lens uses [Playwright](https://playwright.dev/) for end-to-end tests. They run against the demo application. The demo app must cover all components so that every component has test coverage. | ||
|
|
||
| ### Test sections | ||
|
|
||
| Tests are organised into numbered sections, one file per area: | ||
|
|
||
| | Section | File | Area | | ||
| | ------- | ----------------------- | ------------------------------------------ | | ||
| | 1–2 | `search-bar.spec.ts` | Search bar interactions and query building | | ||
| | 3 | `results.spec.ts` | Search execution and result display | | ||
| | 4 | `negotiate.spec.ts` | Request Data (Negotiate) button | | ||
| | 5 | `query-explain.spec.ts` | Query Explain button | | ||
| | 6 | `catalogue.spec.ts` | Catalogue panel | | ||
| | 7 | `language.spec.ts` | Language switching | | ||
| | 8 | `toast.spec.ts` | Toast notifications | | ||
|
|
||
| Shared Playwright helpers (search bar interactions, button clicks, assertions) live in `tests/e2e/searchbar-helpers.ts`. | ||
|
|
||
| ### Running the tests locally | ||
|
|
||
| Build the demo first, then run Playwright: | ||
|
|
||
| ```sh | ||
| npm run build:demo | ||
| npx playwright test | ||
| ``` | ||
|
|
||
| ### Adding a test | ||
|
|
||
| When you add or change a component feature, add a corresponding test in the relevant spec file. Number new tests by appending to the section (e.g. the next search-bar test after `2.9` is `2.10`). If no spec file exists for the component yet, create one, pick the next available section number, and add it to this table. | ||
|
|
||
| ## Unit tests | ||
|
|
||
| Unit tests use [Vitest](https://vitest.dev/) and live next to the source files they test (`*.test.ts`). Run them with: | ||
|
|
||
| ```sh | ||
| npx vitest | ||
| ``` | ||
|
|
||
| ### Query store defaults | ||
|
|
||
| An empty `QueryItem[][]` (no groups, no criteria) maps to a top-level `OR` node with no children: | ||
|
|
||
| ```json | ||
| { "operand": "OR", "children": [] } | ||
| ``` | ||
|
|
||
| If this default ever changes from `OR` to `AND`, the empty-store test in `src/helpers/ast-to-query.test.ts` will catch the regression. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be using --only-shell to only install headless