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
CLICK ME
Fork
this repo & make sure you have been install nodejs.clone
repo from your account
$ git clone https://github.com/<YOUR_GITHUB_ACCOUNT>/test-app.git
- Then run these script to setup website. 👇
# move to test-app dir
$ cd test-app
# install dependency
$ npm install
# launch website
$ npm start
- Sign in Travis CI with github account
- Open
test-app
fromRepositories
- Set environment variables on Travis CI
- CODECOV_TOKEN: Use for coverage badge
- Signin Codecov
- Accept Codecov access github account
- Select test-app repo
- Get
CODECOV_TOKEN
- EYES_KEY: Use for visual test - Signin Applitools
- Get
EYES_KEY
- GH_REF, GH_TOKEN: Use for deploy github page,GH_REF
isgit.luolix.top/<YOUR_GITHUB_ACCOUNT>/test-app.git
- Go to Personal access tokens page
- Create
GH_TOKEN
can access repo - Get
GH_TOKEN
- SAUCE_ACCESS_KEY, SAUCE_USERNAME: Use for functional test on Saucelabs - Signin Sauce Labs
- Go to User Settings page
- Get
SAUCE_ACCESS_KEY
&SAUCE_USERNAME
- All environment variables
Push
a commit to master branch, it will trigger Travis CI to build you CI!
CLICK ME
$ npm run lint
CLICK ME
Test all unit test
$ npm run test
Test single unit test
$ npm run test::single <path/to/test/file>
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
Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs