Bläddra i källkod

add circleci support

陈帅 7 år sedan
förälder
incheckning
ade5cbba31
3 ändrade filer med 37 tillägg och 0 borttagningar
  1. 23 0
      .circleci/config.yml
  2. 6 0
      src/e2e/login.e2e.js
  3. 8 0
      tests/fix_puppeteer.sh

+ 23 - 0
.circleci/config.yml

@@ -0,0 +1,23 @@
+version: 2
+jobs:
+  build:
+    docker:
+      - image: circleci/node:8.11.2
+    steps:
+      - checkout
+      - run: npm install
+      - run: npm run build
+  test:
+    docker:
+      - image: circleci/node:8.11.2
+    steps:
+      - checkout
+      - run: sh ./tests/fix_puppeteer.sh
+      - run: npm install
+      - run: npm run test:all
+workflows:
+  version: 2
+  build_and_test:
+    jobs:
+      - build
+      - test

+ 6 - 0
src/e2e/login.e2e.js

@@ -17,6 +17,9 @@ describe('Login', () => {
   afterEach(() => page.close());
 
   it('should login with failure', async () => {
+    await page.waitForSelector('#userName', {
+      timeout: 2000,
+    });
     await page.type('#userName', 'mockuser');
     await page.type('#password', 'wrong_password');
     await page.click('button[type="submit"]');
@@ -24,6 +27,9 @@ describe('Login', () => {
   });
 
   it('should login successfully', async () => {
+    await page.waitForSelector('#userName', {
+      timeout: 2000,
+    });
     await page.type('#userName', 'admin');
     await page.type('#password', '888888');
     await page.click('button[type="submit"]');

+ 8 - 0
tests/fix_puppeteer.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+apt-get update
+apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
+  libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
+  libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
+  libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
+  ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget