diff options
author | Tim Lucas <t@toolmantim.com> | 2019-02-06 11:31:56 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-06 11:31:56 +1100 |
commit | 4e7c52141ab2170730089e93fb732aa1baba1b2f (patch) | |
tree | 4203de845f246013e763db95da3f0ea1fd4f1410 /example/integration-tests/index.test.js | |
parent | f2ea4b9e74b9a8110490ede83d195565f57c004d (diff) | |
parent | 9f994586f630ebc675710563f30fcf1c5bcfcf48 (diff) | |
download | docker-puppeteer-4e7c52141ab2170730089e93fb732aa1baba1b2f.tar.gz docker-puppeteer-4e7c52141ab2170730089e93fb732aa1baba1b2f.tar.zst docker-puppeteer-4e7c52141ab2170730089e93fb732aa1baba1b2f.zip |
Merge pull request #56 from buildkite/add-example
Move example into it's own folder
Diffstat (limited to 'example/integration-tests/index.test.js')
-rw-r--r-- | example/integration-tests/index.test.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/example/integration-tests/index.test.js b/example/integration-tests/index.test.js new file mode 100644 index 0000000..dd39d8a --- /dev/null +++ b/example/integration-tests/index.test.js | |||
@@ -0,0 +1,41 @@ | |||
1 | const assert = require('assert') | ||
2 | const puppeteer = require('puppeteer') | ||
3 | |||
4 | let browser | ||
5 | let page | ||
6 | |||
7 | before(async() => { | ||
8 | browser = await puppeteer.launch({ | ||
9 | args: [ | ||
10 | // Required for Docker version of Puppeteer | ||
11 | '--no-sandbox', | ||
12 | '--disable-setuid-sandbox', | ||
13 | // This will write shared memory files into /tmp instead of /dev/shm, | ||
14 | // because Docker’s default for /dev/shm is 64MB | ||
15 | '--disable-dev-shm-usage' | ||
16 | ] | ||
17 | }) | ||
18 | |||
19 | const browserVersion = await browser.version() | ||
20 | console.log(`Started ${browserVersion}`) | ||
21 | }) | ||
22 | |||
23 | beforeEach(async() => { | ||
24 | page = await browser.newPage() | ||
25 | }) | ||
26 | |||
27 | afterEach(async() => { | ||
28 | await page.close() | ||
29 | }) | ||
30 | |||
31 | after(async() => { | ||
32 | await browser.close() | ||
33 | }) | ||
34 | |||
35 | describe('App', () => { | ||
36 | it('renders', async() => { | ||
37 | const response = await page.goto('http://app/') | ||
38 | assert(response.ok()) | ||
39 | await page.screenshot({ path: `/screenshots/app.png` }) | ||
40 | }) | ||
41 | }) \ No newline at end of file | ||