Adding common utils for accessing first project, backlog, taskboard, task, issue and userstory

stable
Alejandro Alonso 2015-07-24 10:52:27 +02:00 committed by Juanfran
parent e575f23d06
commit 1f0b7d510e
6 changed files with 102 additions and 9 deletions

View File

@ -6,10 +6,14 @@ var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
describe('Issue detail', function(){
describe('Issue detail', async function(){
let issuesUrl = "";
before(async function(){
browser.get('http://localhost:9001/project/project-2/issue/95');
await utils.common.waitLoader();
utils.common.goHome();
utils.common.goToFirstProject();
utils.common.goToIssues();
issuesUrl = await browser.getCurrentUrl();
utils.common.goToFirstIssue();
});
it('screenshot', async function() {
@ -27,4 +31,11 @@ describe('Issue detail', function(){
it('screenshot', async function() {
await utils.common.takeScreenshot("issues", "detail updated");
});
it('delete', utils.detail.deleteTesting);
it('redirected', async function (){
let url = await browser.getCurrentUrl();
expect(url.endsWith(issuesUrl)).to.be.true;
});
})

View File

@ -7,9 +7,14 @@ chai.use(chaiAsPromised);
var expect = chai.expect;
describe('Task detail', function(){
let sprintUrl = "";
before(async function(){
browser.get('http://localhost:9001/project/project-2/task/4');
await utils.common.waitLoader();
utils.common.goHome();
utils.common.goToFirstProject();
utils.common.goToBacklog();
utils.common.goToFirstSprint();
sprintUrl = await browser.getCurrentUrl();
utils.common.goToFirstTask();
});
it('screenshot', async function() {
@ -27,4 +32,11 @@ describe('Task detail', function(){
it('screenshot', async function() {
await utils.common.takeScreenshot("tasks", "detail updated");
});
it('delete', utils.detail.deleteTesting);
it('redirected', async function (){
let url = await browser.getCurrentUrl();
expect(url.endsWith(sprintUrl)).to.be.true;
});
})

View File

@ -6,10 +6,14 @@ var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
describe('USer story detail', function(){
describe('User story detail', function(){
let backlogUrl = "";
before(async function(){
browser.get('http://localhost:9001/project/project-2/us/65');
await utils.common.waitLoader();
utils.common.goHome();
utils.common.goToFirstProject();
utils.common.goToBacklog();
backlogUrl = await browser.getCurrentUrl();
utils.common.goToFirstUserStory();
});
it('screenshot', async function() {
@ -27,4 +31,11 @@ describe('USer story detail', function(){
it('screenshot', async function() {
await utils.common.takeScreenshot("user-stories", "detail updated");
});
it('delete', utils.detail.deleteTesting);
it('redirected', async function (){
let url = await browser.getCurrentUrl();
expect(url.endsWith(backlogUrl+"?no-milestone=1")).to.be.true;
});
})

View File

@ -132,3 +132,17 @@ helper.assignToLightbox = function() {
return obj;
};
helper.delete = function() {
let el = $('tg-delete-button');
let obj = {
el:el,
delete: async function(){
el.$('.button-red').click();
await utils.lightbox.confirm.ok();
}
}
return obj;
}

View File

@ -197,3 +197,44 @@ common.clear = function(elem, length) {
return elem.sendKeys(backspaceSeries);
};
common.goHome = async function() {
browser.get('http://localhost:9001');
await utils.common.waitLoader();
};
common.goToFirstProject = async function() {
browser.actions().mouseMove($('div[tg-dropdown-project-list]')).perform();
$$('div[tg-dropdown-project-list] li a').first().click();
await utils.common.waitLoader();
};
common.goToIssues = async function() {
$('#nav-issues').click();
await utils.common.waitLoader();
};
common.goToFirstIssue = async function() {
$$('section.issues-table .row.table-main .subject a').first().click();
await utils.common.waitLoader();
};
common.goToBacklog = async function() {
$('#nav-backlog').click();
await utils.common.waitLoader();
}
common.goToFirstUserStory = async function() {
$$('.user-story-name>a').first().click();
await utils.common.waitLoader();
}
common.goToFirstSprint = async function() {
$$('div[tg-backlog-sprint] a.button-gray').first().click();
await utils.common.waitLoader();
}
common.goToFirstTask = async function() {
$$('div[tg-taskboard-task] a.task-name').first().click();
await utils.common.waitLoader();
}

View File

@ -44,7 +44,6 @@ helper.descriptionTesting = async function() {
helper.assignedToTesting = async function() {
let assignedTo = detailHelper.assignedTo();
let assignToLightbox = detailHelper.assignToLightbox();
let userName = detailHelper.assignedTo().getUserName();
await assignedTo.clear();
assignedTo.assign();
@ -54,3 +53,8 @@ helper.assignedToTesting = async function() {
let newUserName = assignedTo.getUserName();
expect(newUserName).to.be.not.equal(userName);
}
helper.deleteTesting = async function() {
let deleteHelper = detailHelper.delete();
await deleteHelper.delete();
}