aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTim Lucas <t@toolmantim.com>2019-02-06 10:56:07 +1100
committerGitHub <noreply@github.com>2019-02-06 10:56:07 +1100
commit3a4b164295f12e232ec73ab052f2928c6a8b539c (patch)
tree0848b16dae1c9568b776a1b6c70e627516586ab5
parent7cb15ebab7dfb621245a6cef2344f30cdf107036 (diff)
downloaddocker-puppeteer-3a4b164295f12e232ec73ab052f2928c6a8b539c.tar.gz
docker-puppeteer-3a4b164295f12e232ec73ab052f2928c6a8b539c.tar.zst
docker-puppeteer-3a4b164295f12e232ec73ab052f2928c6a8b539c.zip
Add more example files
-rw-r--r--example/Dockerfile.integration-tests3
-rw-r--r--example/integration-tests/index.test.js41
2 files changed, 44 insertions, 0 deletions
diff --git a/example/Dockerfile.integration-tests b/example/Dockerfile.integration-tests
new file mode 100644
index 0000000..41de685
--- /dev/null
+++ b/example/Dockerfile.integration-tests
@@ -0,0 +1,3 @@
1FROM buildkite/puppeteer:latest
2RUN npm i mocha
3ENV PATH="${PATH}:/node_modules/.bin" \ No newline at end of file
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 @@
1const assert = require('assert')
2const puppeteer = require('puppeteer')
3
4let browser
5let page
6
7before(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
23beforeEach(async() => {
24 page = await browser.newPage()
25})
26
27afterEach(async() => {
28 await page.close()
29})
30
31after(async() => {
32 await browser.close()
33})
34
35describe('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