Skip to content

Commit

Permalink
add e2e test for wink
Browse files Browse the repository at this point in the history
  • Loading branch information
Kachulio1 committed Dec 18, 2018
1 parent 6fedf87 commit 65a1fc9
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
12 changes: 11 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
{
"presets": ["react", "env"]
"presets": [
"react",
[
"env",
{
"targets": {
"browsers": ["last 2 Chrome versions"]
}
}
]
]
}
11 changes: 10 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
working_directory: ~/booksByPovic
docker:
- image: circleci/node:8
- image: circleci/node:latest-browsers
steps:
- checkout
- restore_cache:
Expand All @@ -15,6 +15,15 @@ jobs:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# start the server for e2e tests
- run:
name: Start Server
command: yarn start
background: true
- run:
name: waiting for node server to start
command: wget --retry-connrefused --waitretry=2 -t 10 "http://localhost:8080"

- run: yarn test
- run:
name: Collect test coverage
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "kachulio1 <[email protected]>",
"license": "MIT",
"scripts": {
"start": "webpack-dev-server --mode development --open",
"start": "webpack-dev-server --mode development",
"build": "webpack --mode production",
"test": "jest",
"coveralls": "cat ./coverage/lcov.info | coveralls"
Expand All @@ -34,6 +34,6 @@
"react-dom": "^16.6.3"
},
"engines": {
"node": "8"
"node": "11.4.0"
}
}
21 changes: 21 additions & 0 deletions src/tests/e2e/wink.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import puppeteer from "puppeteer";

const baseURL = "http://127.0.0.1:8080";
let browser;
let page;

beforeAll(async () => {
browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
page = await browser.newPage();
});

describe("Wink", () => {
test("find a wink emoji on / route", async (done) => {
expect(true).toBe(true)
done()
});
});

afterAll(() => {
browser.close();
});
2 changes: 1 addition & 1 deletion src/tests/wink.spec.js → src/tests/wink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Wink} from '../Wink';


describe('Wink', () => {
it('should wink', () => {
it('should render a wink emoji', () => {
const component = shallow(<Wink/>)
expect(component.find('span').text()).toBe("😉")
})
Expand Down

0 comments on commit 65a1fc9

Please sign in to comment.