From 03d3c7ea73ab20ca2934333370d6989cfdd4a0fb Mon Sep 17 00:00:00 2001 From: Juanfran Date: Mon, 5 Oct 2015 09:17:25 +0200 Subject: [PATCH] fix e2e issues & us navigation --- e2e/full/issues/issue-detail.e2e.js | 12 ++- .../user-stories/user-story-detail.e2e.js | 12 ++- e2e/utils/index.js | 1 + e2e/utils/nav.js | 92 +++++++++++++++++++ 4 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 e2e/utils/nav.js diff --git a/e2e/full/issues/issue-detail.e2e.js b/e2e/full/issues/issue-detail.e2e.js index 4f26ae3a..d6c00623 100644 --- a/e2e/full/issues/issue-detail.e2e.js +++ b/e2e/full/issues/issue-detail.e2e.js @@ -7,11 +7,17 @@ chai.use(chaiAsPromised); var expect = chai.expect; describe('Issue detail', async function(){ - let issueUrl = browser.params.glob.host + 'project/project-3/issue/92'; + let issueUrl = ''; before(async function(){ - browser.get(issueUrl); - await utils.common.waitLoader(); + utils.nav + .init() + .project(0) + .issues() + .issue(0) + .go(); + + issueUrl = await browser.getCurrentUrl(); }); it('screenshot', async function() { diff --git a/e2e/full/user-stories/user-story-detail.e2e.js b/e2e/full/user-stories/user-story-detail.e2e.js index 02b338c0..c5c9eb70 100644 --- a/e2e/full/user-stories/user-story-detail.e2e.js +++ b/e2e/full/user-stories/user-story-detail.e2e.js @@ -8,11 +8,17 @@ chai.use(chaiAsPromised); var expect = chai.expect; describe('User story detail', function(){ - let usUrl = browser.params.glob.host + 'project/project-3/us/81'; + let usUrl = ''; before(async function(){ - browser.get(usUrl); - await utils.common.waitLoader(); + utils.nav + .init() + .project(0) + .backlog() + .us(0) + .go(); + + usUrl = await browser.getCurrentUrl(); }); it('screenshot', async function() { diff --git a/e2e/utils/index.js b/e2e/utils/index.js index c2810a06..34d7ac6a 100644 --- a/e2e/utils/index.js +++ b/e2e/utils/index.js @@ -3,3 +3,4 @@ module.exports.notifications = require("./notifications"); module.exports.lightbox = require("./lightbox"); module.exports.popover = require("./popover"); module.exports.detail = require("./detail"); +module.exports.nav = require("./nav"); diff --git a/e2e/utils/nav.js b/e2e/utils/nav.js new file mode 100644 index 00000000..1593f806 --- /dev/null +++ b/e2e/utils/nav.js @@ -0,0 +1,92 @@ +var helper = module.exports; + +var common = require('./common'); + +var actions = { + project: function(index) { + browser.actions().mouseMove($('div[tg-dropdown-project-list]')).perform(); + + let project = $$('div[tg-dropdown-project-list] li a').first(); + + common.link(project); + + common.waitLoader(); + }, + issues: function(index) { + common.link($('#nav-issues a')); + + common.waitLoader(); + }, + issue: function(index) { + let issue = $$('section.issues-table .row.table-main .subject a').get(index); + + common.link(issue); + + common.waitLoader(); + }, + backlog: function() { + common.link($('#nav-backlog a')); + + common.waitLoader(); + }, + us: function(index) { + let us = $$('.user-story-name>a').get(index); + + common.link(us); + + common.waitLoader(); + }, + taskboard: function(index) { + let link = $$('.sprints .button-gray').get(index); + + common.link(link); + + common.waitLoader(); + }, + task: function(index) { + common.link($$('div[tg-taskboard-task] a.task-name').get(index)); + + common.waitLoader(); + } +}; + +var nav = { + actions: [], + project: function(index) { + this.actions.push(actions.project.bind(null, index)); + return nav; + }, + issues: function() { + this.actions.push(actions.issues); + return nav; + }, + issue: function(index) { + this.actions.push(actions.issue.bind(null, index)); + return nav; + }, + backlog: function(index) { + this.actions.push(actions.backlog.bind(null, index)); + return nav; + }, + us: function(index) { + this.actions.push(actions.us.bind(null, index)); + return nav; + }, + taskboard: function(index) { + this.actions.push(actions.taskboard.bind(null, index)); + return nav; + }, + task: function(index) { + this.actions.push(actions.task.bind(null, index)); + return nav; + }, + go: function() { + for (let action of this.actions) { + action(); + } + } +}; + +helper.init = function() { + return nav; +};