astro/packages/astro/playwright.config.js

43 lines
1.2 KiB
JavaScript
Raw Normal View History

Adding E2E tests for client hydration and HMR (#3374) * adding Tailwind E2E tests with Playwright * package.json updates * adding e2e tests to CI workflow * using e2e for dev tests, mocha for build tests * refactor: sharing test-utils helpers * chore: update lockfile * Adding contributing docs * Revert "refactor: sharing test-utils helpers" This reverts commit 48496f43bc99eab30747baf6e83041ba4932e786. * refactor: simpler solution to resolving e2e test fixtures * chore: updating lockfile * refactor: cleaning up how URLs are resolved in e2e tests * install playwright deps in CI * ensure playwright deps are installed during CI * adding a basic HMR test for tailwind styles * using @e2e for playwright test packages * adding react hydration and HMR tests * adding hydration and HMR tests for preact * adding svelte hydration and HMR tests * adding solid-js hydration and HMR tests * adding solid hydration and HMR tests * adding vue hydration and HMR tests * adding client:media tests * fixing Lit hydration and HMR tests * fixing up the Vue e2e tests * fixing up svelte tests * chore: test cleanup * chore: cleaning up test element IDs * chore: updating lock file * chore: update lockfile after merge * TEMP: disabling React e2e tests * Revert "TEMP: disabling React e2e tests" This reverts commit ed1bad9cbc870a08bf86adc6256f2ffe31f82da8. * updating to use the new editFiles helper * chore: updating lock file * updating lock file * updating lockfile * TEMP: watching for console logs * TEMP: testing typescript tests * updating test:e2e scripts for config file * seems like it didn't find the config file? * use a fresh dev server for each test * removing Lit tests for now * Revert "removing Lit tests for now" This reverts commit 4970a8093e5892f633fdb7442b66772c6edf9931. * updating test config for CI * WIP: disabling HMR tests to track down why they're unreliable * TEMP: logging to debug HMR test * afterEach isn't a global in Playwright * fix: the test's file reset helper was using a URL not filepath * one last try, why is the HMR test hanging at cleanup? * resetting files after tailwind HMR test * create the onNextChange watcher before editFile is called * moving the file changed sync into editFile() * code refactor + Astro Component HMR test * chore: lint fixes * adding a test suite for the framework-multiple example app
2022-05-23 16:56:45 +00:00
import { devices } from '@playwright/test';
const config = {
testMatch: 'e2e/*.test.js',
/* Maximum time one test can run for. */
timeout: 30 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 5000
},
/* Fail the build on CI if you accidentally left test 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,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* 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('/')`. */
baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
projects: [
{
name: 'Chrome Stable',
use: {
browserName: 'chromium',
channel: 'chrome',
},
},
],
};
export default config;