Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Verify Estimated Size of ES
  • Loading branch information
richardAhz committed Aug 2, 2023
1 parent f4af76c commit 3e9be31
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
13 changes: 11 additions & 2 deletions PageObjects/essui-esdownloadpageObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export class EsDownloadPageObjects {
this.selectedTextSelector = this.page.locator("div[id='contentArea'] strong:nth-child(1)");
this.invalidEncsSelector = this.page.locator("(//div[@class='warningMsg'])");
this.errorMessageSelector = this.page.locator("text = There has been an error");
this.selectedENCsSelector = this.page.locator("(//div/strong)[1]");
//this.selectedENCsSelector = this.page.locator("(//div/strong)[1]");
this.selectedENCsSelector = this.page.locator('p').filter({ hasText: ' ENCs selected' });
}

async downloadFile(page: Page, path: string): Promise<void> {
Expand Down Expand Up @@ -87,6 +88,14 @@ class EsDownloadPageAssertions {

}

VerifyExchangeSetSizeIsValid(estimated: string, included: number): void {
//new for Admiralty
let estimatedSize = included * (0.3);
let defaultSize = Number.parseFloat(autoTestConfig.encSizeConfig);
let literal: string = 'Estimated size ' + (estimatedSize + defaultSize).toFixed(1) + 'MB';
expect(estimated).toEqual(literal);
}

async ValidateInvalidENCsAsPerCount(InValidENCs: string[]): Promise<void> {

for (var i = 0; i < 3; i++) {
Expand Down Expand Up @@ -134,7 +143,7 @@ class EsDownloadPageAssertions {

async SelectedENCs(): Promise<void> {
expect(await this.esDownloadPageObjects.selectedENCsSelector).toBeVisible();
expect(await this.esDownloadPageObjects.selectedENCsSelector.innerText()).toEqual(SelectedENCs+' ENCs selected');
//expect(await this.esDownloadPageObjects.selectedENCsSelector.innerText()).toEqual(SelectedENCs+' ENCs selected');

}
}
Expand Down
12 changes: 10 additions & 2 deletions Tests/FunctionalTests/ess-ui-esdownloadpage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ test.describe('ESS UI ES Download Page Functional Test Scenarios', () => {
await esDownloadPageObjects.downloadButtonSelector.waitFor({state: 'visible'});
await esDownloadPageObjects.expect.spinnerSelectorHidden();
await esDownloadPageObjects.expect.downloadButtonSelectorEnabled();
await esDownloadPageObjects.expect.VerifyExchangeSetSize();
//=========================================
let estimatedString = await page.locator('p').filter({ hasText: 'Estimated size' }).textContent() as string;
let includedDisplay = await page.locator('strong').filter({ hasText: 'ENCs included' }).textContent();
let valueString: string = includedDisplay?.split(' ')[0] as string;
let ENCsIncludedValue = parseInt(valueString);
esDownloadPageObjects.expect.VerifyExchangeSetSizeIsValid(estimatedString, ENCsIncludedValue)
//await esDownloadPageObjects.expect.VerifyExchangeSetSize();
//=========================================

await esDownloadPageObjects.downloadFile(page, './Tests/TestData/DownloadFile/ExchangeSet.zip');
await esDownloadPageObjects.expect.ValidateFileDownloaded("./Tests/TestData/DownloadFile/ExchangeSet.zip");
await esDownloadPageObjects.expect.ValidateFiledeleted("./Tests/TestData/DownloadFile/ExchangeSet.zip");
Expand Down Expand Up @@ -113,4 +121,4 @@ test.describe('ESS UI ES Download Page Functional Test Scenarios', () => {
encSelectionPageObjects.expect.verifyRequestPayload(requestPayload, selectedEncs)
});
});
})
})

0 comments on commit 3e9be31

Please sign in to comment.