-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SX Design: test Storybook via Playwright
Just to make sure it still works after updating Storybook dependencies as it gets broken _very_ often.
- Loading branch information
1 parent
980bba3
commit a7f0946
Showing
9 changed files
with
94 additions
and
10 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
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,29 @@ | ||
// eslint-disable-next-line ft-flow/require-valid-file-annotation,import/no-extraneous-dependencies | ||
const { devices } = require('@playwright/test'); | ||
|
||
const config = { | ||
timeout: 60000, | ||
testDir: 'tests', | ||
testMatch: '**.play.js', | ||
forbidOnly: !!process.env.CI, | ||
reporter: process.env.CI ? 'github' : 'list', | ||
retries: process.env.CI ? 2 : 0, | ||
webServer: { | ||
command: 'yarn storybook --quiet', | ||
port: 6006, | ||
timeout: 120 * 1000, // milliseconds | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
use: { | ||
trace: 'on-first-retry', | ||
screenshot: 'only-on-failure', | ||
}, | ||
projects: [ | ||
{ | ||
name: 'Desktop Chrome', | ||
use: devices['Desktop Chrome'], | ||
}, | ||
], | ||
}; | ||
|
||
module.exports = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @flow strict | ||
|
||
/* eslint-disable no-unused-vars */ | ||
const OFF = 0; | ||
const WARN = 1; | ||
const ERROR = 2; | ||
/* eslint-enable no-unused-vars */ | ||
|
||
module.exports = { | ||
rules: { | ||
// Jest rules incompatible with Playwright: | ||
'jest/no-disabled-tests': OFF, | ||
'jest/no-standalone-expect': OFF, | ||
'jest/valid-title': OFF, | ||
}, | ||
}; |
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,3 @@ | ||
``` | ||
yarn workspace @adeira/sx-design playwright test | ||
``` |
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,8 @@ | ||
// eslint-disable-next-line ft-flow/require-valid-file-annotation,import/no-extraneous-dependencies | ||
const { test, expect } = require('@playwright/test'); | ||
|
||
test('that storybook works', async ({ page, baseURL }) => { | ||
// This is here just to make sure that our Storybook works as it gets broken very often. | ||
await page.goto(baseURL); | ||
await expect(page).toHaveTitle(/^Styleguide \/ Colors - Page ⋅ Storybook$/); | ||
}); |
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