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

Commit

Permalink
test: Updated tests to be in synch with UI changes - 9 tests are fial…
Browse files Browse the repository at this point in the history
…ing due to issue: 1071
  • Loading branch information
ldimaggi authored and joshuawilson committed Mar 6, 2017
1 parent d14af50 commit c01f98a
Show file tree
Hide file tree
Showing 21 changed files with 85 additions and 12 deletions.
2 changes: 1 addition & 1 deletion protractor.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ exports.config = {
getPageTimeout: 30000,
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['src/tests/**/*.spec.js'],
exclude: ['src/tests/**/TBD/*.spec.js', 'src/tests/**/orderOfExecution.spec.js', 'src/tests/**/work-item-timeStamp.spec.js'],
exclude: ['src/tests/**/TBD/*.spec.js', 'src/tests/**/orderOfExecution.spec.js', 'src/tests/**/work-item-timeStamp.spec.js', 'src/tests/**/testHelpers*.spec.js'],
suites: {
smokeTest: 'src/tests/**/smokeTest.spec.js'
},
Expand Down
8 changes: 7 additions & 1 deletion src/tests/work-item/work-item-list/assign.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ describe('Work item list', function () {

beforeEach(function () {
testSupport.setBrowserMode('desktop');
// browser.ignoreSynchronization = true;
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
browser.wait(until.elementToBeClickable(page.firstWorkItem), constants.WAIT, 'Failed to find first work item');
});

/**Test searching user in the assignee drop down */
Expand Down Expand Up @@ -94,6 +95,7 @@ describe('Work item list', function () {
browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeIcon), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.clickworkItemDetailAssigneeIcon();

browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeSearch), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.setWorkItemDetailAssigneeSearch("Example User 1",false);
detailPage.clickAssignedUserDropDownList("Example User 1");
expect(detailPage.details_assigned_user().getText()).toContain("Example User 1");
Expand All @@ -117,6 +119,7 @@ describe('Work item list', function () {
browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeIcon), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.clickworkItemDetailAssigneeIcon();

browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeSearch), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.setWorkItemDetailAssigneeSearch("Example User 1",false);
detailPage.clickAssignedUserDropDownList("Example User 1");
expect(detailPage.details_assigned_user().getText()).toContain("Example User 1");
Expand All @@ -140,6 +143,7 @@ describe('Work item list', function () {
browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeIcon), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.clickworkItemDetailAssigneeIcon();

browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeSearch), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.setWorkItemDetailAssigneeSearch("Example User 1",false);
detailPage.clickAssignedUserDropDownList("Example User 1");
expect(detailPage.details_assigned_user().getText()).toContain("Example User 1");
Expand Down Expand Up @@ -167,6 +171,7 @@ describe('Work item list', function () {
browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeIcon), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.clickworkItemDetailAssigneeIcon();

browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeSearch), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.setWorkItemDetailAssigneeSearch("Example User 1",false);
detailPage.clickAssignedUserDropDownList("Example User 1");
expect(detailPage.details_assigned_user().getText()).toContain("Example User 1");
Expand All @@ -193,6 +198,7 @@ describe('Work item list', function () {
browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeIcon), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.clickworkItemDetailAssigneeIcon();

browser.wait(until.elementToBeClickable(detailPage.workItemDetailAssigneeSearch), constants.WAIT, 'Failed to find Assignee Icon');
detailPage.setWorkItemDetailAssigneeSearch("Example User 2",false);
detailPage.clickAssignedUserDropDownList("Example User 2");
expect(detailPage.details_assigned_user().getText()).toContain("Example User 2");
Expand Down
4 changes: 2 additions & 2 deletions src/tests/work-item/work-item-list/basicDragAndDrop.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ describe('Drag and drop Test', function () {

beforeEach(function () {
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);

page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
});

it('should drag and drop the source into into the target position - phone.', function() {
Expand Down
1 change: 1 addition & 0 deletions src/tests/work-item/work-item-list/comments.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var waitTime = 30000;
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);
detailPage = new WorkItemDetailPage(true);
testSupport.setTestSpace(page);
});
it('Verify comments text area, username, comment,time is present -desktop ', function() {
page.clickWorkItemTitle(page.firstWorkItem, "id0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var waitTime = 30000;

testSupport.setBrowserMode('phone');
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
});

/* Create a new workitem, fill in the details, save, retrieve, update, save, verify updates are saved */
Expand Down Expand Up @@ -416,6 +417,8 @@ it('Verify how many work item type exists in drop down - desktop', function() {
expect(page.workItemTitle(page.firstWorkItem)).toBe(workItemTitle);
page.workItemViewId(page.workItemByTitle(workItemTitle)).getText().then(function (text) {
var detailPage = page.clickWorkItemTitle(page.firstWorkItem, text);

browser.wait(until.elementToBeClickable(detailPage.workItemStateDropDownButton), constants.WAIT, 'Failed to find workItemStateDropDownButton');
detailPage.clickWorkItemStateDropDownButton();
var wi_state = ["new", "open", "in progress","resolved","closed"];
var itr=1;
Expand All @@ -436,6 +439,8 @@ it('Verify how many work item type exists in drop down - desktop', function() {
page.clickQuickAddSave().then(function() {
page.workItemViewId(page.workItemByTitle(workItemTitle)).getText().then(function (text) {
var detailPage = page.clickWorkItemTitle(page.firstWorkItem, text);

browser.wait(until.elementToBeClickable(detailPage.workItemStateDropDownButton), constants.WAIT, 'Failed to find workItemStateDropDownButton');
detailPage.clickWorkItemStateDropDownButton();
detailPage.WorkItemStateDropDownList().get(0).click();
detailPage.clickWorkItemDetailCloseButton();
Expand All @@ -452,10 +457,12 @@ it('Verify how many work item type exists in drop down - desktop', function() {
page.typeQuickAddWorkItemTitle(workItemTitle);
page.clickQuickAddSave().then(function() {

browser.wait(until.elementToBeClickable(page.workItemTitle(page.firstWorkItem)), constants.WAIT, 'Failed to find Assignee Icon');
browser.wait(until.elementToBeClickable(page.workItemTitle(page.firstWorkItem)), constants.WAIT, 'Failed to find firstWorkItem');

page.workItemViewId(page.workItemByTitle(workItemTitle)).getText().then(function (text) {
var detailPage = page.clickWorkItemTitle(page.firstWorkItem, text);

browser.wait(until.elementToBeClickable(detailPage.workItemStateDropDownButton), constants.WAIT, 'Failed to find workItemStateDropDownButton');
detailPage.clickWorkItemStateDropDownButton();
detailPage.WorkItemStateDropDownList().get(1).click();
detailPage.clickWorkItemDetailCloseButton();
Expand All @@ -473,6 +480,8 @@ it('Verify how many work item type exists in drop down - desktop', function() {
page.clickQuickAddSave().then(function() {
page.workItemViewId(page.workItemByTitle(workItemTitle)).getText().then(function (text) {
var detailPage = page.clickWorkItemTitle(page.firstWorkItem, text);

browser.wait(until.elementToBeClickable(detailPage.workItemStateDropDownButton), constants.WAIT, 'Failed to find workItemStateDropDownButton');
detailPage.clickWorkItemStateDropDownButton();
detailPage.WorkItemStateDropDownList().get(2).click();
detailPage.clickWorkItemDetailCloseButton();
Expand All @@ -490,6 +499,8 @@ it('Verify how many work item type exists in drop down - desktop', function() {
page.clickQuickAddSave().then(function() {
page.workItemViewId(page.workItemByTitle(workItemTitle)).getText().then(function (text) {
var detailPage = page.clickWorkItemTitle(page.firstWorkItem, text);

browser.wait(until.elementToBeClickable(detailPage.workItemStateDropDownButton), constants.WAIT, 'Failed to find workItemStateDropDownButton');
detailPage.clickWorkItemStateDropDownButton();
detailPage.WorkItemStateDropDownList().get(3).click();
detailPage.clickWorkItemDetailCloseButton();
Expand All @@ -507,6 +518,8 @@ it('Verify how many work item type exists in drop down - desktop', function() {
page.clickQuickAddSave().then(function() {
page.workItemViewId(page.workItemByTitle(workItemTitle)).getText().then(function (text) {
var detailPage = page.clickWorkItemTitle(page.firstWorkItem, text);

browser.wait(until.elementToBeClickable(detailPage.workItemStateDropDownButton), constants.WAIT, 'Failed to find workItemStateDropDownButton');
detailPage.clickWorkItemStateDropDownButton();
detailPage.WorkItemStateDropDownList().get(4).click();
detailPage.clickWorkItemDetailCloseButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ describe('Work item list', function () {

beforeEach(function () {
testSupport.setBrowserMode('phone');
page = new WorkItemListPage(true);
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);

workItemMockData = {
pageTitle:'Title Text 0 Details',
Expand Down
1 change: 1 addition & 0 deletions src/tests/work-item/work-item-list/iteration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var waitTime = 30000;
beforeEach(function () {
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
});
it('Verify Iteration add button and label are clickable + dialoge label is present -phone ', function() {
expect(page.iterationAddButton().isPresent()).toBe(true);
Expand Down
17 changes: 14 additions & 3 deletions src/tests/work-item/work-item-list/linkItem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,26 @@

var WorkItemListPage = require('./page-objects/work-item-list.page'),
testSupport = require('./testSupport'),
constants = require('./constants'),
WorkItemDetailPage = require('./page-objects/work-item-detail.page');

describe('Link item ', function () {
var page, items, browserMode;
var until = protractor.ExpectedConditions;

beforeEach(function () {
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);
// detailPage = new WorkItemDetailPage();
// detailPage = new WorkItemDetailPage();
testSupport.setTestSpace(page);
});

it('Create a link item planner to planner - Desktop', function () {
var detailPage = page.clickWorkItemTitle(page.workItemByTitle("Title Text 3"), "id3");
expect(detailPage.commentDiv().isPresent()).toBe(true);
expect(detailPage.linkItemHeaderCaret().isPresent()).toBe(true);

browser.wait(until.elementToBeClickable(detailPage.linkItemHeaderCaret()), constants.WAIT, 'Link icon is not clickable');
detailPage.linkItemHeaderCaret().click();
detailPage.clickCreateLinkButton();
detailPage.clickLinkDropDown();
Expand All @@ -49,6 +54,8 @@ describe('Link item ', function () {
var detailPage = page.clickWorkItemTitle(page.workItemByTitle("Title Text 0"), "id0");
expect(detailPage.commentDiv().isPresent()).toBe(true);
expect(detailPage.linkItemHeaderCaret().isPresent()).toBe(true);

browser.wait(until.elementToBeClickable(detailPage.linkItemHeaderCaret()), constants.WAIT, 'Link icon is not clickable');
detailPage.linkItemHeaderCaret().click();
/**Below commented code works fine with the Chrome not with PhantomJS
* Issue : https://github.com/fabric8io/fabric8-planner/issues/319
Expand All @@ -61,7 +68,9 @@ describe('Link item ', function () {
it('Delete link and check if it exists in list or not - Desktop', function () {
var detailPage = page.clickWorkItemTitle(page.workItemByTitle("Title Text 0"), "id0");
expect(detailPage.commentDiv().isPresent()).toBe(true);
expect(detailPage.linkItemHeaderCaret().isPresent()).toBe(true);
expect(detailPage.linkItemHeaderCaret().isPresent()).toBe(true);

browser.wait(until.elementToBeClickable(detailPage.linkItemHeaderCaret()), constants.WAIT, 'Link icon is not clickable');
detailPage.linkItemHeaderCaret().click();
/**Below commented code works fine with the Chrome not with PhantomJS
* Issue : https://github.com/fabric8io/fabric8-planner/issues/319
Expand Down Expand Up @@ -96,7 +105,9 @@ describe('Link item ', function () {
it('Check the elements of link item div are visible - Desktop', function () {
var detailPage = page.clickWorkItemTitle(page.workItemByTitle("Title Text 0"), "id0");
expect(detailPage.commentDiv().isPresent()).toBe(true);
expect(detailPage.linkItemHeaderCaret().isPresent()).toBe(true);
expect(detailPage.linkItemHeaderCaret().isPresent()).toBe(true);

browser.wait(until.elementToBeClickable(detailPage.linkItemHeaderCaret()), constants.WAIT, 'Link icon is not clickable');
detailPage.linkItemHeaderCaret().click();
// expect(detailPage.linkItemTitle()).toBe("This item, Title Text 0");
// expect(detailPage.checkLinkDropDown.isPresent()).toBe(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ defaultWorkitemsPhantomJS = [
beforeEach(function () {
testSupport.setBrowserMode('phone');
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
});

it('should move workitem down/up - phone.', function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ class WorkItemDetailPage {
return element(by.xpath('.//*[@id="wi-detail-form"]/fieldset/div[2]/div[2]/div/ul/li['+typeString+']/a/span[2]')).getText();
}

get workItemStateDropDownButton () {
return element(by.id("wi-detail-state"));
}

clickWorkItemStateDropDownButton () {
return element(by.id("wi-detail-state")).click();
}
Expand Down Expand Up @@ -501,7 +505,7 @@ class WorkItemDetailPage {
return this.startCodingElement.click();
}
startCodingDiv (){
return element(by.css(".start-coding"));
return element(by.id("start-coding-link"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ class WorkItemListPage {
browser.get("http://localhost:8088/");
}
};

/* Select the space in which the tests will be run */
get spaceDropdown (){
return element(by.css(".ng-valid"));
}
clickOnSpaceDropdown (){
return this.spaceDropdown.click();
}
selectSpaceDropDownValue (index) {
index++;
return element(by.xpath("//select[contains(@class,'ng-valid')]/option[" + index + "]")).click();
}

workItemByURLId (workItemId) {
browser.get("http://localhost:8088/work-item/list/detail/"+ workItemId);
var theDetailPage = new WorkItemDetailPage (workItemId);
Expand Down
5 changes: 5 additions & 0 deletions src/tests/work-item/work-item-list/quickadd-workitem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ describe('Work item list', function () {
var page, items, browserMode;
var char255 = '<div *ngFor=let comment of workItem.relationalData.comments; let counter = index" class="comments-wrap"> + <div *ngFor="let comment of workItem.relationalData?.comments?.slice().reverse()" class="comments-wrap"> <div> <div class="user-avatar pull-left"> <img id="{{"comment_avatar_" + counter}}" - class="user-assign-avatar pull-left" + />';
var char255Expected = '<div *ngFor=let comment of workItem.relationalData.comments; let counter = index" class="comments-wrap"> + <div *ngFor="let comment of workItem.relationalData?.comments?.slice().reverse()" class="comments-wrap"> <div> <div class="user-avatar pull-left"> <img id="{{"comment_avatar_" + counter}}" - class="user-assign-avatar pull-left" + />';
var until = protractor.ExpectedConditions;

beforeEach(function () {
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
});

it('Creating a new quick add work item and delete - desktop.', function () {
Expand All @@ -37,6 +40,7 @@ describe('Work item list', function () {
page.clickWorkItemKebabButton(page.firstWorkItem);
page.clickWorkItemKebabDeleteButton(page.firstWorkItem);
page.clickWorkItemPopUpDeleteConfirmButton().then(function() {
browser.wait(until.textToBePresentInElement((page.firstWorkItem), "Title Text" ), 60000, 'Failed to find text in workitem');
expect(page.workItemTitle(page.firstWorkItem)).not.toBe('Quick Add and Delete');
expect(page.workItemTitle(page.workItemByNumber(0))).not.toBe('Quick Add and Delete');
});
Expand All @@ -53,6 +57,7 @@ describe('Work item list', function () {
page.clickWorkItemKebabButton(page.firstWorkItem);
page.clickWorkItemKebabDeleteButton(page.firstWorkItem);
page.clickWorkItemPopUpDeleteCancelConfirmButton().then(function() {
browser.wait(until.textToBePresentInElement((page.firstWorkItem), char255Expected), constants.WAIT, 'Failed to text in workitem');
expect(page.workItemTitle(page.firstWorkItem)).toBe(char255Expected);
expect(page.workItemTitle(page.workItemByNumber(0))).toBe(char255Expected);
});
Expand Down
2 changes: 2 additions & 0 deletions src/tests/work-item/work-item-list/smokeTest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('Work item list', function () {
beforeEach(function () {
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
});

/* User can read, update, remove assignee on a workitem */
Expand Down Expand Up @@ -159,6 +160,7 @@ describe('Work item list', function () {
var detailPage = page.clickWorkItemTitle(page.firstWorkItem, "Title Text 0");
browser.wait(until.elementToBeClickable(page.firstWorkItem), constants.WAIT, 'Failed to find workItem');
expect(detailPage.getCreatedtime()).toBe('a few seconds ago');
browser.wait(until.elementToBeClickable(detailPage.workItemDetailCloseButton), constants.WAIT, 'Failed to find close workItem detail page');
detailPage.clickWorkItemDetailCloseButton();

// detailPage = page.workItemByURLId("id1");
Expand Down
1 change: 1 addition & 0 deletions src/tests/work-item/work-item-list/startcoding.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var waitTime = 30000;
beforeEach(function () {
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
});
it('Verify start coding is visible when code base is presrent - Desktop', function () {
var detailPage = page.clickWorkItemTitle(page.workItemByTitle("Title Text 0"), "id0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('Work item list', function () {
beforeEach(function () {
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
});

it('Quick Create workitem', function () {
Expand Down
8 changes: 8 additions & 0 deletions src/tests/work-item/work-item-list/testSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ module.exports = {
}
},

/**
* Set the windows in which the tests will run
*/
setTestSpace: function (page) {
page.clickOnSpaceDropdown();
page.selectSpaceDropDownValue("1");
},

/**
* Write screenshot to file
* Example usage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('Work item list', function () {
testSupport.setBrowserMode('phone');
page = new WorkItemListPage(false);
detailPage=new WorkItemDetailPage(1);
testSupport.setTestSpace(page);
});

/*Test Quick add work item should not be visible*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('Work item list', function () {
beforeEach(function () {
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);
});

it('Create WorkItem and creatorname and image is relecting', function () {
Expand Down
3 changes: 2 additions & 1 deletion src/tests/work-item/work-item-list/work-item-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ describe('Work item list', function () {
beforeEach(function () {
testSupport.setBrowserMode('phone');
browser.ignoreSynchronization = true;
page = new WorkItemListPage(true);
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);

workItemMockData = {
pageTitle:'Title Text 0 Details',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ describe('Work item list', function () {
detailPage = new WorkItemDetailPage();
beforeEach(function () {
testSupport.setBrowserMode('desktop');
page = new WorkItemListPage(true);
page = new WorkItemListPage(true);
testSupport.setTestSpace(page);

});

Expand Down
Loading

0 comments on commit c01f98a

Please sign in to comment.