New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Internal: Convert ghostjs to puppeteer #182
Changes from 11 commits
4a449b9
6e16bef
b8a0d3b
5569928
f153c66
e38c67c
48ab44c
8c8c5a7
3a5b1dc
6e6029c
35df4f4
697ed3b
bc67391
8af3345
73becab
f127924
794d6a1
b12b8d2
7bcd8ef
9c39a6a
b90fbd1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,20 +9,23 @@ ENV DISPLAY :99 | |
COPY test/xvfb_init /etc/init.d/xvfb | ||
COPY test/xvfb_daemon_run /usr/bin/xvfb-daemon-run | ||
|
||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | ||
echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ | ||
apt-get update -yy -qq && \ | ||
apt-get install yarn -yy -qq && \ | ||
apt-get install xvfb firefox-esr -yy -qq && \ | ||
chmod a+x /etc/init.d/xvfb /usr/bin/xvfb-daemon-run | ||
|
||
COPY yarn.lock package.json ./ | ||
|
||
RUN mkdir -p docs test packages/gestalt | ||
COPY packages/gestalt/package.json ./packages/gestalt/ | ||
COPY docs/package.json ./docs/ | ||
COPY test/package.json ./test/ | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -yq libgconf-2-4 \ | ||
&& apt-get install -y wget --no-install-recommends \ | ||
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | ||
&& apt-get update \ | ||
&& apt-get install -y google-chrome-unstable --no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& npm i puppeteer@1.4.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a dependency of the tests - any reason why you're doing this here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chrislloyd was a trail / error of combining multiple docker commands. Was able to get rid of it. |
||
|
||
RUN yarn install --pure-lockfile --ignore-scripts | ||
|
||
COPY . ./ |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* global page */ | ||
import assert from 'assert'; | ||
|
||
describe('Icon > a11y', () => { | ||
beforeAll(async () => { | ||
await page.addScriptTag({ path: require.resolve('axe-core') }); | ||
}); | ||
it('Loads at least 5 icons on the test page', async () => { | ||
await page.goto('http://localhost:3001/A11y?component=icon'); | ||
|
||
const svgIcons = await page.$$('svg'); | ||
assert.ok(svgIcons.length >= 5); | ||
}); | ||
|
||
it('Does not have any a11y issues', async () => { | ||
await page.addScriptTag({ path: require.resolve('axe-core') }); | ||
const results = await page.evaluate( | ||
() => | ||
new Promise(resolve => { | ||
window.axe.run((err, axeResults) => { | ||
if (err) throw err; | ||
resolve(axeResults); | ||
}); | ||
}) | ||
); | ||
|
||
const beautifyErrors = ` | ||
A11Y Violations: | ||
${JSON.stringify(results.violations, null, 4)}`; | ||
assert(results.violations.length === 0, beautifyErrors); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"globals": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @christianvuerings i think this can be avoided, its baked into eslint now, you just need to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch - I'll do this in a follow up PR. I'd like to get this merged ASAP. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chrislloyd @christianvuerings check out #193 which updates based on the instructions here |
||
"afterAll": false, | ||
"beforeAll": false, | ||
"browser": false, | ||
"describe": false, | ||
"jest": false, | ||
"it": false, | ||
"page": false | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import assert from 'assert'; | ||
import selectors from './lib/selectors'; | ||
|
||
describe('Masonry > handle item updates', () => { | ||
it('should correctly update grid item heights', async () => { | ||
await page.setViewport({ | ||
width: 800, | ||
height: 800, | ||
}); | ||
await page.goto('http://localhost:3001/Masonry?virtualize=1'); | ||
|
||
// get initial size of first element | ||
const gridItems = await page.$$(selectors.gridItem); | ||
const itemRectBefore = await gridItems[0].boundingBox(); | ||
|
||
// trigger item expand | ||
const pushTrigger = await page.$(selectors.expandGridItems); | ||
await pushTrigger.click(); | ||
|
||
const gridItemsAfter = await page.$$(selectors.gridItem); | ||
const itemRectAfter = await gridItemsAfter[0].boundingBox(); | ||
|
||
assert.ok( | ||
itemRectAfter.height > itemRectBefore.height, | ||
'item height should have increased' | ||
); | ||
|
||
// trigger item collapse | ||
await pushTrigger.click(); | ||
|
||
const gridItemsAfterAfter = await page.$$(selectors.gridItem); | ||
const itemRectAfterAfter = await gridItemsAfterAfter[0].boundingBox(); | ||
|
||
assert.ok( | ||
itemRectAfterAfter.height === itemRectBefore.height, | ||
'item height should have reverted to original' | ||
); | ||
}); | ||
}); |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import assert from 'assert'; | ||
import selectors from './lib/selectors'; | ||
|
||
describe('Masonry > handle offset update', () => { | ||
it('Should correctly account for relative position changes', async () => { | ||
let gridItems; | ||
let firstItemText; | ||
|
||
// First load the page with javascript disabled to get the item position | ||
await page.setViewport({ | ||
width: 800, | ||
height: 800, | ||
}); | ||
await page.goto('http://localhost:3001/Masonry?virtualize=1'); | ||
|
||
const pushTrigger = await page.$(selectors.pushGridDown); | ||
await pushTrigger.click(); | ||
|
||
await page.evaluate(() => window.scrollTo(0, 500)); | ||
gridItems = await page.$$(selectors.gridItem); | ||
firstItemText = (await gridItems[0].getProperty('innerText')).toString(); | ||
assert.ok(firstItemText.includes('foo 0')); | ||
|
||
await page.evaluate(() => window.scrollTo(0, 1000)); | ||
gridItems = await page.$$(selectors.gridItem); | ||
firstItemText = (await gridItems[0].getProperty('innerText')).toString(); | ||
assert.ok(firstItemText.includes('foo 0')); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want this
RUN
command to be high so it's not invalidated by changes to thepackage.json
etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrislloyd indeed - moved this one (and the other
RUN
command) back up.