Skip to content

Commit 283c758

Browse files
committed
fix
1 parent 85e306c commit 283c758

19 files changed

Lines changed: 41 additions & 54 deletions

jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module.exports = {
22
preset: 'ts-jest',
33
testEnvironment: 'jsdom',
4-
roots: ['<rootDir>/test'],
4+
roots: ['<rootDir>/test/unit'],
55
testMatch: ['**/*.test.ts'],
66
moduleFileExtensions: ['ts', 'js', 'json'],
77
transform: {
88
'^.+\\.ts$': ['ts-jest', {
99
tsconfig: 'test/tsconfig.json',
1010
}],
1111
},
12-
setupFilesAfterEnv: ['<rootDir>/test/jest.setup.ts'],
12+
setupFilesAfterEnv: ['<rootDir>/test/unit/jest.setup.ts'],
1313
// Allow per-file @jest-environment docblock overrides
1414
// (use @jest-environment node for Worker-context tests)
1515
};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
"build:concatBundleFunc": "concat-cli -f tools/spector.ext.header.js dist/spector.bundle.js tools/spector.ext.footer.js -o extensions/spector.bundle.func.js",
3636
"build:tslint": "tslint -c ./tslint.json -p ./src/tsconfig.json",
3737
"build": "run-s build:tslint build:bundle build:types build:copybuild:copy:bundle build:copy:worker:bundle build:concatBundleFunc -n",
38-
"test": "jest --config jest.config.js",
38+
"test": "jest --config jest.config.js && npx playwright test && npx playwright test --config test/integration/playwright.config.ts",
3939
"test:unit": "jest --config jest.config.js",
4040
"test:e2e": "npx playwright test",
41-
"test:visual": "npx playwright test --config test/playwright.config.ts",
42-
"test:visual:update": "npx playwright test --config test/playwright.config.ts --update-snapshots"
41+
"test:visual": "npx playwright test --config test/integration/playwright.config.ts",
42+
"test:visual:update": "npx playwright test --config test/integration/playwright.config.ts --update-snapshots"
4343
},
4444
"dependencies": {
4545
"@shaderfrog/glsl-parser": "^7.0.1",

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from '@playwright/test';
22

33
export default defineConfig({
4-
testDir: './e2e',
4+
testDir: './test/e2e',
55
timeout: 60000,
66
expect: {
77
timeout: 15000,

test/integration/fixtures/captured-frame.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@
158158
"commands": [
159159
{
160160
"id": 0,
161-
"startTime": 1774015140680.3,
162-
"commandEndTime": 1774015140680.3,
163-
"endTime": 1774015140682.1,
161+
"startTime": 647.1999999992549,
162+
"commandEndTime": 647.3000000007451,
163+
"endTime": 648.8000000007451,
164164
"name": "clearColor",
165165
"commandArguments": [
166166
0.1,
@@ -169,23 +169,23 @@
169169
1
170170
],
171171
"stackTrace": [
172-
"render (http://localhost:7777/test/fixtures/test-scene.html:105:16)"
172+
"render (http://localhost:7777/test/integration/fixtures/test-scene.html:105:16)"
173173
],
174174
"status": 30,
175175
"text": "clearColor: 0.1, 0.1, 0.18, 1",
176176
"consumeCommandId": 1
177177
},
178178
{
179179
"id": 1,
180-
"startTime": 1774015140682.1,
181-
"commandEndTime": 1774015140682.1,
182-
"endTime": 1774015140687,
180+
"startTime": 648.8000000007451,
181+
"commandEndTime": 648.8000000007451,
182+
"endTime": 654,
183183
"name": "clear",
184184
"commandArguments": [
185185
16384
186186
],
187187
"stackTrace": [
188-
"render (http://localhost:7777/test/fixtures/test-scene.html:106:16)"
188+
"render (http://localhost:7777/test/integration/fixtures/test-scene.html:106:16)"
189189
],
190190
"status": 0,
191191
"text": "clear: COLOR_BUFFER_BIT",
@@ -225,17 +225,17 @@
225225
},
226226
{
227227
"id": 2,
228-
"startTime": 1774015140687,
229-
"commandEndTime": 1774015140687,
230-
"endTime": 1774015140701.2,
228+
"startTime": 654,
229+
"commandEndTime": 654.1000000014901,
230+
"endTime": 672.6000000014901,
231231
"name": "drawArrays",
232232
"commandArguments": [
233233
4,
234234
0,
235235
3
236236
],
237237
"stackTrace": [
238-
"render (http://localhost:7777/test/fixtures/test-scene.html:107:16)"
238+
"render (http://localhost:7777/test/integration/fixtures/test-scene.html:107:16)"
239239
],
240240
"status": 0,
241241
"text": "drawArrays: TRIANGLES, 0 indices, 3",
@@ -682,10 +682,10 @@
682682
"FrameBuffer": null
683683
}
684684
},
685-
"startTime": 1774015140666.1,
686-
"listenCommandsStartTime": 1774015140680.3,
687-
"listenCommandsEndTime": 1774015140701.3,
688-
"endTime": 1774015140711.4,
685+
"startTime": 630.8000000007451,
686+
"listenCommandsStartTime": 647.1999999992549,
687+
"listenCommandsEndTime": 672.6999999992549,
688+
"endTime": 682.5,
689689
"analyses": [
690690
{
691691
"analyserName": "Commands",

test/integration/fixtures/generate-capture.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* One-time capture generation script.
33
*
4-
* Run with: npx playwright test generate-capture --config test/playwright.config.ts
4+
* Run with: npx playwright test generate-capture --config test/integration/playwright.config.ts
55
*
66
* This navigates to the test scene, triggers a Spector capture, and saves
77
* the resulting JSON to test/fixtures/captured-frame.json.
@@ -15,7 +15,7 @@ const FIXTURE_DIR = path.join(__dirname);
1515
const FIXTURE_PATH = path.join(FIXTURE_DIR, "captured-frame.json");
1616

1717
test("generate captured-frame.json fixture", async ({ page }) => {
18-
await page.goto("/test/fixtures/test-scene.html", {
18+
await page.goto("/test/integration/fixtures/test-scene.html", {
1919
waitUntil: "domcontentloaded",
2020
});
2121

test/integration/fixtures/test-scene.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<body>
2121
<canvas id="renderCanvas" width="800" height="600"></canvas>
2222

23-
<script src="../../dist/spector.bundle.js"></script>
23+
<script src="../../../dist/spector.bundle.js"></script>
2424
<script>
2525
(function () {
2626
"use strict";

test/integration/helpers/spector-fixture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface SpectorPage {
3333
export const test = base.extend<{ spectorPage: SpectorPage }>({
3434
spectorPage: async ({ page }, use) => {
3535
// Navigate to the test scene and wait for the canvas + Spector global.
36-
await page.goto("/test/fixtures/test-scene.html", {
36+
await page.goto("/test/integration/fixtures/test-scene.html", {
3737
waitUntil: "domcontentloaded",
3838
});
3939

test/integration/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default defineConfig({
3838
},
3939
],
4040
webServer: {
41-
command: `npx http-server "${path.join(__dirname, "..")}" -p ${PORT} --silent -c-1`,
41+
command: `npx http-server "${path.join(__dirname, "..", "..")}" -p ${PORT} --silent -c-1`,
4242
port: PORT,
4343
reuseExistingServer: !process.env.CI,
4444
timeout: 10_000,

test/integration/visual/responsive.spec.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,6 @@ test.describe("Responsive viewports", () => {
1515
);
1616
});
1717

18-
test("laptop 1366x768", async ({ spectorPage }) => {
19-
const { page } = spectorPage;
20-
await page.setViewportSize({ width: 1366, height: 768 });
21-
await spectorPage.injectStabilizationCSS();
22-
await loadCapturedFrame(page);
23-
await page.waitForTimeout(200);
24-
25-
await expect(page.locator(".resultViewComponent")).toHaveScreenshot(
26-
"responsive-1366x768.png",
27-
{ maxDiffPixels: 150 },
28-
);
29-
});
30-
3118
test("below breakpoint 1023x600", async ({ spectorPage }) => {
3219
const { page } = spectorPage;
3320
// Below the 1024px media query — triggers responsive/hamburger layout.

0 commit comments

Comments
 (0)