-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD integration test: automatic screenshot of cra-kitchen-sink and vu…
…e-kitchen-sink examples
- Loading branch information
Showing
11 changed files
with
389 additions
and
269 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 |
---|---|---|
|
@@ -18,3 +18,4 @@ packs/*.tgz | |
package-lock.json | ||
.nvmrc | ||
storybook-static | ||
integration/__image_snapshots__/__diff_output__ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,44 @@ | ||
import puppeteer from 'puppeteer'; | ||
|
||
const examples = [ | ||
{ | ||
name: 'cra-kitchen-sink', | ||
port: 9010, | ||
}, | ||
{ | ||
name: 'vue-kitchen-sink', | ||
port: 9009, | ||
}, | ||
]; | ||
|
||
examples.forEach(({ name, port }) => { | ||
let browser = puppeteer.launch(); | ||
|
||
describe('sandboxes', () => { | ||
afterAll(() => { | ||
browser.close(); | ||
}); | ||
|
||
it.concurrent( | ||
`Take screenshots for '${name}'`, | ||
async () => { | ||
browser = await browser; | ||
const page = await browser.newPage(); | ||
await page.setViewport({ width: 1400, height: 1000 }); | ||
await page.goto(`http://localhost:${port}`); | ||
await page.waitForSelector('[role="menuitem"][data-name="Welcome"]'); | ||
await page.waitFor(2000); | ||
|
||
const screenshot = await page.screenshot({ fullPage: true }); | ||
|
||
expect(screenshot).toMatchImageSnapshot({ | ||
customDiffConfig: { | ||
threshold: 0.03, // 3% threshold | ||
}, | ||
customSnapshotIdentifier: name.split('/').join('-'), | ||
}); | ||
}, | ||
1000 * 60 * 10 // 10 minutes for all tests in total | ||
); | ||
}); | ||
}); |
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,4 @@ | ||
module.exports = { | ||
rootDir: './', | ||
setupTestFrameworkScriptFile: '<rootDir>/jest.setup.js', | ||
}; |
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,4 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { toMatchImageSnapshot } from 'jest-image-snapshot'; | ||
|
||
expect.extend({ toMatchImageSnapshot }); |
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,9 @@ | ||
#!/bin/bash | ||
# Workaround for https://github.com/GoogleChrome/puppeteer/issues/290 | ||
|
||
sudo apt-get update | ||
sudo apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \ | ||
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ | ||
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \ | ||
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \ | ||
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget |
Oops, something went wrong.