Skip to content

Commit

Permalink
feat: update how we store playwright state (#376)
Browse files Browse the repository at this point in the history
Because

- the way we store storageState is incorrect

This commit

- update how we store playwright state
  • Loading branch information
EiffelFly committed Mar 21, 2023
1 parent bf4924c commit 9bf8de5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ yarn-error.log*
/test-results/
/playwright-report/
/playwright/.cache/
/integration-test/.auth/

# Generated env file

Expand Down
1 change: 0 additions & 1 deletion Dockerfile.playwright
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ COPY --chown=playwright:nodejs ./playwright.config.ts ./
COPY --chown=playwright:nodejs ./.env ./
COPY --chown=playwright:nodejs ./env.sh ./
COPY --chown=playwright:nodejs ./entrypoint-playwright.sh ./
COPY --chown=playwright:nodejs ./playwright-state.json ./

RUN mkdir public

Expand Down
4 changes: 3 additions & 1 deletion integration-test/helper/login.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ test("should successfully fill in the onboarding form and submit", async ({
page,
}) => {
await expectToOnboardUser(page);
await page.context().storageState({ path: "playwright-state.json" });
await page
.context()
.storageState({ path: "integration-test/.auth/user.json" });
});
15 changes: 0 additions & 15 deletions playwright-state.json

This file was deleted.

4 changes: 3 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const config: PlaywrightTestConfig = {
reporter: "dot",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
storageState: "playwright-state.json",
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
Expand Down Expand Up @@ -65,6 +64,7 @@ const config: PlaywrightTestConfig = {
dependencies: ["setup"],
use: {
...devices["Desktop Chrome"],
storageState: "integration-test/.auth/user.json",
},
},

Expand All @@ -73,6 +73,7 @@ const config: PlaywrightTestConfig = {
dependencies: ["setup"],
use: {
...devices["Desktop Firefox"],
storageState: "integration-test/.auth/user.json",
},
},

Expand All @@ -81,6 +82,7 @@ const config: PlaywrightTestConfig = {
dependencies: ["setup"],
use: {
...devices["Desktop Safari"],
storageState: "integration-test/.auth/user.json",
},
},

Expand Down

0 comments on commit 9bf8de5

Please sign in to comment.