Skip to content

Commit

Permalink
Merge pull request #675 from karlcow/272/3
Browse files Browse the repository at this point in the history
Adding labels tests fix #272
  • Loading branch information
Mike Taylor committed Aug 14, 2015
2 parents 705b440 + 2d800f9 commit 7c916c3
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ define([
'./functional/issues',
'./functional/reporting',
'./functional/contributors',
'./functional/history-navigation'
'./functional/history-navigation',
'./functional/labels'
], function () {
'use strict';
});
114 changes: 114 additions & 0 deletions tests/functional/labels.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

define([
'intern',
'intern!object',
'intern/chai!assert',
'require'
], function (intern, registerSuite, assert, require) {
'use strict';

registerSuite(function () {

var url = function (num) {
return intern.config.siteRoot + '/issues/' + num;
};

return {
name: 'labels',

setup: function () {
// We should be logged before starting the labels test.
// The setup function should make sure we are not logged.
},

teardown: function () {
// The teardown should remove all labels which would have
// been put during the process, specifically if it fails
// in the middle of testing.
},

'label gear is visible': function () {
return this.remote
.setFindTimeout(intern.config.wc.pageLoadTimeout)
.get(require.toUrl(url(2)))
.findByCssSelector('.LabelEditor-wrapper')
.isDisplayed()
.then(function (displayed) {
assert.isTrue(displayed, 'The label gear icon is visible once logged');
})
.end();
},

'label widget is opening on click': function () {
return this.remote
.setFindTimeout(intern.config.wc.pageLoadTimeout)
.get(require.toUrl(url(2)))
.findByCssSelector('.LabelEditor-launcher').click()
.end()
.findByCssSelector('.LabelEditor')
.isDisplayed()
.then(function (displayed) {
assert.isTrue(displayed, 'The label editor widget is open');
})
.end();
},

'Label appears once selected': function () {
return this.remote
.setFindTimeout(intern.config.wc.pageLoadTimeout)
.get(require.toUrl(url(2)))
.findByCssSelector('.LabelEditor-launcher').click()
.end()
.findByCssSelector('label.LabelEditor-item input[name="contactready"]').click()
.end()
.findByCssSelector('.Label--badge')
.getVisibleText()
.then(function (label_text) {
assert.include(label_text, 'contactready', 'Label appears once it has been selected');
})
.end();
},

'Label has been sent to GitHub': function () {
return this.remote
.setFindTimeout(intern.config.wc.pageLoadTimeout)
.get(require.toUrl(url(2)))
.findByCssSelector('.LabelEditor-launcher').click()
.end()
.findByCssSelector('label.LabelEditor-item input[name="contactready"]').click()
.end()
.findByCssSelector('.LabelEditor-btn').click()
.end()
.refresh()
.findByCssSelector('.Label--badge')
.getVisibleText()
.then(function (label_text) {
assert.include(label_text, 'contactready', 'Label has been set on Github');
})
.end();
},

'Removes a label': function () {
return this.remote
.setFindTimeout(intern.config.wc.pageLoadTimeout)
.get(require.toUrl(url(2)))
.findByCssSelector('.LabelEditor-launcher').click()
.end()
.findByCssSelector('label.LabelEditor-item input[name="contactready"]').click()
.end()
.findByCssSelector('.LabelEditor-btn').click()
.end()
.get(require.toUrl(url(2)))
.findByCssSelector('.Label--badge')
.getVisibleText()
.then(function (label_text) {
assert.include(label_text, 'contactready', 'Label has been removed');
})
.end();
}
};
});
});

0 comments on commit 7c916c3

Please sign in to comment.