UI functional test runner improvements

- Made selenium version controllable via env variable
- Made browser controllable via env variable
- Updated default Chrome driver version
- Increased some timeouts
- Made some check more bulletproof

Change-Id: I11cd0c8b32d0b22d6cd08b476b33e248217e8b7c
This commit is contained in:
Vitaly Kramskikh 2015-12-16 13:37:38 +03:00
parent 3525483860
commit d08d89c0ba
8 changed files with 42 additions and 20 deletions

View File

@ -176,6 +176,11 @@ Setup for Web UI Tests
cd fuel-web
./run_tests.sh --webui
By default Firefox browser is used. You can specify the browser using
BROWSER environment variable::
BROWSER=chrome ./run_tests.sh --webui
.. _running-parallel-tests-py:

View File

@ -42,7 +42,6 @@ gulp.task('i18n:validate', function() {
validateTranslations(tranlations, locales);
});
var selenium = require('selenium-standalone');
var seleniumProcess = null;
function shutdownSelenium() {
if (seleniumProcess) {
@ -51,15 +50,27 @@ function shutdownSelenium() {
}
}
var SELENIUM_VERSION = '2.45.0';
var SELENIUM_DRIVERS = {chrome: {version: '2.20'}};
gulp.task('selenium:fetch', function(cb) {
var defaultVersion = '2.45.0';
selenium.install({version: argv.version || defaultVersion}, cb);
var selenium = require('selenium-standalone');
selenium.install({
version: process.env.SELENIUM_VERSION || SELENIUM_VERSION,
dirvers: SELENIUM_DRIVERS
}, cb);
});
gulp.task('selenium', ['selenium:fetch'], function(cb) {
var selenium = require('selenium-standalone');
var port = process.env.SELENIUM_SERVER_PORT || 4444;
selenium.start(
{seleniumArgs: ['--port', port], spawnOptions: {stdio: 'pipe'}},
{
version: process.env.SELENIUM_VERSION || SELENIUM_VERSION,
dirvers: SELENIUM_DRIVERS,
seleniumArgs: ['--port', port],
spawnOptions: {stdio: 'pipe'}
},
function(err, child) {
if (err) throw err;
child.on('exit', function() {
@ -80,7 +91,7 @@ gulp.task('karma', function(cb) {
var Server = require('karma').Server;
new Server({
configFile: __dirname + '/karma.config.js',
browsers: [argv.browser || 'firefox']
browsers: [argv.browser || process.env.BROWSER || 'firefox']
}, cb).start();
});
@ -88,7 +99,7 @@ function runIntern(params) {
return function() {
var baseDir = 'static';
var runner = './node_modules/.bin/intern-runner';
var browser = params.browser || argv.browser || 'firefox';
var browser = argv.browser || process.env.BROWSER || 'firefox';
var options = [['config', 'tests/intern-' + browser + '.js']];
var suiteOptions = [];
['suites', 'functionalSuites'].forEach(function(suiteType) {

View File

@ -34,7 +34,7 @@ define([
.clickLinkByText(tabName)
.end()
.then(pollUntil(function(textToFind) {
return $('.cluster-tab.active').text() == textToFind ? true : null; // eslint-disable-line no-undef
return window.$('.cluster-tab.active').text() == textToFind || null;
}, [tabName], 3000));
},
removeCluster: function(clusterName) {
@ -135,7 +135,7 @@ define([
.then(function() {
return self.modal.waitToClose();
})
.waitForElementDeletion('div.progress-bar', 10000);
.waitForElementDeletion('div.progress-bar', 20000);
},
isTabLocked: function(tabName) {
var self = this;

View File

@ -110,9 +110,9 @@ define([
.then(function() {
return self.clusterPage.goToTab('Nodes');
})
.waitForCssSelector('button.btn-add-nodes', 1000)
.waitForCssSelector('button.btn-add-nodes', 3000)
.clickByCssSelector('button.btn-add-nodes')
.waitForCssSelector('.node', 2000)
.waitForCssSelector('.node', 3000)
.then(function() {
if (nodeNameFilter) return self.clusterPage.searchForNode(nodeNameFilter);
})
@ -123,7 +123,7 @@ define([
return self.clusterPage.checkNodes(nodesAmount, nodeStatus);
})
.clickByCssSelector('.btn-apply')
.waitForElementDeletion('.btn-apply', 2000);
.waitForElementDeletion('.btn-apply', 3000);
}
};
return CommonMethods;

View File

@ -31,6 +31,7 @@ define([
var self = this;
return this.remote
.setFindTimeout(500)
.setWindowSize(1280, 1024)
.getCurrentUrl()
.then(function(url) {

View File

@ -15,8 +15,9 @@
**/
define([
'intern/dojo/node!leadfoot/helpers/pollUntil',
'../../helpers'
], function() {
], function(pollUntil) {
'use strict';
function ModalWindow(remote) {
this.remote = remote;
@ -24,25 +25,29 @@ define([
ModalWindow.prototype = {
constructor: ModalWindow,
modalSelector: '#modal-container > .modal',
waitToOpen: function() {
return this.remote
.waitForCssSelector('div.modal-content', 2000);
.waitForCssSelector(this.modalSelector, 2000)
.then(pollUntil(function(modalSelector) {
return window.$(modalSelector).css('opacity') == 1 || null;
}, [this.modalSelector], 3000));
},
checkTitle: function(expectedTitle) {
return this.remote
.assertElementContainsText('h4.modal-title', expectedTitle, 'Unexpected modal window title');
.assertElementContainsText(this.modalSelector + ' h4.modal-title', expectedTitle, 'Unexpected modal window title');
},
close: function() {
var self = this;
return this.remote
.clickByCssSelector('.modal-header button.close')
.clickByCssSelector(this.modalSelector + ' .modal-header button.close')
.then(function() {
return self.waitToClose();
});
},
clickFooterButton: function(buttonText) {
return this.remote
.findAllByCssSelector('.modal-footer button')
.findAllByCssSelector(this.modalSelector + ' .modal-footer button')
.then(function(buttons) {
return buttons.reduce(function(result, button) {
return button.getVisibleText()
@ -62,7 +67,7 @@ define([
},
waitToClose: function() {
return this.remote
.waitForElementDeletion('div.modal-content', 5000);
.waitForElementDeletion(this.modalSelector, 5000);
}
};
return ModalWindow;

View File

@ -232,7 +232,7 @@ define([
.then(function() {
return dashboardPage.startDeployment();
})
.assertElementDisappears('.dashboard-block .progress', 10000, 'Progress bar disappears after deployment')
.assertElementDisappears('.dashboard-block .progress', 60000, 'Progress bar disappears after deployment')
.assertElementAppears('.dashboard-tab .alert strong', 1000, 'Error message is shown when adding error node')
.assertElementTextEquals('.dashboard-tab .alert strong', 'Error',
'Deployment failed in case of adding offline nodes')

View File

@ -100,7 +100,7 @@ define([
.then(function() {
return dashboardPage.stopDeployment();
})
.assertElementDisappears('div.deploy-process div.progress', 5000, 'Deployment stopped')
.assertElementDisappears('div.deploy-process div.progress', 20000, 'Deployment stopped')
.assertElementAppears(dashboardPage.deployButtonSelector, 1000, 'Deployment button available')
.assertElementContainsText('div.alert-warning strong', 'Success', 'Deployment successfully stopped alert is expected')
.assertElementNotExists('.go-to-healthcheck', 'Healthcheck link is not visible after stopped deploy')
@ -134,7 +134,7 @@ define([
.then(function() {
return dashboardPage.startDeployment();
})
.assertElementDisappears('.dashboard-block .progress', 50000, 'Progress bar disappears after deployment')
.assertElementDisappears('.dashboard-block .progress', 60000, 'Progress bar disappears after deployment')
.assertElementAppears('.links-block', 5000, 'Deployment completed')
.assertElementExists('.go-to-healthcheck', 'Healthcheck link is visible after deploy')
.findByLinkText('Horizon')