Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
fix(tests): remove sdd template tests (#2810)
Browse files Browse the repository at this point in the history
  • Loading branch information
divyanshiGupta authored and nimishamukherjee committed Dec 3, 2018
1 parent 3b9baa5 commit a49d68d
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 287 deletions.
7 changes: 3 additions & 4 deletions src/tests/mixins/logging.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { browser } from 'protractor';
import { debug, info } from '../support';

export class Logging {
name: string = '';

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');
}
}
9 changes: 1 addition & 8 deletions src/tests/page_objects/planner/planner.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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: ', () => {
Expand Down
7 changes: 3 additions & 4 deletions src/tests/specs/collaboratorTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand All @@ -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();
});

Expand All @@ -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);
});
Expand Down
28 changes: 13 additions & 15 deletions src/tests/specs/detailPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -58,17 +56,17 @@ 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 () => {
let workItemTitle2 = 'Workitem_Title_2';
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 () => {
Expand All @@ -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 () => {
Expand All @@ -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');
});
Expand All @@ -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 () => {
Expand All @@ -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);
});
});
6 changes: 2 additions & 4 deletions src/tests/specs/iteration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
});
});
4 changes: 1 addition & 3 deletions src/tests/specs/query-tab.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
23 changes: 13 additions & 10 deletions src/tests/specs/quickPreview.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand All @@ -72,29 +70,34 @@ 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();
expect(await planner.quickPreview.assigneeDropdownMenu.getAttribute('className')).not.toContain('show');
});

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');
Expand Down
38 changes: 18 additions & 20 deletions src/tests/specs/smoke/smokeTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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();
Expand All @@ -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();
});

Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
Loading

0 comments on commit a49d68d

Please sign in to comment.