Skip to content

Commit

Permalink
Merge branch 'playwright' of https://github.com/theosanderson/taxonium
Browse files Browse the repository at this point in the history
…into playwright
  • Loading branch information
theosanderson committed Oct 12, 2023
2 parents 052a2d0 + ca59e94 commit 29787a9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 41 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
branches: [main, master]
pull_request:
branches: [ main, master ]
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: yarn install
working-directory: ./taxonium_website
- name: Install Playwright Browsers
run: npx playwright install --with-deps
working-directory: ./taxonium_website
- name: Run Playwright tests
run: npx playwright test
working-directory: ./taxonium_website
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: ./taxonium_website/playwright-report/
retention-days: 30
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: yarn install
working-directory: ./taxonium_website
- name: Install Playwright Browsers
run: npx playwright install --with-deps
working-directory: ./taxonium_website
- name: Run Playwright tests
run: npx playwright test
working-directory: ./taxonium_website
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: ./taxonium_website/playwright-report/
retention-days: 30
10 changes: 3 additions & 7 deletions taxonium_website/e2e/example.spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
// @ts-check
import { test, expect } from '@playwright/test';
import { test, expect } from "@playwright/test";

test('has title', async ({ page }) => {

await page.goto('//localhost:4173');
test("has title", async ({ page }) => {
await page.goto("//localhost:4173");
// wait a few seconds


// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Taxonium/);
});


25 changes: 12 additions & 13 deletions taxonium_website/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
import { defineConfig, devices } from '@playwright/test';
import { defineConfig, devices } from "@playwright/test";

/**
* Read environment variables from file.
Expand All @@ -11,7 +11,7 @@ import { defineConfig, devices } from '@playwright/test';
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
testDir: './e2e',
testDir: "./e2e",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand All @@ -21,31 +21,31 @@ export default defineConfig({
/* 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',
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://127.0.0.1:4173',
baseURL: "http://127.0.0.1:4173",

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
trace: "on-first-retry",
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
name: "webkit",
use: { ...devices["Desktop Safari"] },
},

/* Test against mobile viewports. */
Expand All @@ -70,9 +70,8 @@ export default defineConfig({
],

webServer: {
command: 'yarn preview',
command: "yarn preview",
reuseExistingServer: !process.env.CI,
port: 4173,
},
});

0 comments on commit 29787a9

Please sign in to comment.