Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,57 @@ jobs:
name: 'Run md linter'
command: yarn workspace docs lint-md

run-e2e-tests:
working_directory: ~/project
docker:
- image: qawolf/playwright-ci:v0.8.0
environment:
FFMPEG_PATH: /usr/bin/ffmpeg # for recording video
QAW_ARTIFACT_PATH: /tmp/artifacts # for uploading video
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: 'Register VuePress'
command: yarn register-vuepress
- run:
name: 'Install end-to-end test dependencies'
command: yarn
working_directory: ~/project/__e2e__
- run:
name: 'Create test project'
command: |
mkdir test_project
cd test_project
yarn init -y
yarn link vuepress
echo '# Hello VuePress' > README.md
- run:
name: 'Run VuePress'
command: vuepress dev
background: true
working_directory: ~/project/test_project
- run:
name: 'Test first page'
command: |
yarn run wait-on http://localhost:8080
npx qawolf test --all-browsers --headless initialSetup
working_directory: ~/project/__e2e__
- run:
name: 'Add another page'
command: |
mkdir get_started
echo '# Get Started' > get_started/README.md
echo '[Get Started](/get_started/)' >> README.md
working_directory: ~/project/test_project
- run:
name: 'Test additional page'
command: npx qawolf test --all-browsers --headless linkAndSearch
working_directory: ~/project/__e2e__
- store_artifacts:
path: /tmp/artifacts

#------------------------------------------------------------
# 3. Build VuePress
#------------------------------------------------------------
Expand Down Expand Up @@ -120,4 +171,5 @@ workflows:
- run-docs-linter-check: { requires: [install-dependencies] }
- run-tsc: { requires: [install-dependencies] }
- run-tests: { requires: [run-tsc] }
- build: { requires: [run-tests, run-linter-check, run-docs-linter-check] }
- run-e2e-tests: { requires: [run-tsc] }
- build: { requires: [run-tests, run-e2e-tests, run-linter-check, run-docs-linter-check] }
24 changes: 24 additions & 0 deletions __e2e__/initialSetup.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const qawolf = require('qawolf')

let browser
let page

/* eslint-env jest */
beforeAll(async () => {
browser = await qawolf.launch()
const context = await browser.newContext()
await qawolf.register(context)
page = await context.newPage()
})

afterAll(async () => {
await qawolf.stopVideos()
await browser.close()
})

test('initialSetup', async () => {
await page.goto('http://localhost:8080/')

// test will fail if the header never appears
await page.waitFor('h1#hello-vuepress')
})
31 changes: 31 additions & 0 deletions __e2e__/linkAndSearch.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const qawolf = require('qawolf')

let browser
let page

/* eslint-env jest */
beforeAll(async () => {
browser = await qawolf.launch()
const context = await browser.newContext()
await qawolf.register(context)
page = await context.newPage()
})

afterAll(async () => {
await qawolf.stopVideos()
await browser.close()
})

test('linkAndSearch', async () => {
await page.goto('http://localhost:8080/')
await page.click('text="Get Started"')

// test will fail if header never appears
await page.waitFor('h1#get-started')

await page.type('[aria-label="Search"]', 'hello')
await page.click('ul a[href="/"]')

// test will fail if header never appears
await page.waitFor('h1#hello-vuepress')
})
14 changes: 14 additions & 0 deletions __e2e__/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "e2e",
"version": "1.0.0",
"license": "MIT",
"main": "index.js",
"dependencies": {
"wait-on": "^4.0.1"
},
"devDependencies": {
"jest": "~25.1.0",
"playwright": "~0.12.1",
"qawolf": "~0.12.4"
}
}
6 changes: 6 additions & 0 deletions __e2e__/qawolf.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
config: '{}',
rootDir: '.',
testTimeout: 60000,
useTypeScript: false
}
Loading