-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75513ad
commit 80f4e5f
Showing
9 changed files
with
800 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14.x' | ||
- name: Install dependencies | ||
run: yarn | ||
- name: Install Playwright | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: yarn playwright test | ||
- uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ | |
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
test-results/ | ||
playwright-report/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('http://localhost:4001') | ||
const pageTitle = await page.textContent('header h1 span:last-child') | ||
expect(pageTitle).toEqual('Projects') | ||
}) | ||
|
||
test.describe('VpcPage', () => { | ||
test('can create subnet', async ({ page }) => { | ||
// could goto page directly but clicking through is more realistic | ||
await page.click('table :text("mock-project")') | ||
await page.click('a:has-text("Networking")') | ||
await page.click('a:has-text("mock-vpc")') | ||
|
||
// only one row in table, the default mock-subnet | ||
let rows = await page.locator('tbody >> tr') | ||
await expect(rows).toHaveCount(1) | ||
await expect(rows.nth(0).locator('text="mock-subnet"')).toBeVisible() | ||
|
||
// open modal, fill out form, submit | ||
await page.click('text=New subnet') | ||
await page.fill('text=IPv4 block', '1.1.1.2/24') | ||
await page.fill('input[name=name]', 'mock-subnet-2') | ||
await page.click('button:has-text("Create subnet")') | ||
|
||
rows = await page.locator('tbody >> tr') | ||
await expect(rows).toHaveCount(2) | ||
|
||
await expect(rows.nth(0).locator('text="mock-subnet"')).toBeVisible() | ||
await expect(rows.nth(0).locator('text="1.1.1.1/24"')).toBeVisible() | ||
|
||
await expect(rows.nth(1).locator('text="mock-subnet-2"')).toBeVisible() | ||
await expect(rows.nth(1).locator('text="1.1.1.2/24"')).toBeVisible() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import type { PlaywrightTestConfig } from '@playwright/test' | ||
import { devices } from '@playwright/test' | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// require('dotenv').config(); | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
const config: PlaywrightTestConfig = { | ||
testDir: './app/e2e', | ||
/* 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.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, | ||
/* 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: 'http://localhost:3000', | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { | ||
...devices['Desktop Chrome'], | ||
}, | ||
}, | ||
{ | ||
name: 'firefox', | ||
use: { | ||
...devices['Desktop Firefox'], | ||
}, | ||
}, | ||
{ | ||
name: 'webkit', | ||
use: { | ||
...devices['Desktop Safari'], | ||
}, | ||
}, | ||
], | ||
|
||
// use different port so it doesn't conflict with local dev server | ||
webServer: { | ||
command: 'yarn start:msw --port 4001', | ||
port: 4001, | ||
}, | ||
} | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.