-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace nightwatch with playwright for e2e testing. Remove legacy deps.
- Loading branch information
Showing
30 changed files
with
357 additions
and
5,960 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,8 @@ jobs: | |
run: | | ||
yarn | ||
yarn lint | ||
yarn test | ||
yarn unit | ||
yarn e2e | ||
yarn docs | ||
- name: Setup Node.js | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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,51 @@ | ||
import { defineConfig } from '@playwright/test' | ||
|
||
export default defineConfig({ | ||
testDir: './tests/e2e', | ||
testMatch: /.*\.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: 0, | ||
}, | ||
/* 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: 'list', | ||
use: { | ||
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ | ||
actionTimeout: 10000, | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL: 'http://localhost:5173', | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
|
||
/* Only on CI systems run the tests headless */ | ||
headless: !!process.env.CI, | ||
}, | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: 'yarn dev', | ||
port: 5173, | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
// Google Chrome is pre-installed on Github CI/dev desktops, so use it to avoid 'playwright install' delays | ||
projects: [ | ||
{ | ||
name: 'Google Chrome', | ||
use: { | ||
channel: 'chrome', | ||
}, | ||
}, | ||
], | ||
}) |
Empty file.
Empty file.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
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,80 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
let page | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
page = await browser.newPage() | ||
await page.goto('localhost:5173') | ||
}) | ||
|
||
test('Has main div', async () => { | ||
expect(await page.locator('#main-div').isVisible()).toBe(true) | ||
}) | ||
|
||
test('Has h1 title', async () => { | ||
expect(await page.locator('div#main-div > h1')).toHaveText('JSONAPI Vuex Test App') | ||
}) | ||
|
||
test('Has raw data div', async () => { | ||
expect(await page.locator('#raw_data').isVisible()).toBe(true) | ||
}) | ||
|
||
test('Has h2 raw title', async () => { | ||
expect(await page.locator('div#raw_data > h2')).toHaveText('Raw Data') | ||
}) | ||
|
||
test('Has render data div', async () => { | ||
expect(await page.locator('#render_data').isVisible()).toBe(true) | ||
}) | ||
|
||
test('Has h2 render title', async () => { | ||
expect(await page.locator('div#render_data > h2')).toHaveText('Rendered Data') | ||
}) | ||
|
||
test('Has initial API data', async () => { | ||
expect(await page.locator('#span_name_1')).toHaveText('sprocket') | ||
expect(await page.locator('#span_color_1')).toHaveText('black') | ||
}) | ||
|
||
test('Has related objects', async () => { | ||
expect(await page.locator('#rel_span_relname')).toHaveText('widgets') | ||
expect(await page.locator('#rel_span_name')).toHaveText('gear') | ||
expect(await page.locator('#rel_span_color')).toHaveText('blue') | ||
}) | ||
|
||
test('Has initial API search data', async () => { | ||
expect(await page.locator('#search_name_1')).toHaveText('sprocket') | ||
expect(await page.locator('#search_color_1')).toHaveText('black') | ||
}) | ||
|
||
test('Inputs exist and have correct values ', async () => { | ||
expect(await page.locator('#patch').isVisible()).toBe(true) | ||
expect(await page.locator('#patch_name')).toHaveValue('sprocket') | ||
expect(await page.locator('#patch_color')).toHaveValue('black') | ||
}) | ||
|
||
test('Patch values', async () => { | ||
expect(await page.locator('#patch_name').fill('cog')) | ||
expect(await page.locator('#patch_color').fill('red')) | ||
await page.getByRole('button', { name: 'Patch' }).click() | ||
await page.waitForTimeout(1000) | ||
expect(await page.locator('#span_name_1')).toHaveText('cog') | ||
expect(await page.locator('#span_color_1')).toHaveText('red') | ||
}) | ||
|
||
test('Post new item', async () => { | ||
expect(await page.locator('#post_name').fill('wheel')) | ||
expect(await page.locator('#post_color').fill('green')) | ||
await page.getByRole('button', { name: 'Post' }).click() | ||
await page.waitForTimeout(1000) | ||
expect(await page.locator('#span_name_4')).toHaveText('wheel') | ||
expect(await page.locator('#span_color_4')).toHaveText('green') | ||
}) | ||
|
||
test('Delete an item', async () => { | ||
expect(await page.locator('#span_name_1').isVisible()).toBe(true) | ||
expect(await page.locator('#delete_id').fill('1')) | ||
await page.getByRole('button', { name: 'Delete' }).click() | ||
await page.waitForTimeout(1000) | ||
expect(await page.locator('#span_name_1').isVisible()).toBe(false) | ||
}) |
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
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
Oops, something went wrong.