diff --git a/.travis.yml b/.travis.yml index 37860ecb..c2ad3ed9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ sudo: required language: node_js +addons: + chrome: stable + node_js: - '8' @@ -11,6 +14,9 @@ before_install: - export LC_ALL=C - curl https://install.meteor.com | /bin/sh - export PATH="$HOME/.meteor:$PATH" + - npm install selenium-standalone@latest -g + - selenium-standalone install + - selenium-standalone start & cache: directories: @@ -19,6 +25,10 @@ cache: before_script: - meteor npm install + - meteor npm install --unsafe wdio-mocha-framework webdriverio assert + - meteor --production & + - sleep 300 # wait for Meteor to start, it takes some time, 5 minutes should be sufficient script: - - meteor test --driver-package=meteortesting:mocha --once \ No newline at end of file + - ./node_modules/.bin/wdio wdio.conf.js + - meteor test --driver-package=meteortesting:mocha --once --port 5000 \ No newline at end of file diff --git a/imports/ui/pages/returnedCurrencies/homepage.ui-test.js b/imports/ui/pages/returnedCurrencies/homepage.ui-test.js new file mode 100644 index 00000000..e23fa71f --- /dev/null +++ b/imports/ui/pages/returnedCurrencies/homepage.ui-test.js @@ -0,0 +1,13 @@ +const assert = require('assert') + +const baseUrl = 'http://localhost:3000' // baseUrl of the app we are testing, it's localhost here, as we're starting a local server in Travis CI cycle + +// see the full webdriverio browser API here: http://webdriver.io/api.html +describe('Home page', function () { + it('Currencies should render properly', function () { + browser.url(`${baseUrl}/`) // navigate to the home route `/` + browser.pause(2000) // let it load, wait for 2 seconds + assert(browser.isExisting('.currency-card'), true) // check if at least one currency card has rendered, isExisting === $() !== undefined + assert(browser.isVisible('.currency-card'), true) // check if at least one currency card is visible on the page isVisible === $().is(':visible') + }) +}) diff --git a/package-lock.json b/package-lock.json index c0fc7c50..5f97ac66 100644 --- a/package-lock.json +++ b/package-lock.json @@ -129,6 +129,11 @@ "hoek": "4.2.0" } }, + "bootstrap-slider": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/bootstrap-slider/-/bootstrap-slider-10.0.0.tgz", + "integrity": "sha1-1O3ToQrwMZfQION5LTLqbTfLOyg=" + }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", diff --git a/wdio.conf.js b/wdio.conf.js new file mode 100644 index 00000000..9c653444 --- /dev/null +++ b/wdio.conf.js @@ -0,0 +1,27 @@ +exports.config = { + specs: ['./imports/**/*.ui-test.js'], + exclude: [], + maxInstances: 10, + capabilities: [{ + browserName: 'chrome', + chromeOptions: { + args: ['--headless', '--disable-gpu', '--window-size=1280,800'], + binary: '/usr/bin/google-chrome-stable' + } + }], + sync: true, + logLevel: 'silent', + coloredLogs: true, + deprecationWarnings: true, + bail: 0, + screenshotPath: './screens/', + baseUrl: 'http://localhost:3000', + waitforTimeout: 10000, + connectionRetryTimeout: 90000, + connectionRetryCount: 3, + framework: 'mocha', + reporters: ['dot'], + mochaOpts: { + ui: 'bdd' + } +}