Skip to content

sky172839465/test-app

Repository files navigation

test app

Build Status Saucelabs Ststus Coverage Status JavaScript Style Guide

This repo has been wrote some test for front end developer easily to learn how to test and test with CI/CD.

👉👉👉 You can get full tutorial about how to start this project from zero on medium.

  • Lint test
  • Unit test
  • Functional test
  • Visual test
  • Run test on TravisCI

Quick Start

CLICK ME
  1. Fork this repo & make sure you have been install nodejs.
  2. clone repo from your account
$ git clone https://github.com/<YOUR_GITHUB_ACCOUNT>/test-app.git
  1. Then run these script to setup website. 👇
# move to test-app dir
$ cd test-app

# install dependency
$ npm install

# launch website
$ npm start
  1. Sign in Travis CI with github account
  2. Open test-app from Repositories Launch Travis CI
  3. Set environment variables on Travis CI - CODECOV_TOKEN: Use for coverage badge
    1. Signin Codecov SignIn Codecov
    2. Accept Codecov access github account Accept Codecov
    3. Select test-app repo Select Repo
    4. Get CODECOV_TOKEN Get Token - EYES_KEY: Use for visual test
    5. Signin Applitools Accept Eyes
    6. Get EYES_KEY Get Eyes Token - GH_REF, GH_TOKEN: Use for deploy github page, GH_REF is github.com/<YOUR_GITHUB_ACCOUNT>/test-app.git
    7. Go to Personal access tokens page Generator Github Token
    8. Create GH_TOKEN can access repo Create Github Token
    9. Get GH_TOKEN Get Github Token - SAUCE_ACCESS_KEY, SAUCE_USERNAME: Use for functional test on Saucelabs
    10. Signin Sauce Labs Accept Sauce Labs
    11. Go to User Settings page Get Sauce Labs
    12. Get SAUCE_ACCESS_KEY & SAUCE_USERNAME - All environment variables Env Variables
  4. Push a commit to master branch, it will trigger Travis CI to build you CI! Build Start Build Passed

Table of Contents

Lint test

CLICK ME
$ npm run lint

Unit test

CLICK ME

Test all unit test

$ npm run test

Test single unit test

$ npm run test::single <path/to/test/file>

Functional test

CLICK ME

👉 [Issue]: No Java runtime present 👈 Please follow the link install Java.

Test functional test local

👉 Before start the script, make sure website has been launch on https://localhost:3000 or run npm start first

👉 First time run this script, please run npm run install:selenium install selenium dependency first.

$ npm run functional::local

Test functional test on saucelabs with localhost

👉 Before start the script, make sure you have been download sauce connect, and extract sc file to bin/sc

$ npm run start::sauce_connect
# wait for visible `Sauce Connect is up, you may start your tests.`
$ npm run functional::online:localhost

Test all functional test on saucelabs

$ npm run functional::online

Test all functional test on saucelabs with multiple platform

$ npm run functional::online:multiple

Compatibility

Saucelab Compatibility

Big Thanks

Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs

Sauce Logo