Switch to Nightwatch.js for browser tests
This replaces CasperJS due to various reasons:
1. Neither PhantomJS nor SlimerJS are supported.
2. https://github.com/ariya/phantomjs/issues/13450
1 files modified
1 files deleted
2 files added
| | |
| | | - 7.0 |
| | | - nightly |
| | | |
| | | addons: |
| | | firefox: latest |
| | | chrome: stable |
| | | |
| | | before_script: |
| | | - 'php -S 127.0.0.1:8080 &' |
| | | - 'nvm install stable' |
| | | - 'npm install casperjs' |
| | | - 'npm install nightwatch selenium-server chromedriver geckodriver' |
| | | |
| | | script: |
| | | - 'node_modules/casperjs/bin/casperjs test tests.js' |
| | | - 'node_modules/.bin/nightwatch -e chrome-headless' |
| | | - 'node_modules/.bin/nightwatch -e firefox-headless' |
New file |
| | |
| | | var seleniumServer = require('selenium-server'); |
| | | var chromedriver = require('chromedriver'); |
| | | var geckodriver = require('geckodriver'); |
| | | |
| | | module.exports = { |
| | | src_folders: ['tests'], |
| | | selenium: { |
| | | start_process: true, |
| | | server_path: seleniumServer.path, |
| | | port: 4444, |
| | | cli_args: { |
| | | 'webdriver.chrome.driver': chromedriver.path, |
| | | 'webdriver.gecko.driver': geckodriver.path, |
| | | }, |
| | | }, |
| | | test_settings: { |
| | | 'chrome': { |
| | | desiredCapabilities: { |
| | | browserName: 'chrome', |
| | | }, |
| | | }, |
| | | 'chrome-headless': { |
| | | desiredCapabilities: { |
| | | browserName: 'chrome', |
| | | chromeOptions: { |
| | | args: [ |
| | | '--headless', |
| | | '--no-sandbox', |
| | | '--disable-gpu', |
| | | ], |
| | | }, |
| | | }, |
| | | }, |
| | | 'firefox': { |
| | | desiredCapabilities: { |
| | | browserName: 'firefox', |
| | | }, |
| | | }, |
| | | 'firefox-headless': { |
| | | desiredCapabilities: { |
| | | browserName: 'firefox', |
| | | 'moz:firefoxOptions': { |
| | | args: [ |
| | | '--headless', |
| | | ], |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | | }; |
New file |
| | |
| | | module.exports = { |
| | | 'Stop name autocompletion': function(browser) { |
| | | browser.url('http://127.0.0.1:8080/'); |
| | | browser.getTitle(function(title) { |
| | | this.assert.ok(title.includes('TTSS')); |
| | | }); |
| | | |
| | | var autocomplete_pairs = [ |
| | | ['baga', 'Teatr Bagatela'], |
| | | ['d g', 'Dworzec Główny'], |
| | | ['świę', 'Plac Wszystkich Świętych'], |
| | | ['św g', 'Św. Gertrudy'], |
| | | ['św.g', 'Św. Gertrudy'], |
| | | ]; |
| | | autocomplete_pairs.forEach(function(value) { |
| | | browser.clearValue('#stop-name'); |
| | | browser.setValue('#stop-name', value[0]); |
| | | browser.pause(200); |
| | | browser.expect.element('#stop-name-autocomplete > option:first-child').to.be.present.before(1000); |
| | | browser.expect.element('#stop-name-autocomplete > option:first-child').text.to.include(value[1]).before(1000); |
| | | }); |
| | | }, |
| | | 'Translation engine': function(browser) { |
| | | browser.url('http://127.0.0.1:8080/#!en'); |
| | | browser.pause(200); |
| | | browser.getTitle(function(title) { |
| | | this.assert.ok(title.includes('departures')); |
| | | }); |
| | | browser.expect.element('[data-translate=header_line]').text.to.include('Line'); |
| | | }, |
| | | }; |