Skip to content
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
44 changes: 7 additions & 37 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
services:
serve-webpack-example:
build:
context: .
dockerfile: ./example/webpack/Dockerfile
stdin_open: true
tty: true
serve-express-example:
build:
context: .
dockerfile: ./example/express-server/Dockerfile
stdin_open: true
tty: true
test:
depends_on:
- serve-webpack-example
- serve-express-example
build:
context: .
dockerfile: ./tests/Dockerfile
volumes:
- ./demo-dist:/app/demo-dist:ro
- ./playwright.config.ts:/app/playwright.config.ts:ro
- ./tests:/app/tests
- ./test-results:/app/test-results
- ./playwright-report:/app/playwright-report
command: npx playwright test
update-snapshots:
depends_on:
- serve-webpack-example
- serve-express-example
playwright-server:
build:
context: .
dockerfile: ./tests/Dockerfile
volumes:
- ./demo-dist:/app/demo-dist:ro
- ./playwright.config.ts:/app/playwright.config.ts:ro
- ./tests:/app/tests
- ./test-results:/app/test-results
- ./playwright-report:/app/playwright-report
command: npx playwright test --update-snapshots
args:
PLAYWRIGHT_VERSION: ${PLAYWRIGHT_VERSION}
ipc: host
command: playwright run-server --host=0.0.0.0 --port=3000
ports:
- '3000:3000'
18 changes: 1 addition & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"homepage": "https://apis.guru/graphql-voyager",
"repository": {
"type": "git",
"url": "https://github.com/APIs-guru/graphql-voyager.git"
"url": "git+https://github.com/APIs-guru/graphql-voyager.git"
},
"funding": "https://github.com/APIs-guru/graphql-voyager?sponsor=1",
"bugs": {
Expand Down Expand Up @@ -49,8 +49,8 @@
"prettier": "prettier --write --list-different . **/*.svg",
"prettier:check": "prettier --check . **/*.svg",
"check:spell": "cspell --cache --no-progress '**/*'",
"testonly": "npm run build:demo && npm pack && docker compose up --abort-on-container-exit --build test",
"update-snapshots": "npm run build:demo && npm pack && docker compose up --build update-snapshots",
"testonly": "npm run build:demo && npm pack && playwright test",
"update-snapshots": "npm run build:demo && npm pack && playwright test --update-snapshots",
"deploy": "wrangler deploy"
},
"peerDependencies": {
Expand All @@ -68,7 +68,6 @@
"svg-pan-zoom": "3.6.2"
},
"devDependencies": {
"@playwright/test": "1.53.0",
"@svgr/webpack": "8.1.0",
"@types/commonmark": "0.27.9",
"@types/node": "24.0.1",
Expand All @@ -86,6 +85,7 @@
"eslint-plugin-simple-import-sort": "12.1.1",
"graphql": "16.11.0",
"mini-css-extract-plugin": "2.9.2",
"playwright": "1.53.0",
"postcss-cssnext": "3.1.1",
"postcss-import": "16.1.0",
"postcss-loader": "8.1.1",
Expand Down
38 changes: 31 additions & 7 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import type { PlaywrightTestConfig } from '@playwright/test';
import { devices } from '@playwright/test';
import playwrightPackage from 'playwright/package.json' with { type: 'json' };
import { devices, type PlaywrightTestConfig } from 'playwright/test';

const isCI = !!process.env['CI'];
/**
* See https://playwright.dev/docs/test-configuration.
*/
const config: PlaywrightTestConfig = {
testDir: './tests',
// FIXME: remove '-linux'
snapshotPathTemplate:
'{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}-linux{ext}',
/* Maximum time one test can run for. */
timeout: 20 * 1000,
expect: {
Expand Down Expand Up @@ -38,12 +41,17 @@ const config: PlaywrightTestConfig = {

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'retain-on-failure',

connectOptions: {
wsEndpoint: 'ws://127.0.0.1:3000/',
exposeNetwork: '<loopback>',
},
},
projects: [
{
name: 'Demo',
testMatch: 'Demo.spec.ts',
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testMatch value "Demo.spec.ts" uses an uppercase 'D' but the actual test file is named "demo.spec.ts" with a lowercase 'd'. This mismatch will cause the Demo tests to not be found and executed. The testMatch should be changed to "demo.spec.ts" to match the actual filename.

Suggested change
testMatch: 'Demo.spec.ts',
testMatch: 'demo.spec.ts',

Copilot uses AI. Check for mistakes.
use: { baseURL: 'http://localhost:9090' },
use: { baseURL: 'http://127.0.0.1:9090' },
},
{
name: 'WebpackExample',
Expand All @@ -57,10 +65,26 @@ const config: PlaywrightTestConfig = {
},
],
outputDir: 'test-results/',
webServer: {
command: 'npm run serve',
url: 'http://localhost:9090/',
},
webServer: [
{
name: 'playwright-server',
env: { PLAYWRIGHT_VERSION: playwrightPackage.version },
command:
'docker compose up --abort-on-container-exit --build playwright-server',
url: 'http://127.0.0.1:3000/',
stdout: 'pipe',
timeout: 120 * 1000,
gracefulShutdown: {
signal: 'SIGINT',
timeout: 120 * 1000,
},
},
{
name: 'npm run serve',
command: 'npm run serve',
url: 'http://localhost:9090/',
},
],
};

export default config;
10 changes: 2 additions & 8 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# syntax=docker/dockerfile:1

FROM node:24

WORKDIR /app

COPY ["./package.json", "./package-lock.json", "./"]
RUN npm ci && npx playwright install --with-deps chromium

COPY ["./tsconfig.json", "./"]
COPY ["./scripts", "./scripts"]
ARG PLAYWRIGHT_VERSION="missing PLAYWRIGHT_VERSION arg"
RUN npm -g install "playwright@$PLAYWRIGHT_VERSION" && playwright install --with-deps chromium
2 changes: 1 addition & 1 deletion tests/PageObjectModel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Locator, type Page } from '@playwright/test';
import { type Locator, type Page } from 'playwright/test';
import { format } from 'prettier';

interface VoyagerURLParams {
Expand Down
2 changes: 1 addition & 1 deletion tests/demo.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test';
import { buildSchema, graphqlSync } from 'graphql';
import { expect, test } from 'playwright/test';

import { gotoVoyagerPage, SchemaPresets } from './PageObjectModel.ts';

Expand Down
2 changes: 1 addition & 1 deletion tests/express.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test';
import { expect, test } from 'playwright/test';

import { gotoVoyagerPage } from './PageObjectModel.ts';

Expand Down
2 changes: 1 addition & 1 deletion tests/webpack.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test';
import { expect, test } from 'playwright/test';

import { gotoVoyagerPage } from './PageObjectModel.ts';

Expand Down
Loading