From a49d68d1b8586236aa6ef4e814f013b9618bbcdb Mon Sep 17 00:00:00 2001 From: Divyanshi Gupta Date: Mon, 3 Dec 2018 17:48:13 +0530 Subject: [PATCH] fix(tests): remove sdd template tests (#2810) --- src/tests/mixins/logging.ts | 7 +- .../page_objects/planner/planner.page.ts | 9 +- .../agileTemplate.spec.ts | 4 +- src/tests/specs/collaboratorTest.spec.ts | 7 +- src/tests/specs/detailPage.spec.ts | 28 ++--- src/tests/specs/iteration.spec.ts | 6 +- src/tests/specs/query-tab.spec.ts | 4 +- src/tests/specs/quickPreview.spec.ts | 23 ++-- src/tests/specs/smoke/smokeTest.spec.ts | 38 +++--- .../templateSpecificTests/sddTemplate.spec.ts | 69 ----------- src/tests/specs/workItemTableTest.spec.ts | 26 ++-- src/tests/support/constants.ts | 113 +++++------------- src/tests/ui/planner/sidepanel.ts | 23 +--- tests/protractor.conf.ts | 43 ++----- 14 files changed, 113 insertions(+), 287 deletions(-) rename src/tests/specs/{templateSpecificTests => }/agileTemplate.spec.ts (98%) delete mode 100644 src/tests/specs/templateSpecificTests/sddTemplate.spec.ts diff --git a/src/tests/mixins/logging.ts b/src/tests/mixins/logging.ts index b529d29c0..c6256cd55 100644 --- a/src/tests/mixins/logging.ts +++ b/src/tests/mixins/logging.ts @@ -1,4 +1,3 @@ -import { browser } from 'protractor'; import { debug, info } from '../support'; export class Logging { @@ -6,17 +5,17 @@ export class Logging { log(action: string, ...msg: string[]) { let className = this.constructor.name; - info(`${action}: ${browser.browserName} ${className}('${this.name}')`, ...msg); + info(`${action}: ${className}('${this.name}')`, ...msg); } debug(context: string, ...msg: string[]) { let className = this.constructor.name; - debug(`${browser.browserName} ${className}('${this.name}'): ${context}`, ...msg); + debug(`${className}('${this.name}'): ${context}`, ...msg); } fail(action: string, ...msg: string[]) { let className = this.constructor.name; /* to display errors in red */ - console.error('\x1b[31m%s', `${action}: ${browser.browserName} ${className}('${this.name}')`, ...msg, '\x1b[0m'); + console.error('\x1b[31m%s', `${action}: ${className}('${this.name}')`, ...msg, '\x1b[0m'); } } diff --git a/src/tests/page_objects/planner/planner.page.ts b/src/tests/page_objects/planner/planner.page.ts index 314da0b4c..ae09a28ca 100644 --- a/src/tests/page_objects/planner/planner.page.ts +++ b/src/tests/page_objects/planner/planner.page.ts @@ -49,14 +49,7 @@ export class PlannerPage extends AppPage { } async resetState() { - if (await browser.browserName === 'browserSDD') { - await this.sidePanel.clickWorkItemGroup('Scenarios'); - } else if (await browser.browserName === 'browserAgile') { - await this.sidePanel.clickWorkItemGroup('Work Items'); - } else { - support.debug('browser Name not defined'); - } - + await this.sidePanel.clickWorkItemGroup(); await $('body').sendKeys(Key.ESCAPE); } } diff --git a/src/tests/specs/templateSpecificTests/agileTemplate.spec.ts b/src/tests/specs/agileTemplate.spec.ts similarity index 98% rename from src/tests/specs/templateSpecificTests/agileTemplate.spec.ts rename to src/tests/specs/agileTemplate.spec.ts index bc389062d..8fe55deb3 100644 --- a/src/tests/specs/templateSpecificTests/agileTemplate.spec.ts +++ b/src/tests/specs/agileTemplate.spec.ts @@ -1,6 +1,6 @@ import { browser } from 'protractor'; -import { PlannerPage } from '../../page_objects/planner'; -import * as support from '../../support'; +import { PlannerPage } from '../page_objects/planner'; +import * as support from '../support'; describe('Agile template tests: ', () => { diff --git a/src/tests/specs/collaboratorTest.spec.ts b/src/tests/specs/collaboratorTest.spec.ts index 41c7d1052..5da87a547 100644 --- a/src/tests/specs/collaboratorTest.spec.ts +++ b/src/tests/specs/collaboratorTest.spec.ts @@ -7,14 +7,12 @@ describe('Planner Collaborator Tests:', () => { let planner: PlannerPage; let planner1: PlannerPage; let c = new support.Constants(); - let testData; beforeAll(async () => { await support.desktopTestSetup(); planner = new PlannerPage(browser.baseUrl); await planner.openInBrowser(); let url = await browser.getCurrentUrl(); - testData = c.browserName[browser.browserName]; let URL = ''; /* Run tests against production or prod-preview */ if (url.startsWith('https://openshift.io')) { @@ -31,7 +29,8 @@ describe('Planner Collaborator Tests:', () => { }); beforeEach(async () => { - await planner.ready(); + await planner.sidePanel.ready(); + await planner.workItemList.ready(); await planner.workItemList.overlay.untilHidden(); }); @@ -54,7 +53,7 @@ describe('Planner Collaborator Tests:', () => { it('Non collaborator should Comment and Save', async () => { let comment = 'new comment'; /* to avoid workitem conflict should comment on 2 different workitem */ - await planner1.workItemList.clickWorkItem(testData.commentCollaboratorTest); + await planner1.workItemList.clickWorkItem(c.commentCollaboratorTest); await planner1.quickPreview.addCommentAndSave(comment); expect(await planner1.quickPreview.getComments()).toContain(comment); }); diff --git a/src/tests/specs/detailPage.spec.ts b/src/tests/specs/detailPage.spec.ts index 817c9cd39..f7fa63f22 100644 --- a/src/tests/specs/detailPage.spec.ts +++ b/src/tests/specs/detailPage.spec.ts @@ -6,14 +6,12 @@ import * as support from '../support'; describe('Detail View test: ', () => { let planner: PlannerPage; let c = new support.Constants(); - let testData; beforeAll(async () => { await support.desktopTestSetup(); planner = new PlannerPage(browser.baseUrl); await planner.openInBrowser(); await planner.waitUntilUrlContains('typegroup'); - testData = await c.browserName[browser.browserName]; }); beforeEach(async () => { @@ -58,8 +56,8 @@ describe('Detail View test: ', () => { await planner.workItemList.openDetailPage(workItemTitle2); await planner.waitUntilUrlContains('detail'); await planner.detailPage.titleInput.untilTextIsPresentInValue(workItemTitle2); - await planner.detailPage.addArea(testData.dropdownareaTitle1); - expect(await planner.detailPage.getArea()).toBe(testData.areaTitle1); + await planner.detailPage.addArea(c.dropdownareaTitle1); + expect(await planner.detailPage.getArea()).toBe(c.areaTitle1); }); it('should associate workitem with an Iteration', async () => { @@ -67,8 +65,8 @@ describe('Detail View test: ', () => { await planner.workItemList.openDetailPage(workItemTitle2); await planner.waitUntilUrlContains('detail'); await planner.detailPage.titleInput.untilTextIsPresentInValue(workItemTitle2); - await planner.detailPage.addIteration(testData.dropdownIteration1); - expect(await planner.detailPage.getIteration()).toBe(testData.iteration1); + await planner.detailPage.addIteration(c.dropdownIteration1); + expect(await planner.detailPage.getIteration()).toBe(c.iteration1); }); it('should add comment', async () => { @@ -88,8 +86,8 @@ describe('Detail View test: ', () => { await planner.waitUntilUrlContains('detail'); await planner.detailPage.titleInput.untilTextIsPresentInValue(workItemTitle2); /* Adding link b/w workItemTitle2 and Workitem_Title_3 */ - await planner.detailPage.addLink(linkType, testData.Workitem_Title_3); - expect(await planner.detailPage.getLinkedItems()).toContain(testData.Workitem_Title_3); + await planner.detailPage.addLink(linkType, c.Workitem_Title_3); + expect(await planner.detailPage.getLinkedItems()).toContain(c.Workitem_Title_3); }); it('should remove link from workitem', async () => { @@ -99,9 +97,9 @@ describe('Detail View test: ', () => { await planner.workItemList.openDetailPage(workItemName1.title); await planner.waitUntilUrlContains('detail'); await planner.detailPage.titleInput.untilTextIsPresentInValue(workItemName1.title); - await planner.detailPage.addLink(linkType, testData.Workitem_Title_4); - expect(await planner.detailPage.getLinkedItems()).toContain(testData.Workitem_Title_4); - await planner.detailPage.removeLink(testData.Workitem_Title_4); + await planner.detailPage.addLink(linkType, c.Workitem_Title_4); + expect(await planner.detailPage.getLinkedItems()).toContain(c.Workitem_Title_4); + await planner.detailPage.removeLink(c.Workitem_Title_4); await planner.detailPage.linkCount.untilTextIsPresent('0'); expect(await planner.detailPage.linkCount.getTextWhenReady()).toBe('0'); }); @@ -112,8 +110,8 @@ describe('Detail View test: ', () => { await planner.workItemList.openDetailPage(workitemname.title); await planner.waitUntilUrlContains('detail'); await planner.detailPage.titleInput.untilTextIsPresentInValue(workitemname.title); - await planner.detailPage.changeStateTo(testData.stateOpen); - expect(await planner.detailPage.getState()).toBe(testData.stateOpen); + await planner.detailPage.changeStateTo(c.stateOpen); + expect(await planner.detailPage.getState()).toBe(c.stateOpen); }); it('Should change the type of work item', async () => { @@ -122,7 +120,7 @@ describe('Detail View test: ', () => { await planner.workItemList.openDetailPage(workitemname.title); await planner.waitUntilUrlContains('detail'); await planner.detailPage.titleInput.untilTextIsPresentInValue(workitemname.title); - await planner.detailPage.changeTypeTo(testData.typeIssue); - expect(await planner.detailPage.getType()).toBe(testData.typeIssue); + await planner.detailPage.changeTypeTo(c.typeIssue); + expect(await planner.detailPage.getType()).toBe(c.typeIssue); }); }); diff --git a/src/tests/specs/iteration.spec.ts b/src/tests/specs/iteration.spec.ts index 098219bd7..a0dae68dd 100644 --- a/src/tests/specs/iteration.spec.ts +++ b/src/tests/specs/iteration.spec.ts @@ -6,14 +6,12 @@ import * as support from '../support'; describe('Iteration test', () => { let planner: PlannerPage; let c = new support.Constants(); - let testData; beforeAll(async () => { await support.desktopTestSetup(); planner = new PlannerPage(browser.baseUrl); await planner.openInBrowser(); await planner.waitUntilUrlContains('typegroup'); - testData = await c.browserName[browser.browserName]; }); beforeEach(async () => { @@ -42,7 +40,7 @@ describe('Iteration test', () => { let newIteration = 'new Iteration1'; let iteration = 'Iteration_2'; await planner.sidePanel.createNewIteration(); - await planner.iteration.addNewIteration(newIteration, testData.parentIteration); + await planner.iteration.addNewIteration(newIteration, c.parentIteration); await planner.iteration.clickCreateIteration(); await planner.sidePanel.clickExpander(iteration); expect(await planner.sidePanel.getIterationList()).toContain(newIteration); @@ -81,7 +79,7 @@ describe('Iteration test', () => { await planner.iteration.parentIteration.enterText(iterationName); let val = await planner.iteration.parentDropdownList.getTextWhenReady(); // Ensure val is exactly the value we expect it to be - expect(val).toBe(testData.rootIteration + '/' + iterationName); + expect(val).toBe(c.rootIteration + '/' + iterationName); await planner.iteration.clickCancel(); }); }); diff --git a/src/tests/specs/query-tab.spec.ts b/src/tests/specs/query-tab.spec.ts index 446aa5c0d..5d2270fe4 100644 --- a/src/tests/specs/query-tab.spec.ts +++ b/src/tests/specs/query-tab.spec.ts @@ -5,18 +5,16 @@ import * as support from '../support'; describe('Query tests', () => { let planner: PlannerPage; let c = new support.Constants(); - let testData; beforeAll(async () => { await support.desktopTestSetup(); planner = new PlannerPage(browser.baseUrl); await planner.openInBrowser(); await planner.waitUntilUrlContains('typegroup'); - testData = await c.browserName[browser.browserName]; }); it('should display search query result', async () => { - let searchQuery = `typegroup.name : ${testData.group1}`; + let searchQuery = `typegroup.name : ${c.group1}`; await planner.clickQueryTab(); await planner.waitUntilUrlContains('query'); expect(await browser.getCurrentUrl()).toContain('query'); diff --git a/src/tests/specs/quickPreview.spec.ts b/src/tests/specs/quickPreview.spec.ts index ddc354754..939803fec 100644 --- a/src/tests/specs/quickPreview.spec.ts +++ b/src/tests/specs/quickPreview.spec.ts @@ -6,14 +6,12 @@ import * as support from '../support'; describe('Quick preview tests: ', () => { let planner: PlannerPage; let c = new support.Constants(); - let testData; beforeAll(async () => { await support.desktopTestSetup(); planner = new PlannerPage(browser.baseUrl); await planner.openInBrowser(); await planner.waitUntilUrlContains('typegroup'); - testData = await c.browserName[browser.browserName]; }); beforeEach(async () => { @@ -58,9 +56,9 @@ describe('Quick preview tests: ', () => { linkType = 'blocks'; await planner.createWorkItem(workitemname); await planner.workItemList.clickWorkItem(workitemname.title); - await planner.quickPreview.addLink(linkType, testData.Workitem_Title_4); - await planner.quickPreview.linklistItem.untilTextIsPresent(testData.Workitem_Title_4); - expect(await planner.quickPreview.getLinkedItems()).toContain(testData.Workitem_Title_4); + await planner.quickPreview.addLink(linkType, c.Workitem_Title_4); + await planner.quickPreview.linklistItem.untilTextIsPresent(c.Workitem_Title_4); + expect(await planner.quickPreview.getLinkedItems()).toContain(c.Workitem_Title_4); }); it('should open quick preview and edit the title', async () => { @@ -72,21 +70,24 @@ describe('Quick preview tests: ', () => { }); it('description box should not be open for wis', async () => { - let workitemname = {'title': 'quickpreview test'}, - workItemTitle2 = 'Workitem_Title_2'; + let workitemname = {'title': 'quickpreview test'}; + let workitemname2 = { 'title': 'description box should not be open'}; await planner.createWorkItem(workitemname); + await planner.createWorkItem(workitemname2); await planner.workItemList.clickWorkItem(workitemname.title); await planner.quickPreview.openDescriptionBox(); expect(await planner.quickPreview.isSaveButtonDisplayed()).toBeTruthy(); // Open another WI(Note: the description box is still in edit mode) - await planner.workItemList.clickWorkItem(workItemTitle2); + await planner.workItemList.clickWorkItem(workitemname2.title); // The description box should not be in edit mode expect(await planner.quickPreview.isSaveButtonDisplayed()).toBeFalsy(); }); it('should close assignee dropdown when clicked outside', async () => { - await planner.workItemList.clickWorkItem('Workitem_Title_2'); + let workitemname = {'title': 'close assignee dropdown'}; + await planner.createWorkItem(workitemname); + await planner.workItemList.clickWorkItem(workitemname.title); await planner.quickPreview.assigneeDropdown.clickWhenReady(); expect(await planner.quickPreview.assigneeDropdownMenu.getAttribute('className')).toContain('show'); await planner.quickPreview.titleInput.clickWhenReady(); @@ -94,7 +95,9 @@ describe('Quick preview tests: ', () => { }); it('Should not close description box on outside click if the description is changed', async () => { - await planner.workItemList.clickWorkItem('Workitem_Title_2'); + let workitemname = {'title': 'close description box on outside click'}; + await planner.createWorkItem(workitemname); + await planner.workItemList.clickWorkItem(workitemname.title); await planner.quickPreview.openDescriptionBox(); expect(await planner.quickPreview.isSaveButtonDisplayed()).toBeTruthy(); await planner.quickPreview.descriptionTextarea.enterText('test'); diff --git a/src/tests/specs/smoke/smokeTest.spec.ts b/src/tests/specs/smoke/smokeTest.spec.ts index 81fc74541..091f7a427 100644 --- a/src/tests/specs/smoke/smokeTest.spec.ts +++ b/src/tests/specs/smoke/smokeTest.spec.ts @@ -7,14 +7,12 @@ import * as support from '../../support'; describe('Planner Smoke Tests:', () => { let planner: PlannerPage; let c = new support.Constants(); - let testData; beforeAll(async () => { await support.desktopTestSetup(); planner = new PlannerPage(browser.baseUrl); await planner.openInBrowser(); await planner.waitUntilUrlContains('typegroup'); - testData = await c.browserName[browser.browserName]; }); beforeEach(async () => { @@ -87,7 +85,7 @@ describe('Planner Smoke Tests:', () => { } else if (url.startsWith('https://prod-preview.openshift.io/')) { expect(await planner.quickPreview.getCreatorAvatar()).toBe(prodPreviewAvatar); } else { - expect(await planner.quickPreview.getCreatorAvatar()).toBe(testData.user_avatar); + expect(await planner.quickPreview.getCreatorAvatar()).toBe(c.user_avatar); } expect(await planner.quickPreview.getCreator()).toBe(user1); await planner.quickPreview.close(); @@ -96,15 +94,15 @@ describe('Planner Smoke Tests:', () => { it('Associate workitem with an Area', async () => { let title = await planner.createUniqueWorkItem(); await planner.workItemList.clickWorkItem(title); - await planner.quickPreview.addArea(testData.dropdownareaTitle1); - expect(await planner.quickPreview.getArea()).toBe(testData.areaTitle1); + await planner.quickPreview.addArea(c.dropdownareaTitle1); + expect(await planner.quickPreview.getArea()).toBe(c.areaTitle1); await planner.quickPreview.close(); await planner.workItemList.clickWorkItem(title); - expect(await planner.quickPreview.getArea()).toBe(testData.areaTitle1); - await planner.quickPreview.addArea(testData.dropdownareaTitle2); - expect(await planner.quickPreview.getArea()).not.toBe(testData.areaTitle1); - expect(await planner.quickPreview.getArea()).toBe(testData.areaTitle2); + expect(await planner.quickPreview.getArea()).toBe(c.areaTitle1); + await planner.quickPreview.addArea(c.dropdownareaTitle2); + expect(await planner.quickPreview.getArea()).not.toBe(c.areaTitle1); + expect(await planner.quickPreview.getArea()).toBe(c.areaTitle2); await planner.quickPreview.close(); }); @@ -113,15 +111,15 @@ describe('Planner Smoke Tests:', () => { let title = await planner.createUniqueWorkItem(), randomText = 'zxz'; await planner.workItemList.clickWorkItem(title); - await planner.quickPreview.addIteration(testData.dropdownIteration1); - expect(await planner.quickPreview.getIteration()).toBe(testData.iteration1); + await planner.quickPreview.addIteration(c.dropdownIteration1); + expect(await planner.quickPreview.getIteration()).toBe(c.iteration1); await planner.quickPreview.close(); //update iteration await planner.workItemList.clickWorkItem(title); - expect(await planner.quickPreview.getIteration()).toBe(testData.iteration1); - await planner.quickPreview.addIteration(testData.dropdownIteration_2); - expect(await planner.quickPreview.getIteration()).toBe(testData.iteration2); + expect(await planner.quickPreview.getIteration()).toBe(c.iteration1); + await planner.quickPreview.addIteration(c.dropdownIteration_2); + expect(await planner.quickPreview.getIteration()).toBe(c.iteration2); //search iteration await planner.workItemList.clickWorkItem(title); @@ -151,9 +149,9 @@ describe('Planner Smoke Tests:', () => { }); it('Create custom query', async () => { - await planner.sidePanel.clickWorkItemGroup(testData.group3); + await planner.sidePanel.clickWorkItemGroup(); await planner.workItemList.overlay.untilHidden(); - await planner.header.selectFilter('State', testData.stateInProgress); + await planner.header.selectFilter('State', c.stateInProgress); await planner.workItemList.overlay.untilHidden(); await planner.header.saveFilters('Query 1'); await planner.workItemList.overlay.untilHidden(); @@ -162,9 +160,9 @@ describe('Planner Smoke Tests:', () => { }); it('Delete custom query', async () => { - await planner.sidePanel.clickWorkItemGroup(testData.group3); + await planner.sidePanel.clickWorkItemGroup(); await planner.workItemList.overlay.untilHidden(); - await planner.header.selectFilter('State', testData.stateResolved); + await planner.header.selectFilter('State', c.stateResolved); await planner.workItemList.overlay.untilHidden(); await planner.header.saveFilters('My filter'); await planner.workItemList.overlay.untilHidden(); @@ -191,7 +189,7 @@ describe('Planner Smoke Tests:', () => { }); it('Create a work item and Open detail page', async () => { - await planner.quickAdd.addAndOpenWorkItem(testData.workitem); + await planner.quickAdd.addAndOpenWorkItem(c.workitem); await planner.waitUntilUrlContains('detail'); await planner.detailPage.titleInput.untilTextIsPresentInValue('new detail workItem'); await planner.detailPage.closeButton.ready(); @@ -207,7 +205,7 @@ describe('Planner Smoke Tests:', () => { await planner.workItemList.overlay.untilHidden(); await planner.quickAdd.addWorkItem({title : 'Add new work item to iteration test'}); expect(await planner.workItemList.hasWorkItem('Add new work item to iteration test')).toBeTruthy(); - await planner.sidePanel.clickWorkItemGroup(testData.group1); + await planner.sidePanel.clickWorkItemGroup(); await planner.workItemList.overlay.untilHidden(); await planner.sidePanel.clickIteration('Iteration_1'); expect(await planner.workItemList.hasWorkItem('Add new work item to iteration test')).toBeTruthy(); diff --git a/src/tests/specs/templateSpecificTests/sddTemplate.spec.ts b/src/tests/specs/templateSpecificTests/sddTemplate.spec.ts deleted file mode 100644 index 0ebf4454c..000000000 --- a/src/tests/specs/templateSpecificTests/sddTemplate.spec.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { browser } from 'protractor'; -import { PlannerPage } from '../../page_objects/planner'; -import * as support from '../../support'; - - -describe('SDD template tests: ', () => { - let plannerSDD: PlannerPage; - let c = new support.Constants(); - let testData; - - beforeAll(async () => { - await support.desktopTestSetup(); - plannerSDD = new PlannerPage(browser.baseUrl); - await plannerSDD.openInBrowser(); - await plannerSDD.waitUntilUrlContains('typegroup'); - testData = await c.browserName[browser.browserName]; - }); - - beforeEach(async () => { - await plannerSDD.ready(); - await plannerSDD.workItemList.overlay.untilHidden(); - }); - - it('Scenario-Quick Add should support Scenario, papercuts and fundamentals' , async () => { - let wiTypes = await plannerSDD.quickAdd.workItemTypes(); - expect(wiTypes.length).toBe(3); - expect(wiTypes[0]).toBe('Scenario'); - expect(wiTypes[1]).toBe('Fundamental'); - expect(wiTypes[2]).toBe('Papercuts'); - }); - - it('Experiences-Quick Add should support Experience and Value proposition', async () => { - await plannerSDD.sidePanel.clickWorkItemGroup('Experiences'); - let wiTypes = await plannerSDD.quickAdd.workItemTypes(); - expect(wiTypes.length).toBe(2); - expect(wiTypes[0]).toBe('Experience'); - expect(wiTypes[1]).toBe('Value Proposition'); - }); - - it('Requirement-Quick Add should support Feature and Bug', async () => { - await plannerSDD.sidePanel.clickWorkItemGroup('Requirements'); - let wiTypes = await plannerSDD.quickAdd.workItemTypes(); - expect(wiTypes.length).toBe(2); - expect(wiTypes[0]).toBe('Feature'); - expect(wiTypes[1]).toBe('Bug'); - }); - - it('Infotip opens on clicking on infotip icon and closes on outside click', async () => { - await plannerSDD.sidePanel.infotipIconExperience.clickWhenReady(); - await plannerSDD.sidePanel.infotipIconRequirement.clickWhenReady(); - expect(await plannerSDD.sidePanel.infotipPopover.count()).toBe(1); - }); - - it('matching child should be expanded initially', async () => { - let workitemname = {'title': 'child', 'type': 'Bug'}, - workItemTitle4 = {'title': 'Workitem_Title_4'}; - - await plannerSDD.sidePanel.clickWorkItemGroup('Requirements'); - await plannerSDD.workItemList.workItem(workItemTitle4.title).clickInlineQuickAdd(); - await plannerSDD.createInlineWorkItem(workitemname); - expect(await plannerSDD.workItemList.hasWorkItem(workitemname.title)).toBeTruthy(); - await plannerSDD.sidePanel.clickWorkItemGroup('Scenarios'); - await plannerSDD.waitUntilUrlContains('typegroup.name:Scenarios'); - await plannerSDD.sidePanel.clickWorkItemGroup('Requirements'); - await plannerSDD.waitUntilUrlContains('typegroup.name:Requirements'); - await plannerSDD.workItemList.overlay.untilHidden(); - expect(await plannerSDD.workItemList.hasWorkItem(workitemname.title)).toBeTruthy(); - }); -}); diff --git a/src/tests/specs/workItemTableTest.spec.ts b/src/tests/specs/workItemTableTest.spec.ts index 20d933708..371287f28 100644 --- a/src/tests/specs/workItemTableTest.spec.ts +++ b/src/tests/specs/workItemTableTest.spec.ts @@ -7,14 +7,12 @@ import { SidePanel } from './../ui/planner/sidepanel'; describe('Work Item datatable list: ', () => { let planner: PlannerPage; let c = new support.Constants(); - let testData; beforeAll(async () => { await support.desktopTestSetup(); planner = new PlannerPage(browser.baseUrl); await planner.openInBrowser(); await planner.waitUntilUrlContains('typegroup'); - testData = await c.browserName[browser.browserName]; }); beforeEach(async () => { @@ -52,8 +50,8 @@ describe('Work Item datatable list: ', () => { }); it('should filter work item by type', async () => { - await planner.header.selectFilter('Type', testData.type); - expect(await planner.header.getFilterConditions()).toContain(testData.workItemTypeFilter); + await planner.header.selectFilter('Type', c.type); + expect(await planner.header.getFilterConditions()).toContain(c.workItemTypeFilter); }); it('hideTree and create a work item then work item should be displayed when show tree is selected', async () => { @@ -75,7 +73,7 @@ describe('Work Item datatable list: ', () => { await planner.createWorkItem(newWorkItem); expect(await planner.workItemList.hasWorkItem(newWorkItem.title)).toBeTruthy(); await planner.workItemList.clickWorkItem(newWorkItem.title); - await planner.quickPreview.changeStateTo(testData.stateClosed); + await planner.quickPreview.changeStateTo(c.stateClosed); await planner.quickPreview.close(); await planner.header.clickShowCompleted(); expect(await planner.workItemList.hasWorkItem(newWorkItem.title, true)).toBeFalsy(); @@ -119,14 +117,14 @@ describe('Work Item datatable list: ', () => { newIteration1 = 'new Iteration 1', childWorkItem = { 'title': 'test list is not updated when new iteration is added', - 'type': testData.childType + 'type': c.childType }; expect(await planner.workItemList.hasWorkItem(title)).toBeTruthy(); await planner.workItemList.workItem(title).clickInlineQuickAdd(); await planner.createInlineWorkItem(childWorkItem); expect(await planner.workItemList.hasWorkItem(childWorkItem.title)).toBeTruthy(); await planner.sidePanel.createNewIteration(); - await planner.iteration.addNewIteration(newIteration1, testData.rootIteration); + await planner.iteration.addNewIteration(newIteration1, c.rootIteration); await planner.iteration.clickCreateIteration(); expect(await planner.workItemList.hasWorkItem(childWorkItem.title)).toBeTruthy(); }); @@ -136,7 +134,7 @@ describe('Work Item datatable list: ', () => { labelFilter = 'label: sample_label_1', workItemTitle = {'title': 'test clicking on label should filter the workitem list by label'}; - await planner.sidePanel.clickWorkItemGroup(testData.group2); + await planner.sidePanel.clickWorkItemGroup(); await planner.createWorkItem(workItemTitle); await planner.workItemList.clickWorkItem(workItemTitle.title); await planner.quickPreview.addLabel(label); @@ -149,17 +147,17 @@ describe('Work Item datatable list: ', () => { it('should update the workitem List on workitem edit', async () => { let workitem = {'title': 'TITLE_TEXT'}; - await planner.header.selectFilter('State', testData.stateNew); + await planner.header.selectFilter('State', c.stateNew); await planner.createWorkItem(workitem); await planner.workItemList.clickWorkItem(workitem.title); - await planner.quickPreview.changeStateTo(testData.stateOpen); + await planner.quickPreview.changeStateTo(c.stateOpen); await planner.quickPreview.close(); expect(await planner.workItemList.isTitleTextBold(workitem.title)).not.toContain('bold'); }); it('should make the title bold based on filter when adding a new workitem', async () => { let workitem = {'title': 'test title bold test'}; - await planner.header.selectFilter('State', testData.stateNew); + await planner.header.selectFilter('State', c.stateNew); await planner.createWorkItem(workitem); expect(await planner.workItemList.hasWorkItem(workitem.title)).toBeTruthy(); expect(await planner.workItemList.isTitleTextBold(workitem.title)).toContain('bold'); @@ -182,11 +180,11 @@ describe('Work Item datatable list: ', () => { await planner.createWorkItem(newWorkItem); expect(await planner.workItemList.hasWorkItem(newWorkItem.title)).toBeTruthy(); await planner.workItemList.clickWorkItem(newWorkItem.title); - await planner.quickPreview.changeStateTo(testData.stateClosed); + await planner.quickPreview.changeStateTo(c.stateClosed); await planner.quickPreview.close(); - await planner.header.selectFilter('State', testData.stateClosed); + await planner.header.selectFilter('State', c.stateClosed); await planner.workItemList.overlay.untilHidden(); - expect(await planner.header.getFilterConditions()).toContain(testData.filterLabel); + expect(await planner.header.getFilterConditions()).toContain(c.filterLabel); expect(await planner.workItemList.hasWorkItem(newWorkItem.title, true)).toBeTruthy(); }); }); diff --git a/src/tests/support/constants.ts b/src/tests/support/constants.ts index 5e7214572..85ec5ad6d 100644 --- a/src/tests/support/constants.ts +++ b/src/tests/support/constants.ts @@ -1,82 +1,35 @@ export class Constants { - browserName = { - 'browserSDD': { - 'areaTitle1': '/' + process.env.SPACE_NAME + '/Area_1', - 'areaTitle2': '/' + process.env.SPACE_NAME + '/Area_2', - 'childType': 'Experience', - 'commentCollaboratorTest' : 'Work Item 2', - 'dropdownareaTitle1': 'Area_1', - 'dropdownareaTitle2': 'Area_2', - 'dropdownIteration1': 'Iteration_1/Iteration1_1', - 'dropdownIteration_2': 'Iteration_2', - 'dropdownIteration2' : 'Iteration_1', - 'filterLabel': 'state: closed', - 'group1': 'Scenarios', - 'group2': 'Experiences', - 'group3': 'Requirements', - 'iteration1': '/' + process.env.SPACE_NAME + '/Iteration_1/Iteration1_1', - 'iteration2': '/' + process.env.SPACE_NAME + '/Iteration_2', - 'IterationTestTitle' : { - 'title': 'test list is not updated when new iteration is added', - 'type': 'Experience' - }, - 'rootIteration': '/' + process.env.SPACE_NAME, - 'newIteration': 'new Iteration', - 'newIteration1': 'new Iteration 1', - 'parentIteration': '/' + process.env.SPACE_NAME + '/Iteration_2', - 'searchWorkItem3': '2 - Workitem_Title_3', - 'searchWorkItem4': '3 - Workitem_Title_4', - 'type': ' Scenario', - 'stateOpen': 'open', - 'stateNew': 'new', - 'stateClosed': 'closed', - 'stateInProgress': 'in progress', - 'stateResolved': 'resolved', - 'typeIssue': 'Bug', - 'updateIteration' : 'Iteration_2123', - 'user1': process.env.USER_FULLNAME, - // Required since we need 2 users. Do not remove - 'user2': process.env.USER_FULLNAME, - 'Workitem_Title_3': '2 - Workitem_Title_3', - 'Workitem_Title_4': '3 - Workitem_Title_4', - 'workItemTypeFilter' : 'workitemtype: Scenario', - 'workitem': { title : 'new detail workItem', type: 'Scenario'}, - 'user_avatar': 'https://www.gravatar.com/avatar/f56b4884b4041f14b13d919008fd7d44.jpg&s=25' - }, - 'browserAgile': { - 'areaTitle1': '/' + process.env.SPACE_NAME_SCRUM + '/Area_6', - 'areaTitle2': '/' + process.env.SPACE_NAME_SCRUM + '/Area_7', - 'childType': 'Epic', - 'commentCollaboratorTest' : 'Work Item 1', - 'dropdownareaTitle1': 'Area_6', - 'dropdownareaTitle2': 'Area_7', - 'dropdownIteration1': 'Iteration_1/Iteration1_1', - 'dropdownIteration_2': 'Iteration_2', - 'dropdownIteration2' : 'Iteration_1', - 'filterLabel': 'state: Closed', - 'group1': 'Work Items', - 'group2': 'Work Items', - 'group3': 'Work Items', - 'iteration1': '/' + process.env.SPACE_NAME_SCRUM + '/Iteration_1/Iteration1_1', - 'iteration2': '/' + process.env.SPACE_NAME_SCRUM + '/Iteration_2', - 'newIteration': 'new Iteration', - 'newIteration1': 'new Iteration 1', - 'parentIteration': '/' + process.env.SPACE_NAME_SCRUM + '/Iteration_2', - 'rootIteration': '/' + process.env.SPACE_NAME_SCRUM, - 'stateOpen': 'Open', - 'stateNew': 'New', - 'stateClosed': 'Closed', - 'stateInProgress': 'In Progress', - 'stateResolved': 'Resolved', - 'type': ' Defect', - 'typeIssue': 'Defect', - // Required since we need 2 users. Do not remove - 'user2': process.env.USER_FULLNAME, - 'Workitem_Title_4': '4 - Workitem_Title_4', - 'Workitem_Title_3': '3 - Workitem_Title_3', - 'workitem': { title : 'new detail workItem', type: 'Task'}, - 'workItemTypeFilter' : 'workitemtype: Defect', - 'user_avatar': 'https://www.gravatar.com/avatar/f56b4884b4041f14b13d919008fd7d44.jpg&s=25' - } - }; + 'areaTitle1'= '/' + process.env.SPACE_NAME_SCRUM + '/Area_6'; + 'areaTitle2'= '/' + process.env.SPACE_NAME_SCRUM + '/Area_7'; + 'childType'= 'Epic'; + 'commentCollaboratorTest' = 'Work Item 1'; + 'dropdownareaTitle1'= 'Area_6'; + 'dropdownareaTitle2'= 'Area_7'; + 'dropdownIteration1'= 'Iteration_1/Iteration1_1'; + 'dropdownIteration_2'= 'Iteration_2'; + 'dropdownIteration2' = 'Iteration_1'; + 'filterLabel'= 'state: Closed'; + 'group1'= 'Work Items'; + 'group2'= 'Work Items'; + 'group3'= 'Work Items'; + 'iteration1'= '/' + process.env.SPACE_NAME_SCRUM + '/Iteration_1/Iteration1_1'; + 'iteration2'= '/' + process.env.SPACE_NAME_SCRUM + '/Iteration_2'; + 'newIteration'= 'new Iteration'; + 'newIteration1'= 'new Iteration 1'; + 'parentIteration'= '/' + process.env.SPACE_NAME_SCRUM + '/Iteration_2'; + 'rootIteration'= '/' + process.env.SPACE_NAME_SCRUM; + 'stateOpen'= 'Open'; + 'stateNew'= 'New'; + 'stateClosed'= 'Closed'; + 'stateInProgress'= 'In Progress'; + 'stateResolved'= 'Resolved'; + 'type'= ' Defect'; + 'typeIssue'= 'Defect'; + // Required since we need 2 users. Do not remove + 'user2'= process.env.USER_FULLNAME; + 'Workitem_Title_4'= '4 - Workitem_Title_4'; + 'Workitem_Title_3'= '3 - Workitem_Title_3'; + 'workitem'= { title : 'new detail workItem', type : 'Task'}; + 'workItemTypeFilter' = 'workitemtype: Defect'; + 'user_avatar'= 'https=//www.gravatar.com/avatar/f56b4884b4041f14b13d919008fd7d44.jpg&s=25'; } diff --git a/src/tests/ui/planner/sidepanel.ts b/src/tests/ui/planner/sidepanel.ts index 5bd72272f..a609baef2 100644 --- a/src/tests/ui/planner/sidepanel.ts +++ b/src/tests/ui/planner/sidepanel.ts @@ -34,30 +34,13 @@ export class SidePanel extends ui.BaseElement { support.debug('... check if Side panel is Ready'); await super.ready(); await this.showHideSidePanelButton.ready(); - if ((browser.browserName) === 'browserSDD') { - await this.scenarioButton.ready(); - await this.experienceButton.ready(); - await this.requirementsButton.ready(); - } else if ((browser.browserName) === 'browserAgile') { - await this.workItemsGroupAgile.ready(); - } + await this.workItemsGroupAgile.ready(); await this.createIterationButton.ready(); support.debug('... check if Side panel is Ready - OK'); } - async clickWorkItemGroup(group: workItemGroup) { - switch (group) { - case 'Scenarios' : - await this.scenarioButton.clickWhenReady(); break; - case 'Experiences': - await this.experienceButton.clickWhenReady(); break; - case 'Requirements': - await this.requirementsButton.clickWhenReady(); break; - case 'Work Items': - await this.workItemsGroupAgile.clickWhenReady(); break; - default: - support.debug('Work Item group not defined'); break; - } + async clickWorkItemGroup() { + await this.workItemsGroupAgile.clickWhenReady(); await this.workItemList.overlay.untilHidden(); } diff --git a/tests/protractor.conf.ts b/tests/protractor.conf.ts index 849bf8e80..d50f02476 100644 --- a/tests/protractor.conf.ts +++ b/tests/protractor.conf.ts @@ -49,44 +49,18 @@ let conf: Config = { fullTest: ['specs/**/*.spec.js'] }, - //launch 2 chrome instances - multiCapabilities: [ - { - 'browserName': 'chrome', - exclude: ['specs/templateSpecificTests/agileTemplate.spec.js'], - chromeOptions: { - args: process.env.HEADLESS_MODE === 'true' ? ['--no-sandbox', '--headless'] : ['--no-sandbox'] - }, - name: 'browserSDD' - }, - { - 'browserName': 'chrome', - exclude: ['specs/templateSpecificTests/sddTemplate.spec.js', 'specs/collaboratorTest.spec.js'], - chromeOptions: { - args: process.env.HEADLESS_MODE === 'true' ? ['--no-sandbox', '--headless'] : ['--no-sandbox'] - }, - name: 'browserAgile' - } - ], + //launch chrome instance + capabilities: { + browserName: 'chrome', + chromeOptions: { + args: process.env.HEADLESS_MODE === 'true' ? ['--no-sandbox', '--headless'] : ['--no-sandbox'] + }, + name: 'browserAgile' + }, // Assign the test reporter to each running instance onPrepare: function() { validate_config(); - browser.getProcessedConfig().then(function(config) { - switch (config.capabilities.name) { - case 'browserSDD': - browser.baseUrl = browser.baseUrl + '/' + process.env.USER_NAME + '/' + process.env.SPACE_NAME + '/plan'; - break; - case 'browserAgile': - browser.baseUrl = browser.baseUrl + '/' + process.env.USER_NAME + '/' + process.env.SPACE_NAME_SCRUM + '/plan'; - break; - default: - new Error('browser.baseUrl undefined'); - break; - } - // required to get the name of browser running tests for SDD or Agile template - browser.browserName = config.capabilities.name; - }); jasmine.getEnv().addReporter( new SpecReporter({ spec: { @@ -100,6 +74,7 @@ let conf: Config = { ); // Disable control flow browser.ignoreSynchronization = true; + browser.baseUrl = browser.baseUrl + '/' + process.env.USER_NAME + '/' + process.env.SPACE_NAME_SCRUM + '/plan'; browser.token = encodeURIComponent(JSON.stringify({ access_token: process.env.AUTH_TOKEN, expires_in: 1800,