Skip to content

Commit 21eabe9

Browse files
authored
hotfix: fix failing test (#4483)
* hotfix: fix failing test * fixed lint error
1 parent ad35f19 commit 21eabe9

File tree

5 files changed

+41
-25
lines changed

5 files changed

+41
-25
lines changed

connect-automation/page-objects/project-milestone/project-milestone.po.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,6 @@ export class ProjectMilestonePageObject {
9595
return ElementHelper.getElementByXPath('//h2/button');
9696
}
9797

98-
/**
99-
* Get Action Row's first columns
100-
*/
101-
public async actionRow() {
102-
const els = await ElementHelper.getAllElementsByClassName('_2BPUCg');
103-
return els[0];
104-
}
105-
106-
/**
107-
* Get Save button
108-
*/
109-
public async saveButton() {
110-
const actionRow = await this.actionRow();
111-
return ElementHelper.getElementByCss("button[type='submit']", actionRow);
112-
}
113-
11498
/**
11599
* Get Milestone SelectAll Checkbox
116100
*/
@@ -195,13 +179,36 @@ export class ProjectMilestonePageObject {
195179
return ElementHelper.getAllElementsByXPath('//div[contains(@class, "react-select__option")]');
196180
}
197181

182+
/**
183+
* Get project title
184+
*/
185+
public get projectTitle() {
186+
return ElementHelper.getElementByClassName("project-card")
187+
}
188+
198189
public milestoneListXpath = '//div[contains(@class , "react-select__menu-list")]';
199190
public addNewMilestoneXpath = '(//button[contains(@class,"tc-btn-primary tc-btn-sm")])[INDEX]';
200191
public copilotImageXpath = `//td[contains(text(), "MILESTONE_NAME")]//ancestor::tr//img`;
201192
public copilotManagementWindowTitleXpath = '//div[@class="right-sidebar-container"]//h2';
202193
public milestoneStatusXpath = '//td[text()="MILESTONE_NAME"]//following-sibling::td/span';
203194
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.
204195

196+
/**
197+
* Get Action Row's first columns
198+
*/
199+
public async actionRow() {
200+
const els = await ElementHelper.getAllElementsByClassName('_2BPUCg');
201+
return els[0];
202+
}
203+
204+
/**
205+
* Get Save button
206+
*/
207+
public async saveButton() {
208+
const actionRow = await this.actionRow();
209+
return ElementHelper.getElementByCss("button[type='submit']", actionRow);
210+
}
211+
205212
/**
206213
* Get Add Copilot Button
207214
*
@@ -288,13 +295,6 @@ export class ProjectMilestonePageObject {
288295
return ElementHelper.getElementByXPath("//div[@class='_309UjB']")
289296
}
290297

291-
/**
292-
* Get project title
293-
*/
294-
public get projectTitle() {
295-
return ElementHelper.getElementByClassName("project-card")
296-
}
297-
298298
/**
299299
* @returns **dismiss button** for all milestone approved notification
300300
*/

connect-automation/page-objects/project-settings/project-settings.helper.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export class ProjectSettingsPageHelper {
2727
await CommonHelper.waitForPageDisplayed();
2828
await CommonHelper.waitForElementToGetDisplayed(this.projectSettingsPageObject.getProjectMenu('Project Settings'));
2929

30+
// If alert dialog appears, close it
31+
await this.checkAlertDialog();
32+
3033
await this.projectSettingsPageObject.getProjectMenu('Project Settings').click();
3134

3235
// Waiting for page to get loaded
@@ -432,4 +435,13 @@ export class ProjectSettingsPageHelper {
432435
}
433436

434437
private static projectSettingsPageObject: ProjectSettingsPageObject;
438+
439+
/**
440+
* Check to see if there is error dialog, If so close it
441+
*/
442+
private static async checkAlertDialog() {
443+
if (await this.projectSettingsPageObject.closeIcon.isPresent()) {
444+
await this.projectSettingsPageObject.closeIcon.click();
445+
}
446+
}
435447
}

connect-automation/page-objects/project-settings/project-settings.po.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,4 +404,8 @@ export class ProjectSettingsPageObject {
404404
public get noAccountAvailableLabel() {
405405
return ElementHelper.getElementByXPath('(//div[@class="container"]//div[contains(@class,"react-select__placeholder")])[1]');
406406
}
407+
408+
public get closeIcon() {
409+
return ElementHelper.getElementByClassName("s-alert-close");
410+
}
407411
}

connect-automation/test-suites/milestone-flow/verify-customer-approveMilestone.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Connect App - Verify Customer Role Tests:', () => {
2525
await ProjectMilestonePageHelper.open();
2626
});
2727

28-
it('[TC_001] Should verify user can approve the milestone for Customer role', async () => {
28+
it('[TC_005] Should verify user can approve the milestone for Customer role', async () => {
2929
const customerUser = ConfigHelper.getCustomerUser();
3030
const copilotUser = ConfigHelper.getCopilotUser();
3131
await ProjectMilestonePageHelper.takeActionOnMilestone(testData.projectMilestone, customerUser, copilotUser)

connect-automation/test-suites/milestone-flow/verify-customer-role.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Connect App - Verify Customer Role Tests:', () => {
2525
await ProjectMilestonePageHelper.open();
2626
});
2727

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

0 commit comments

Comments
 (0)