Upgrades Intern to 3.0.6

This change updates Intern testing framework from 2.2.2
to 3.0.6 version and updates ScreenshotOnFailReporter
to use newer API.

Change-Id: I368cb18756c9d27a95c1b615d4473d8486ada184
This commit is contained in:
Nick Bogdanov 2015-08-14 16:48:40 +03:00 committed by Kate Pimenova
parent 4fdb188f58
commit a055f904fb
13 changed files with 205 additions and 120 deletions

View File

@ -4500,42 +4500,94 @@
} }
}, },
"intern": { "intern": {
"version": "2.2.2", "version": "3.0.6",
"from": "intern@2.2.2", "from": "intern@3.0.6",
"dependencies": { "dependencies": {
"istanbul": { "istanbul": {
"version": "0.2.16", "version": "0.3.17",
"from": "istanbul@0.2.16", "from": "istanbul@0.3.17",
"dependencies": { "dependencies": {
"esprima": { "esprima": {
"version": "1.2.5", "version": "2.4.1",
"from": "esprima@1.2.x" "from": "esprima@2.4.x"
}, },
"escodegen": { "escodegen": {
"version": "1.3.3", "version": "1.6.1",
"from": "escodegen@1.3.x", "from": "escodegen@1.6.x",
"dependencies": { "dependencies": {
"esutils": {
"version": "1.0.0",
"from": "esutils@~1.0.0"
},
"estraverse": { "estraverse": {
"version": "1.5.1", "version": "1.9.3",
"from": "estraverse@~1.5.0" "from": "estraverse@^1.9.1"
},
"esutils": {
"version": "1.1.6",
"from": "esutils@^1.1.6"
}, },
"esprima": { "esprima": {
"version": "1.1.1", "version": "1.2.5",
"from": "esprima@~1.1.1" "from": "esprima@^1.2.2"
},
"optionator": {
"version": "0.5.0",
"from": "optionator@^0.5.0",
"dependencies": {
"prelude-ls": {
"version": "1.1.2",
"from": "prelude-ls@~1.1.1"
},
"deep-is": {
"version": "0.1.3",
"from": "deep-is@~0.1.2"
},
"type-check": {
"version": "0.3.2",
"from": "type-check@~0.3.1"
},
"levn": {
"version": "0.2.5",
"from": "levn@~0.2.5"
},
"fast-levenshtein": {
"version": "1.0.7",
"from": "fast-levenshtein@~1.0.0"
}
}
},
"source-map": {
"version": "0.1.43",
"from": "source-map@~0.1.40",
"dependencies": {
"amdefine": {
"version": "1.0.0",
"from": "amdefine@>=0.0.4"
}
}
} }
} }
}, },
"handlebars": { "handlebars": {
"version": "1.3.0", "version": "3.0.0",
"from": "handlebars@1.3.x", "from": "handlebars@3.0.0",
"dependencies": { "dependencies": {
"optimist": { "optimist": {
"version": "0.3.7", "version": "0.6.1",
"from": "optimist@~0.3" "from": "optimist@^0.6.1",
"dependencies": {
"minimist": {
"version": "0.0.10",
"from": "minimist@~0.0.1"
}
}
},
"source-map": {
"version": "0.1.43",
"from": "source-map@^0.1.40",
"dependencies": {
"amdefine": {
"version": "1.0.0",
"from": "amdefine@>=0.0.4"
}
}
}, },
"uglify-js": { "uglify-js": {
"version": "2.3.6", "version": "2.3.6",
@ -4544,6 +4596,10 @@
"async": { "async": {
"version": "0.2.10", "version": "0.2.10",
"from": "async@~0.2.6" "from": "async@~0.2.6"
},
"optimist": {
"version": "0.3.7",
"from": "optimist@~0.3.5"
} }
} }
} }
@ -4560,46 +4616,28 @@
} }
}, },
"nopt": { "nopt": {
"version": "3.0.4", "version": "3.0.6",
"from": "nopt@3.x" "from": "nopt@3.x"
}, },
"fileset": { "fileset": {
"version": "0.1.8", "version": "0.2.1",
"from": "fileset@0.1.x", "from": "fileset@0.2.x",
"dependencies": { "dependencies": {
"minimatch": { "minimatch": {
"version": "0.4.0", "version": "2.0.10",
"from": "minimatch@0.x", "from": "minimatch@2.x",
"dependencies": { "dependencies": {
"lru-cache": { "brace-expansion": {
"version": "2.7.0", "version": "1.1.2",
"from": "lru-cache@2" "from": "brace-expansion@^1.0.0",
},
"sigmund": {
"version": "1.0.1",
"from": "sigmund@~1.0.0"
}
}
},
"glob": {
"version": "3.2.11",
"from": "glob@3.x",
"dependencies": { "dependencies": {
"inherits": { "balanced-match": {
"version": "2.0.1",
"from": "inherits@2"
},
"minimatch": {
"version": "0.3.0", "version": "0.3.0",
"from": "minimatch@0.3", "from": "balanced-match@^0.3.0"
"dependencies": {
"lru-cache": {
"version": "2.7.0",
"from": "lru-cache@2"
}, },
"sigmund": { "concat-map": {
"version": "1.0.1", "version": "0.0.1",
"from": "sigmund@~1.0.0" "from": "concat-map@0.0.1"
} }
} }
} }
@ -4612,8 +4650,12 @@
"from": "which@1.0.x" "from": "which@1.0.x"
}, },
"async": { "async": {
"version": "0.9.2", "version": "1.5.2",
"from": "async@0.9.x" "from": "async@1.x"
},
"supports-color": {
"version": "1.3.1",
"from": "supports-color@1.3.x"
}, },
"abbrev": { "abbrev": {
"version": "1.0.7", "version": "1.0.7",
@ -4624,15 +4666,15 @@
"from": "wordwrap@0.0.x" "from": "wordwrap@0.0.x"
}, },
"resolve": { "resolve": {
"version": "0.7.4", "version": "1.1.6",
"from": "resolve@0.7.x" "from": "resolve@1.1.x"
}, },
"js-yaml": { "js-yaml": {
"version": "3.4.3", "version": "3.4.6",
"from": "js-yaml@3.x", "from": "js-yaml@3.x",
"dependencies": { "dependencies": {
"argparse": { "argparse": {
"version": "1.0.2", "version": "1.0.3",
"from": "argparse@^1.0.2", "from": "argparse@^1.0.2",
"dependencies": { "dependencies": {
"sprintf-js": { "sprintf-js": {
@ -4642,8 +4684,22 @@
} }
}, },
"esprima": { "esprima": {
"version": "2.7.0", "version": "2.7.1",
"from": "esprima@^2.6.0" "from": "esprima@^2.6.0"
},
"inherit": {
"version": "2.2.2",
"from": "inherit@^2.2.2"
}
}
},
"once": {
"version": "1.3.3",
"from": "once@1.x",
"dependencies": {
"wrappy": {
"version": "1.0.1",
"from": "wrappy@1"
} }
} }
} }
@ -4660,48 +4716,53 @@
} }
}, },
"dojo": { "dojo": {
"version": "2.0.0-dev", "version": "2.0.0-alpha.6",
"from": "https://github.com/csnover/dojo2-core/archive/ebfa11ba3972944218623a4bd9d124cb8108d70c.tar.gz", "from": "dojo@2.0.0-alpha.6"
"resolved": "https://github.com/csnover/dojo2-core/archive/ebfa11ba3972944218623a4bd9d124cb8108d70c.tar.gz"
}, },
"chai": { "chai": {
"version": "1.9.1", "version": "3.0.0",
"from": "chai@1.9.1", "from": "chai@3.0.0",
"dependencies": { "dependencies": {
"assertion-error": { "assertion-error": {
"version": "1.0.0", "version": "1.0.1",
"from": "assertion-error@1.0.0" "from": "assertion-error@^1.0.1"
}, },
"deep-eql": { "deep-eql": {
"version": "0.1.3", "version": "0.1.3",
"from": "deep-eql@0.1.3", "from": "deep-eql@^0.1.3",
"dependencies": { "dependencies": {
"type-detect": { "type-detect": {
"version": "0.1.1", "version": "0.1.1",
"from": "type-detect@0.1.1" "from": "type-detect@0.1.1"
} }
} }
},
"type-detect": {
"version": "1.0.0",
"from": "type-detect@^1.0.0"
} }
} }
}, },
"leadfoot": { "leadfoot": {
"version": "1.2.1", "version": "1.6.4",
"from": "leadfoot@1.2.1", "from": "leadfoot@1.6.4",
"dependencies": { "dependencies": {
"dojo": { "jszip": {
"version": "2.0.0-alpha4", "version": "2.5.0",
"from": "dojo@2.0.0-alpha4" "from": "jszip@2.5.0",
"dependencies": {
"pako": {
"version": "0.2.8",
"from": "pako@~0.2.5"
}
}
} }
} }
}, },
"digdug": { "digdug": {
"version": "1.2.1", "version": "1.3.2",
"from": "digdug@1.2.1", "from": "digdug@1.3.2",
"dependencies": { "dependencies": {
"dojo": {
"version": "2.0.0-alpha4",
"from": "dojo@2.0.0-alpha4"
},
"decompress": { "decompress": {
"version": "0.2.3", "version": "0.2.3",
"from": "decompress@0.2.3", "from": "decompress@0.2.3",

View File

@ -71,7 +71,7 @@
"gulp-eslint": "1.0.0", "gulp-eslint": "1.0.0",
"gulp-lintspaces": "0.3.2", "gulp-lintspaces": "0.3.2",
"gulp-shell": "0.4.1", "gulp-shell": "0.4.1",
"intern": "2.2.2", "intern": "3.0.6",
"karma": "~0.13.9", "karma": "~0.13.9",
"karma-chai": "~0.1.0", "karma-chai": "~0.1.0",
"karma-mocha": "~0.2.0", "karma-mocha": "~0.2.0",

View File

@ -23,6 +23,6 @@ define(function() {
maxConcurrency: 1, maxConcurrency: 1,
grep: /^/, grep: /^/,
excludeInstrumentation: /^/, excludeInstrumentation: /^/,
reporters: ['console', 'tests/functional/screenshot_on_fail'] reporters: ['Runner', 'tests/functional/screenshot_on_fail']
}; };
}); });

View File

@ -17,9 +17,8 @@
define([ define([
'intern/dojo/node!lodash', 'intern/dojo/node!lodash',
'intern/chai!assert', 'intern/chai!assert',
'intern/dojo/node!fs',
'intern/dojo/node!leadfoot/Command' 'intern/dojo/node!leadfoot/Command'
], function(_, assert, fs, Command) { ], function(_, assert, Command) {
'use strict'; 'use strict';
_.defaults(Command.prototype, { _.defaults(Command.prototype, {
@ -39,20 +38,6 @@ define([
.end(); .end();
}); });
}, },
takeScreenshotAndSave: function(filename) {
return new this.constructor(this, function() {
return this.parent
.takeScreenshot()
.then(function(buffer) {
var targetDir = process.env.ARTIFACTS || process.cwd();
if (!filename) filename = new Date().toTimeString();
filename = filename.replace(/[\s\*\?\\\/]/g, '_');
filename = targetDir + '/' + filename + '.png';
console.log('Saving screenshot to', filename); // eslint-disable-line no-console
fs.writeFileSync(filename, buffer);
});
});
},
waitForCssSelector: function(cssSelector, timeout) { waitForCssSelector: function(cssSelector, timeout) {
return new this.constructor(this, function() { return new this.constructor(this, function() {
var self = this, currentTimeout; var self = this, currentTimeout;
@ -110,7 +95,6 @@ define([
x = element; x = element;
element = null; element = null;
} }
return new this.constructor(this, function() { return new this.constructor(this, function() {
this._session._dragSource = { this._session._dragSource = {
element: element || this.parent._context[0], element: element || this.parent._context[0],

View File

@ -86,6 +86,7 @@ define([
} }
return true; return true;
}) })
.end()
.waitForCssSelector('.dashboard-tab', 1000); .waitForCssSelector('.dashboard-tab', 1000);
} }
}; };

View File

@ -18,12 +18,13 @@ define([
'intern/dojo/node!lodash', 'intern/dojo/node!lodash',
'intern/chai!assert', 'intern/chai!assert',
'tests/functional/helpers', 'tests/functional/helpers',
'intern/dojo/node!leadfoot/helpers/pollUntil',
'tests/functional/pages/login', 'tests/functional/pages/login',
'tests/functional/pages/welcome', 'tests/functional/pages/welcome',
'tests/functional/pages/cluster', 'tests/functional/pages/cluster',
'tests/functional/pages/clusters' 'tests/functional/pages/clusters'
], ],
function(_, assert, Helpers, LoginPage, WelcomePage, ClusterPage, ClustersPage) { function(_, assert, Helpers, pollUntil, LoginPage, WelcomePage, ClusterPage, ClustersPage) {
'use strict'; 'use strict';
function CommonMethods(remote) { function CommonMethods(remote) {
this.remote = remote; this.remote = remote;
@ -113,6 +114,9 @@ function(_, assert, Helpers, LoginPage, WelcomePage, ClusterPage, ClustersPage)
.waitForCssSelector('button.btn-add-nodes', 3000) .waitForCssSelector('button.btn-add-nodes', 3000)
.clickByCssSelector('button.btn-add-nodes') .clickByCssSelector('button.btn-add-nodes')
.waitForCssSelector('.node', 3000) .waitForCssSelector('.node', 3000)
.then(pollUntil(function() {
return window.$('.node-list-management-buttons').is(':visible') && window.$('.role-panel').is(':visible') || null;
}, 3000))
.then(function() { .then(function() {
if (nodeNameFilter) return self.clusterPage.searchForNode(nodeNameFilter); if (nodeNameFilter) return self.clusterPage.searchForNode(nodeNameFilter);
}) })

View File

@ -38,7 +38,9 @@ define([
// the following timeout as we have 0.3s transition for the button // the following timeout as we have 0.3s transition for the button
.sleep(500) .sleep(500)
.clickByCssSelector('div.compact-node .node-hardware p.btn') .clickByCssSelector('div.compact-node .node-hardware p.btn')
.waitForCssSelector('.node-popover', 1000); .waitForCssSelector('.node-popover', 1000)
// the following timeout as we have 0.3s transition for the popover
.sleep(300);
}, },
openNodePopup: function(fromExtendedView) { openNodePopup: function(fromExtendedView) {
var self = this, var self = this,

View File

@ -14,21 +14,38 @@
* under the License. * under the License.
**/ **/
define(function() { define(['intern/dojo/node!fs'], function(fs) {
'use strict'; 'use strict';
var remotes = {}; var ScreenshotOnFailReporter = function() {
this.remotes = {};
function saveScreenshot(testOrSuite) {
var remote = remotes[testOrSuite.sessionId];
if (remote && remote.takeScreenshotAndSave) remote.takeScreenshotAndSave(testOrSuite.id);
}
return {
'/session/start': function(remote) {
remotes[remote.sessionId] = remote;
},
'/suite/error': saveScreenshot,
'/test/fail': saveScreenshot
}; };
ScreenshotOnFailReporter.prototype = {
saveScreenshot: function(testOrSuite) {
var remote = this.remotes[testOrSuite.sessionId];
if (remote) {
remote.takeScreenshot().then(function(buffer) {
var targetDir = process.env.ARTIFACTS || process.cwd();
var filename = testOrSuite.id + ' - ' + new Date().toTimeString();
filename = filename.replace(/[\s\*\?\\\/]/g, '_');
filename = targetDir + '/' + filename + '.png';
fs.writeFileSync(filename, buffer);
console.log('Saved screenshot to', filename); // eslint-disable-line no-console
});
}
},
sessionStart: function(remote) {
var sessionId = remote._session._sessionId;
this.remotes[sessionId] = remote;
},
suiteError: function(suite) {
this.saveScreenshot(suite);
},
testFail: function(test) {
this.saveScreenshot(test);
}
};
return ScreenshotOnFailReporter;
}); });

View File

@ -62,7 +62,14 @@ define([
}, },
afterEach: function() { afterEach: function() {
return this.remote return this.remote
.clickByCssSelector('.btn-revert-changes'); .findByCssSelector('.btn-revert-changes')
.then(function(element) {
return element.isEnabled()
.then(function(isEnabled) {
if (isEnabled) return element.click();
});
})
.end();
}, },
'Add ranges manipulations': function() { 'Add ranges manipulations': function() {
var rangeSelector = '.public .ip_ranges '; var rangeSelector = '.public .ip_ranges ';
@ -184,6 +191,7 @@ define([
.clickByCssSelector('.glyphicon-pencil') .clickByCssSelector('.glyphicon-pencil')
.waitForCssSelector('.network-group-name input[type=text]', 2000) .waitForCssSelector('.network-group-name input[type=text]', 2000)
.findByCssSelector('.node-group-renaming input[type=text]') .findByCssSelector('.node-group-renaming input[type=text]')
.clearValue()
.type('Node_Network_Group_2') .type('Node_Network_Group_2')
// Enter // Enter
.type('\uE007') .type('\uE007')

View File

@ -42,7 +42,7 @@ define([
.then(function() { .then(function() {
return loginPage.login('login', '*****'); return loginPage.login('login', '*****');
}) })
.assertElementExists('div.login-error', 'Error message is expected to get displayed'); .assertElementAppears('div.login-error', 1000, 'Error message is expected to get displayed');
}, },
'Login with proper credentials': function() { 'Login with proper credentials': function() {
return this.remote return this.remote

View File

@ -17,9 +17,10 @@
define([ define([
'intern!object', 'intern!object',
'tests/functional/helpers', 'tests/functional/helpers',
'intern/dojo/node!leadfoot/helpers/pollUntil',
'tests/functional/pages/interfaces', 'tests/functional/pages/interfaces',
'tests/functional/pages/common' 'tests/functional/pages/common'
], function(registerSuite, helpers, InterfacesPage, Common) { ], function(registerSuite, helpers, pollUntil, InterfacesPage, Common) {
'use strict'; 'use strict';
registerSuite(function() { registerSuite(function() {
@ -46,7 +47,10 @@ define([
}) })
.clickByCssSelector('.node.pending_addition input[type=checkbox]:not(:checked)') .clickByCssSelector('.node.pending_addition input[type=checkbox]:not(:checked)')
.clickByCssSelector('button.btn-configure-interfaces') .clickByCssSelector('button.btn-configure-interfaces')
.assertElementAppears('div.ifc-list', 2000, 'Node interfaces loaded'); .assertElementAppears('div.ifc-list', 2000, 'Node interfaces loaded')
.then(pollUntil(function() {
return window.$('div.ifc-list').is(':visible') || null;
}, 1000));
}, },
afterEach: function() { afterEach: function() {
return this.remote return this.remote

View File

@ -87,7 +87,7 @@ define([
.assertElementAppears(searchInputSelector, 200, 'Search input appears on the page') .assertElementAppears(searchInputSelector, 200, 'Search input appears on the page')
.setInputValue(searchInputSelector, 'Super') .setInputValue(searchInputSelector, 'Super')
// need to wait debounced search input // need to wait debounced search input
.sleep(200) .sleep(300)
.assertElementsExist('.node-list .node', 3, 'Search was successfull') .assertElementsExist('.node-list .node', 3, 'Search was successfull')
.clickByCssSelector('.page-title') .clickByCssSelector('.page-title')
.assertElementNotExists(searchButtonSelector, 'Active search control remains open when clicking outside the input') .assertElementNotExists(searchButtonSelector, 'Active search control remains open when clicking outside the input')

View File

@ -17,12 +17,13 @@
define([ define([
'intern!object', 'intern!object',
'intern/chai!assert', 'intern/chai!assert',
'intern/dojo/node!leadfoot/helpers/pollUntil',
'tests/functional/pages/node', 'tests/functional/pages/node',
'tests/functional/pages/modal', 'tests/functional/pages/modal',
'tests/functional/pages/common', 'tests/functional/pages/common',
'tests/functional/pages/cluster', 'tests/functional/pages/cluster',
'tests/functional/helpers' 'tests/functional/helpers'
], function(registerSuite, assert, NodeComponent, ModalWindow, Common, ClusterPage) { ], function(registerSuite, assert, pollUntil, NodeComponent, ModalWindow, Common, ClusterPage) {
'use strict'; 'use strict';
registerSuite(function() { registerSuite(function() {
@ -119,7 +120,7 @@ define([
.then(function() { .then(function() {
return node.openCompactNodeExtendedView(); return node.openCompactNodeExtendedView();
}) })
.clickByCssSelector('.node-name [type=checkbox]') .clickByCssSelector('.node-popover .node-name input[type=checkbox]')
.assertElementExists('.compact-node .node-checkbox i.glyphicon-ok', 'Node compact panel is checked') .assertElementExists('.compact-node .node-checkbox i.glyphicon-ok', 'Node compact panel is checked')
.then(function() { .then(function() {
return node.openNodePopup(true); return node.openNodePopup(true);
@ -149,6 +150,9 @@ define([
return this.remote return this.remote
.clickByCssSelector('button.btn-add-nodes') .clickByCssSelector('button.btn-add-nodes')
.assertElementAppears('.node-list', 2000, 'Unallocated node list loaded') .assertElementAppears('.node-list', 2000, 'Unallocated node list loaded')
.then(pollUntil(function() {
return window.$('.node-list').is(':visible') || null;
}, 3000))
.then(function() { .then(function() {
return node.openCompactNodeExtendedView(); return node.openCompactNodeExtendedView();
}) })