From c0d6914631096975b5b0022c8429b1280357a555 Mon Sep 17 00:00:00 2001 From: "Nursoltan Saipolda (Topcoder)" Date: Mon, 6 Sep 2021 00:23:31 +0800 Subject: [PATCH 1/2] hotfix: fix failing test --- .../project-settings/project-settings.helper.ts | 12 ++++++++++++ .../project-settings/project-settings.po.ts | 4 ++++ .../verify-customer-approveMilestone.spec.ts | 2 +- .../milestone-flow/verify-customer-role.spec.ts | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/connect-automation/page-objects/project-settings/project-settings.helper.ts b/connect-automation/page-objects/project-settings/project-settings.helper.ts index 3d1a839ed..141990168 100644 --- a/connect-automation/page-objects/project-settings/project-settings.helper.ts +++ b/connect-automation/page-objects/project-settings/project-settings.helper.ts @@ -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 @@ -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(); + } + } } diff --git a/connect-automation/page-objects/project-settings/project-settings.po.ts b/connect-automation/page-objects/project-settings/project-settings.po.ts index 0941fce57..0234efc9e 100644 --- a/connect-automation/page-objects/project-settings/project-settings.po.ts +++ b/connect-automation/page-objects/project-settings/project-settings.po.ts @@ -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"); + } } \ No newline at end of file diff --git a/connect-automation/test-suites/milestone-flow/verify-customer-approveMilestone.spec.ts b/connect-automation/test-suites/milestone-flow/verify-customer-approveMilestone.spec.ts index afc24bd8f..9545647c6 100644 --- a/connect-automation/test-suites/milestone-flow/verify-customer-approveMilestone.spec.ts +++ b/connect-automation/test-suites/milestone-flow/verify-customer-approveMilestone.spec.ts @@ -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) diff --git a/connect-automation/test-suites/milestone-flow/verify-customer-role.spec.ts b/connect-automation/test-suites/milestone-flow/verify-customer-role.spec.ts index 4375e3e09..38f4bad68 100644 --- a/connect-automation/test-suites/milestone-flow/verify-customer-role.spec.ts +++ b/connect-automation/test-suites/milestone-flow/verify-customer-role.spec.ts @@ -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); }); From d089b43fdf7f4dcc9d8c26edea2a7ce19f7cb29e Mon Sep 17 00:00:00 2001 From: "Nursoltan Saipolda (Topcoder)" Date: Mon, 6 Sep 2021 00:37:24 +0800 Subject: [PATCH 2/2] fixed lint error --- .../project-milestone/project-milestone.po.ts | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/connect-automation/page-objects/project-milestone/project-milestone.po.ts b/connect-automation/page-objects/project-milestone/project-milestone.po.ts index 4465a6169..e9d401e8e 100644 --- a/connect-automation/page-objects/project-milestone/project-milestone.po.ts +++ b/connect-automation/page-objects/project-milestone/project-milestone.po.ts @@ -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 */ @@ -195,6 +179,13 @@ 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`; @@ -202,6 +193,22 @@ export class ProjectMilestonePageObject { 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 * @@ -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 */