diff --git a/.babelrc b/.babelrc index 23744b7..9d28631 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,13 @@ { - "presets": ["react", "env"] + "presets": [ + "react", + [ + "env", + { + "targets": { + "browsers": ["last 2 Chrome versions"] + } + } + ] + ] } diff --git a/.circleci/config.yml b/.circleci/config.yml index 377594f..c782523 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ jobs: build: working_directory: ~/booksByPovic docker: - - image: circleci/node:8 + - image: circleci/node:latest-browsers steps: - checkout - restore_cache: @@ -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 diff --git a/package.json b/package.json index d6194fd..e9ca190 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "author": "kachulio1 ", "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" @@ -34,6 +34,6 @@ "react-dom": "^16.6.3" }, "engines": { - "node": "8" + "node": "11.4.0" } } diff --git a/src/tests/e2e/wink.spec.js b/src/tests/e2e/wink.spec.js new file mode 100644 index 0000000..c8ec377 --- /dev/null +++ b/src/tests/e2e/wink.spec.js @@ -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(); +}); diff --git a/src/tests/wink.spec.js b/src/tests/wink.test.js similarity index 83% rename from src/tests/wink.spec.js rename to src/tests/wink.test.js index 3a33155..c700284 100644 --- a/src/tests/wink.spec.js +++ b/src/tests/wink.test.js @@ -5,7 +5,7 @@ import {Wink} from '../Wink'; describe('Wink', () => { - it('should wink', () => { + it('should render a wink emoji', () => { const component = shallow() expect(component.find('span').text()).toBe("😉") })