Skip to content

Commit d3154f0

Browse files
committed
Update snapshots script
based on RUN_IN_DOCKER env param
1 parent df35813 commit d3154f0

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"postinstall": "npm run bootstrap",
1111
"start": "lerna run --scope @blocknote/example-editor dev",
1212
"start:built": "npx serve examples/editor/dist",
13+
"updateSnaps": "docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.19.2-focal npx playwright install --with-deps & export RUN_IN_DOCKER=true && npx playwright test --update-snapshots",
1314
"test": "jest --coverage=true --config=jest.config.js",
1415
"build": "lerna run build --concurrency 1",
1516
"lint": "lerna run lint",

tests/end-to-end/basics/basics.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { test, expect, Page } from "@playwright/test";
2+
import { BASE_URL } from "../../utils/const";
23

34
test.beforeEach(async ({ page }) => {
4-
await page.goto("http://localhost:3000");
5-
// TODO: add const for that
6-
// await page.goto("http://host.docker.internal:3000");
5+
await page.goto(BASE_URL);
76
});
87

98
test.describe("Basic typing functionality", () => {

tests/end-to-end/placeholder/placeholder.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { test, expect, Page } from "@playwright/test";
1+
import { test, expect } from "@playwright/test";
2+
import { BASE_URL } from "../../utils/const";
23

34
test.beforeEach(async ({ page }) => {
4-
await page.goto("http://localhost:3000");
5-
// TODO: add const for that
6-
// await page.goto("http://host.docker.internal:3000");
5+
await page.goto(BASE_URL);
76
});
87

98
test.describe("Basic placeholder functionality", () => {

tests/utils/const.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const PORT = 3000;
2+
export const BASE_URL = process.env.RUN_IN_DOCKER
3+
? `http://localhost:${PORT}`
4+
: `http://host.docker.internal:${PORT}`;

0 commit comments

Comments
 (0)