From d683727e089d443222057699e18b61ae7acbb34e Mon Sep 17 00:00:00 2001 From: Osundwa Jeff Date: Fri, 4 Oct 2024 16:31:34 +0300 Subject: [PATCH] update playwright.config and playwright versions (#16) --- playwright/ci-test/package.json | 2 +- playwright/ci-test/shell.nix | 2 +- playwright/staging-tests/package-lock.json | 24 ++--- playwright/staging-tests/package.json | 2 +- playwright/staging-tests/playwright.config.ts | 87 +++++++++++++++++++ playwright/staging-tests/shell.nix | 2 +- 6 files changed, 103 insertions(+), 16 deletions(-) create mode 100644 playwright/staging-tests/playwright.config.ts diff --git a/playwright/ci-test/package.json b/playwright/ci-test/package.json index b0c259c..42707fa 100644 --- a/playwright/ci-test/package.json +++ b/playwright/ci-test/package.json @@ -11,7 +11,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@playwright/test": "^1.39.0", + "@playwright/test": "^1.42.1", "@types/node": "^20.8.9" }, "dependencies": { diff --git a/playwright/ci-test/shell.nix b/playwright/ci-test/shell.nix index 595c145..0ed07c2 100644 --- a/playwright/ci-test/shell.nix +++ b/playwright/ci-test/shell.nix @@ -5,7 +5,7 @@ let # If you want use a different version, go to nix packages search, and find the # github hash of the version you want to be using, then replace in the URL below. # - nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/4059c4f71b3a7339261c0183e365fd8016f24bdb.tar.gz"; + nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/1536926ef5621b09bba54035ae2bb6d806d72ac8.tar.gz"; pkgs = import nixpkgs { config = { }; overlays = [ ]; }; in with pkgs; diff --git a/playwright/staging-tests/package-lock.json b/playwright/staging-tests/package-lock.json index 515588d..44326a0 100644 --- a/playwright/staging-tests/package-lock.json +++ b/playwright/staging-tests/package-lock.json @@ -9,17 +9,17 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { - "@playwright/test": "^1.40.1", + "@playwright/test": "^1.42.1", "@types/node": "^20.8.9" } }, "node_modules/@playwright/test": { - "version": "1.40.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.1.tgz", - "integrity": "sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw==", + "version": "1.42.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.42.1.tgz", + "integrity": "sha512-Gq9rmS54mjBL/7/MvBaNOBwbfnh7beHvS6oS4srqXFcQHpQCV1+c8JXWE8VLPyRDhgS3H8x8A7hztqI9VnwrAQ==", "dev": true, "dependencies": { - "playwright": "1.40.1" + "playwright": "1.42.1" }, "bin": { "playwright": "cli.js" @@ -52,12 +52,12 @@ } }, "node_modules/playwright": { - "version": "1.40.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz", - "integrity": "sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==", + "version": "1.42.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.42.1.tgz", + "integrity": "sha512-PgwB03s2DZBcNRoW+1w9E+VkLBxweib6KTXM0M3tkiT4jVxKSi6PmVJ591J+0u10LUrgxB7dLRbiJqO5s2QPMg==", "dev": true, "dependencies": { - "playwright-core": "1.40.1" + "playwright-core": "1.42.1" }, "bin": { "playwright": "cli.js" @@ -70,9 +70,9 @@ } }, "node_modules/playwright-core": { - "version": "1.40.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.1.tgz", - "integrity": "sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==", + "version": "1.42.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.42.1.tgz", + "integrity": "sha512-mxz6zclokgrke9p1vtdy/COWBH+eOZgYUVVU34C73M+4j4HLlQJHtfcqiqqxpP0o8HhMkflvfbquLX5dg6wlfA==", "dev": true, "bin": { "playwright-core": "cli.js" diff --git a/playwright/staging-tests/package.json b/playwright/staging-tests/package.json index a76e840..e3435f8 100644 --- a/playwright/staging-tests/package.json +++ b/playwright/staging-tests/package.json @@ -8,7 +8,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@playwright/test": "^1.40.1", + "@playwright/test": "^1.42.1", "@types/node": "^20.8.9" } } diff --git a/playwright/staging-tests/playwright.config.ts b/playwright/staging-tests/playwright.config.ts new file mode 100644 index 0000000..5af256e --- /dev/null +++ b/playwright/staging-tests/playwright.config.ts @@ -0,0 +1,87 @@ + +import { defineConfig, devices } from '@playwright/test'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ + +//require('dotenv').config(); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + testDir: './tests', + /* Tests timeout */ + timeout: 30 * 1000, + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'html', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + baseURL: 'http://example.com', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + //baseURL: process.env.STAGING === '1' ? 'http://example.com' : 'http://127.0.0.1/' + }, + + /* Configure projects for major browsers */ + projects: [ + // { name: 'setup', testMatch: /.*\.setup\.ts/ }, + { + name: 'chromium', + use: { ...devices['Desktop Chrome'], + // Use prepared auth state. + storageState: 'auth.json', + }, + // dependencies: ['setup'], + }, + // + // { + // name: 'firefox', + // use: { ...devices['Desktop Firefox'] }, + // }, + // + // { + // name: 'webkit', + // use: { ...devices['Desktop Safari'] }, + // }, + + /* Test against mobile viewports. */ + // { + // name: 'Mobile Chrome', + // use: { ...devices['Pixel 5'] }, + // }, + // { + // name: 'Mobile Safari', + // use: { ...devices['iPhone 12'] }, + // }, + + /* Test against branded browsers. */ + // { + // name: 'Microsoft Edge', + // use: { ...devices['Desktop Edge'], channel: 'msedge' }, + // }, + // { + // name: 'Google Chrome', + // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, + // }, + ], + + /* Run your local dev server before starting the tests */ + // webServer: { + // command: 'npm run start', + // url: 'http://127.0.0.1:3000', + // reuseExistingServer: !process.env.CI, + // }, +}); diff --git a/playwright/staging-tests/shell.nix b/playwright/staging-tests/shell.nix index 595c145..0ed07c2 100644 --- a/playwright/staging-tests/shell.nix +++ b/playwright/staging-tests/shell.nix @@ -5,7 +5,7 @@ let # If you want use a different version, go to nix packages search, and find the # github hash of the version you want to be using, then replace in the URL below. # - nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/4059c4f71b3a7339261c0183e365fd8016f24bdb.tar.gz"; + nixpkgs = builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/1536926ef5621b09bba54035ae2bb6d806d72ac8.tar.gz"; pkgs = import nixpkgs { config = { }; overlays = [ ]; }; in with pkgs;