Skip to content

Commit

Permalink
hotfix: fix failing test (#4483)
Browse files Browse the repository at this point in the history
* hotfix: fix failing test

* fixed lint error
  • Loading branch information
nursoltan-s committed Sep 6, 2021
1 parent ad35f19 commit 21eabe9
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,6 @@ export class ProjectMilestonePageObject {
return ElementHelper.getElementByXPath('//h2/button');
}

/**
* Get Action Row's first columns
*/
public async actionRow() {
const els = await ElementHelper.getAllElementsByClassName('_2BPUCg');
return els[0];
}

/**
* Get Save button
*/
public async saveButton() {
const actionRow = await this.actionRow();
return ElementHelper.getElementByCss("button[type='submit']", actionRow);
}

/**
* Get Milestone SelectAll Checkbox
*/
Expand Down Expand Up @@ -195,13 +179,36 @@ export class ProjectMilestonePageObject {
return ElementHelper.getAllElementsByXPath('//div[contains(@class, "react-select__option")]');
}

/**
* Get project title
*/
public get projectTitle() {
return ElementHelper.getElementByClassName("project-card")
}

public milestoneListXpath = '//div[contains(@class , "react-select__menu-list")]';
public addNewMilestoneXpath = '(//button[contains(@class,"tc-btn-primary tc-btn-sm")])[INDEX]';
public copilotImageXpath = `//td[contains(text(), "MILESTONE_NAME")]//ancestor::tr//img`;
public copilotManagementWindowTitleXpath = '//div[@class="right-sidebar-container"]//h2';
public milestoneStatusXpath = '//td[text()="MILESTONE_NAME"]//following-sibling::td/span';
public actionButtonForCustomerXpath = "//span[.= 'In Review']/parent::td/following-sibling::td//button[contains(@class, '#')]" // assumes action buttons are available for customers for milestone in review status.

/**
* Get Action Row's first columns
*/
public async actionRow() {
const els = await ElementHelper.getAllElementsByClassName('_2BPUCg');
return els[0];
}

/**
* Get Save button
*/
public async saveButton() {
const actionRow = await this.actionRow();
return ElementHelper.getElementByCss("button[type='submit']", actionRow);
}

/**
* Get Add Copilot Button
*
Expand Down Expand Up @@ -288,13 +295,6 @@ export class ProjectMilestonePageObject {
return ElementHelper.getElementByXPath("//div[@class='_309UjB']")
}

/**
* Get project title
*/
public get projectTitle() {
return ElementHelper.getElementByClassName("project-card")
}

/**
* @returns **dismiss button** for all milestone approved notification
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export class ProjectSettingsPageHelper {
await CommonHelper.waitForPageDisplayed();
await CommonHelper.waitForElementToGetDisplayed(this.projectSettingsPageObject.getProjectMenu('Project Settings'));

// If alert dialog appears, close it
await this.checkAlertDialog();

await this.projectSettingsPageObject.getProjectMenu('Project Settings').click();

// Waiting for page to get loaded
Expand Down Expand Up @@ -432,4 +435,13 @@ export class ProjectSettingsPageHelper {
}

private static projectSettingsPageObject: ProjectSettingsPageObject;

/**
* Check to see if there is error dialog, If so close it
*/
private static async checkAlertDialog() {
if (await this.projectSettingsPageObject.closeIcon.isPresent()) {
await this.projectSettingsPageObject.closeIcon.click();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,8 @@ export class ProjectSettingsPageObject {
public get noAccountAvailableLabel() {
return ElementHelper.getElementByXPath('(//div[@class="container"]//div[contains(@class,"react-select__placeholder")])[1]');
}

public get closeIcon() {
return ElementHelper.getElementByClassName("s-alert-close");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Connect App - Verify Customer Role Tests:', () => {
await ProjectMilestonePageHelper.open();
});

it('[TC_001] Should verify user can approve the milestone for Customer role', async () => {
it('[TC_005] Should verify user can approve the milestone for Customer role', async () => {
const customerUser = ConfigHelper.getCustomerUser();
const copilotUser = ConfigHelper.getCopilotUser();
await ProjectMilestonePageHelper.takeActionOnMilestone(testData.projectMilestone, customerUser, copilotUser)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Connect App - Verify Customer Role Tests:', () => {
await ProjectMilestonePageHelper.open();
});

it('[TC_001] Should verify Add Milestone button and Draft Milestone should not be displayed for customer role.', async () => {
it('[TC_004] Should verify Add Milestone button and Draft Milestone should not be displayed for customer role.', async () => {
const customerUser = ConfigHelper.getCustomerUser();
await ProjectMilestonePageHelper.verifyAddMilestoneButtonAndDraftMilestoneShouldNotBeDisplayed(testData.projectMilestone, customerUser);
});
Expand Down

0 comments on commit 21eabe9

Please sign in to comment.