Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/97447 wording change for 250 limit #226

Merged
merged 5 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions PageObjects/essui-encselectionpageObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class EncSelectionPageObjects {
readonly typeENCTextBoxSelector: Locator;
readonly addENCButtonSelector: Locator;
readonly startAgainLinkSelector: Locator;
readonly EncSelectorAt101th: Locator;
readonly EncSelectorAt250th: Locator;
readonly maxLimitEncmessage: Locator;
readonly secondEncSelector: Locator;
readonly leftTableDisplaySelector: Locator;
Expand Down Expand Up @@ -47,14 +47,14 @@ export class EncSelectionPageObjects {
this.esslandingPageObjects = new EssLandingPageObjects(page);
this.encNameSelector = this.page.locator("text=ENC name");
this.startLinkSelector = this.page.locator(".linkStartAgain");
this.textAboveTableSelector = this.page.locator("text=Select up to 100 ENCs and make an exchange set");
this.textAboveTableSelector = this.page.locator("text=Select up to 250 ENCs and make an exchange set");

this.XButtonSelector = this.page.locator("//table/tbody/tr/td[2]/button/i");
this.addAnotherENCSelector = this.page.locator("a.lnkAddAnotherEnc");
this.typeENCTextBoxSelector = this.page.locator("//input[@placeholder='Type ENC cell name here']");
this.addENCButtonSelector = this.page.locator("//button[text()=' Add ENC ']");
this.startAgainLinkSelector = this.page.locator("a.linkStartAgain");
this.EncSelectorAt101th = this.page.locator("//div/table/tbody/tr[101]/td[2]");
this.EncSelectorAt250th = this.page.locator("//div/table/tbody/tr[250]/td[2]");
this.chooseBoxSelecetor = this.page.locator("input[id = 'ukho-form-field-5']");
this.selectionTextSelector = this.page.locator("text='Your selection '");
this.exchangeSetSizeSelector = this.page.locator('span.bottomText')
Expand Down Expand Up @@ -106,8 +106,8 @@ export class EncSelectionPageObjects {
await this.encNameSelector.click();
}

async EncSelectorAt101thClick(): Promise<void> {
await this.EncSelectorAt101th.click();
async EncSelectorAt250thClick(): Promise<void> {
await this.EncSelectorAt250th.click();
}

async firstCheckBoxSelectorClick(): Promise<void> {
Expand Down
37 changes: 33 additions & 4 deletions PageObjects/essui-esdownloadpageObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ export class EsDownloadPageObjects {
readonly invalidEncsSelector: Locator;
readonly errorMessageSelector: Locator;
readonly selectedENCsSelector: Locator;
readonly getDialogueSelector: Locator
readonly getDialogueSelector: Locator;
readonly downloadLinkSelector: Locator;
readonly createLinkSelector: Locator;

readonly pageUnderTest: Page

constructor(readonly page: Page) {
this.expect = new EsDownloadPageAssertions(this);
this.encselectionPageObjects = new EncSelectionPageObjects(page)
this.encselectionPageObjects = new EncSelectionPageObjects(page);
this.downloadButtonSelector = this.page.locator("//button[@type='submit']");
this.spinnerSelector = this.page.locator("i.fas.fa-circle-notch.fa-spin");
this.includedENCsCountSelector = this.page.locator("(//strong[@class='f21'][2])");
Expand All @@ -35,8 +38,9 @@ export class EsDownloadPageObjects {
this.errorMessageSelector = this.page.getByText("There has been an error");
this.selectedENCsSelector = this.page.locator('p').filter({ hasText: ' ENCs selected' });
this.getDialogueSelector = this.page.locator(("admiralty-dialogue"));
this.pageUnderTest = page;

this.downloadLinkSelector = this.page.getByTestId('download-exs');
this.createLinkSelector = this.page.getByTestId('create-exs')
this.pageUnderTest = page;

}

Expand Down Expand Up @@ -70,6 +74,31 @@ class EsDownloadPageAssertions {
expect(await this.esDownloadPageObjects.downloadButtonSelector.isVisible).toBeTruthy();
}

async downloadButtonSelectorHidden(): Promise<void> {

expect(await this.esDownloadPageObjects.downloadButtonSelector.isHidden).toBeTruthy();
}

async createLinkSelectorEnabled(): Promise<void> {

expect(await this.esDownloadPageObjects.createLinkSelector.isVisible).toBeTruthy();
}

async createLinkSelectorHidden(): Promise<void> {

expect(await this.esDownloadPageObjects.createLinkSelector.isHidden).toBeTruthy();
}

async downloadLinkSelectorEnabled(): Promise<void> {

expect(await this.esDownloadPageObjects.downloadLinkSelector.isVisible).toBeTruthy();
}

async downloadLinkSelectorHidden(): Promise<void> {

expect(await this.esDownloadPageObjects.downloadLinkSelector.isHidden).toBeTruthy();
}

async selectedTextSelectorVisible(): Promise<void> {

expect(await this.esDownloadPageObjects.selectedTextSelector).toBeTruthy();
Expand Down
18 changes: 3 additions & 15 deletions Tests/FunctionalTests/ess-ui-encselectionpage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,18 @@ test.describe('ESS UI ENCs Selection Page Functional Test Scenarios', () => {
test('Verify Text on the top of ENC list.', async ({ page }) => {

await encSelectionPageObjects.expect.startLinkSelectorVisible();
await encSelectionPageObjects.expect.textAboveTableSelectorToEqual("Select up to 100 ENCs and make an exchange set");
await encSelectionPageObjects.expect.textAboveTableSelectorToEqual("Select up to 250 ENCs and make an exchange set. Please note, larger requests may take longer to process.");
})

// https://dev.azure.com/ukhocustomer/File-Share-Service/_workitems/edit/13949
// https://dev.azure.com/ukhocustomer/File-Share-Service/_workitems/edit/13950
test('Verify limit for selecting ENCs (i.e.100) in left hand table', async ({ page }) => {
test('Verify limit for selecting ENCs (i.e.250) in left hand table', async ({ page }) => {

await encSelectionPageObjects.startAgainLinkSelectorClick();
await esslandingPageObjects.uploadradiobtnSelectorClick();
await esslandingPageObjects.uploadFile(page, './Tests/TestData/ValidAndInvalidENCs.csv');
await esslandingPageObjects.proceedButtonSelectorClick();
await encSelectionPageObjects.expect.verifyRightTableRowsCountSelectorCount(100);
await encSelectionPageObjects.EncSelectorAt101thClick();
await encSelectionPageObjects.expect.maxLimitEncmessageSelectorContainText("No more than 100 ENCs can be selected.");

await encSelectionPageObjects.expect.verifyRightTableRowsCountSelectorCount(250);
})

// https://dev.azure.com/ukhocustomer/File-Share-Service/_workitems/edit/13944 (For valid ENC no.)
Expand Down Expand Up @@ -155,15 +152,6 @@ test.describe('ESS UI ENCs Selection Page Functional Test Scenarios', () => {
await selectENCsFromTable.nth(i).click();
}
await encSelectionPageObjects.expect.selectAllSelectorIsVisible();
// Select All link get disappeared when Number of ENC uploaded are greater than 100
await encSelectionPageObjects.startAgainLinkSelectorClick();
await esslandingPageObjects.uploadradiobtnSelectorClick();
await esslandingPageObjects.uploadFile(page, './Tests/TestData/100ENCs.txt');
await esslandingPageObjects.proceedButtonSelectorClick();
await encSelectionPageObjects.expect.selectAllSelectorIsVisible();
await encSelectionPageObjects.addAnotherENC("KK123456");
expect(await encSelectionPageObjects.selectAllSelector.isVisible()).toBeFalsy();

})

// https://dev.azure.com/ukhocustomer/File-Share-Service/_workitems/edit/14115
Expand Down
7 changes: 7 additions & 0 deletions Tests/FunctionalTests/ess-ui-esdownloadpage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test.describe('ESS UI ES Download Page Functional Test Scenarios', () => {
await encSelectionPageObjects.SelectedENCsCount();
await encSelectionPageObjects.requestENCsSelectorClick();
await esDownloadPageObjects.expect.SelectedENCs();
await esDownloadPageObjects.expect.downloadButtonSelectorHidden();
await esDownloadPageObjects.expect.spinnerSelectorVisible();
await esDownloadPageObjects.downloadButtonSelector.waitFor({state: 'visible'});
await esDownloadPageObjects.expect.spinnerSelectorHidden();
Expand All @@ -50,10 +51,16 @@ test.describe('ESS UI ES Download Page Functional Test Scenarios', () => {
let valueString: string = includedDisplay?.split(' ')[0] as string;
let ENCsIncludedValue = parseInt(valueString);
esDownloadPageObjects.expect.VerifyExchangeSetSizeIsValid(estimatedString, ENCsIncludedValue)
await esDownloadPageObjects.expect.downloadLinkSelectorHidden();
await esDownloadPageObjects.expect.createLinkSelectorHidden();

//=========================================
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");
await esDownloadPageObjects.expect.downloadLinkSelectorEnabled();
await esDownloadPageObjects.expect.createLinkSelectorEnabled();

})

// https://dev.azure.com/ukhocustomer/File-Share-Service/_workitems/edit/14101
Expand Down
21 changes: 11 additions & 10 deletions Tests/UnitTests/ess-download-exchangeset.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,14 @@ describe('EssDownloadExchangesetComponent', () => {
const fixture = TestBed.createComponent(EssDownloadExchangesetComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('p').textContent).toContain(
`Your exchange set is available as a download via your browser`
);
expect(compiled.querySelector('p').textContent).toContain(`This can take a few minutes.`);
});

test('should render text inside an p tag', () => {
const fixture = TestBed.createComponent(EssDownloadExchangesetComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelectorAll('p')[1].textContent).toContain('The zip file will be ready soon, please do not refresh or leave this browser window.');
expect(compiled.querySelectorAll('p')[1].textContent).toContain('Please do not refresh this page.');
});

test('should return Exchangeset cell count', () => {
Expand Down Expand Up @@ -155,22 +153,25 @@ describe('EssDownloadExchangesetComponent', () => {
it('should display download button when batch status is Committed', () => {
service.getBatchStatus.mockReturnValue(of(batchStatusCommittedMockData));
component.batchStatusAPI();
expect(component.displayDownloadBtn).toBe(true);
expect(component.displayEssLoader).toBe(false);
expect(component.exchangeSetLoading).toBe(false);
expect(component.exchangeSetReady).toBe(true);
expect(component.downloadComplete).toBe(false);
});

it('should hide download button when batch status is CommitInProgress', () => {
service.getBatchStatus.mockReturnValue(of(batchStatusCommitInProgressMockData));
component.batchStatusAPI();
expect(component.displayDownloadBtn).toBe(false);
expect(component.displayEssLoader).toBe(true);
expect(component.exchangeSetLoading).toBe(true);
expect(component.exchangeSetReady).toBe(false);
expect(component.downloadComplete).toBe(false);
});

it('should show error message when batch status is Failed', () => {
service.getBatchStatus.mockReturnValue(of(batchStatusFailedMockData));
component.batchStatusAPI();
expect(component.displayDownloadBtn).toBe(false);
expect(component.displayEssLoader).toBe(false);
expect(component.exchangeSetLoading).toBe(false);
expect(component.exchangeSetReady).toBe(false);
expect(component.downloadComplete).toBe(false);
});

it('should display loader when download button is clicked and hide loader after refreshToken API response', () => {
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/ess-list-encs.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe('EssListEncsComponent', () => {
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('p').textContent).toContain(
`Select up to 5 ENCs and make an exchange set`
`Select up to 5 ENCs and make an exchange set. Please note, larger requests may take longer to process.`
);
});

Expand Down
8 changes: 7 additions & 1 deletion Tests/UnitTests/fss-simplified-search.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { FssSearchFilterService } from '../../src/app/core/services/fss-search-f
import { Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { By } from '@angular/platform-browser';
import { AppConfigService } from '../../src/app/core/services/app-config.service';
describe('FssSimplifiedSearchComponent', () => {
let component: FssSimplifiedSearchComponent;
let fixture: ComponentFixture<FssSimplifiedSearchComponent>;
Expand All @@ -24,6 +25,11 @@ describe('FssSimplifiedSearchComponent', () => {
});

beforeEach(() => {
AppConfigService.settings = {
essConfig: {
MaxEncSelectionLimit: 250
}
};
fixture = TestBed.createComponent(FssSimplifiedSearchComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down Expand Up @@ -68,7 +74,7 @@ describe('FssSimplifiedSearchComponent', () => {
test('should show the content of exchange sets on search page', () => {
const fixture = TestBed.createComponent(FssSimplifiedSearchComponent);
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('p').textContent).toBe('You can make a small (100 ENC), custom exchange set here and download it');
expect(fixture.nativeElement.querySelector('p').textContent).toBe('You can make a small (250 ENC), custom exchange set here and download it');
});

test('should show the subtitle of exchange sets on search page', () => {
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config: PlaywrightTestConfig = {
retries: 3,
testDir: './Tests',
/* Maximum time one test can run for. */
timeout: 100 * 1000,
timeout: 300 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@
</div>
<div class="exchangesetcontainer">
<h1 id="main" tabindex="-1">Exchange sets</h1>

<app-ess-info-error-message></app-ess-info-error-message>

<div role="alert">
<p class="light">Your exchange set is available as a download via your browser</p>
<p class="light">The zip file will be ready soon, please do not refresh or leave this browser window. </p>
</div>

</div>
<div class="ess-container">
<div class="ess-download-wrapper">
<h4 style="padding-left: 15px;margin-top: 20px;margin-bottom: 20px">Exchange set download</h4>
<div class="spinner-wrapper ess-spinner-wrapper" *ngIf="displayEssLoader" aria-live='polite' role="alert" aria-label="Results Loading">
<i class="fa-solid fa-circle-notch fa-spin" style="font-size:220px;color:green"></i>
</div>
<div *ngIf="displayDownloadBtn">
<admiralty-button class="btnDownload" (click)="download()">Download</admiralty-button>
<div *ngIf="exchangeSetLoading">
<h4 style="padding-left: 15px; margin-top: 15px; margin-bottom: 3px">Exchange set loading</h4>
<p style="padding-left: 15px; margin-top: 3px; margin-bottom: 1px">This can take a few minutes.</p>
<p style="padding-left: 15px; margin-top: 1px; margin-bottom: 5px">Please do not refresh this page.</p>
<div class="spinner-wrapper ess-spinner-wrapper" aria-live='polite' role="alert" aria-label="Results Loading">
<i class="fa-solid fa-circle-notch fa-spin" style="font-size:180px;color:green"></i>
</div>
</div>
<div *ngIf="exchangeSetReady">
<h4 style="padding-left: 15px; margin-top: 15px; margin-bottom: 2px">Exchange set ready</h4>
<p style="padding-left: 15px; margin-top: 3px; margin-bottom: 5px">Please click the "Download" button to download your exchange set.</p>
<admiralty-button class="btnDownload" (click)="download()">Download</admiralty-button>
</div>
<div *ngIf="downloadComplete">
<h4 style="padding-left: 15px; margin-top: 15px; margin-bottom: 2px">Download complete</h4>
<p style="padding-left: 15px; margin-top: 3px; margin-bottom: 5px"><a data-testid="download-exs" href="javascript:void(0)" (click)="download()">Download</a> the file again or <a data-testid="create-exs" href="javascript:void(0)" (click)="switchToESSLandingPage()">create another exchange set.</a></p>
</div>
</div>
<div class="divider"></div>
<div style="flex: 3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import { EssInfoErrorMessageService, RequestedProductsNotInExchangeSet } from '.
export class EssDownloadExchangesetComponent implements OnInit ,OnDestroy{

exchangeSetDetails: ExchangeSetDetails;
displayLoader: boolean = false;
displayEssLoader: boolean = true;
displayDownloadBtn: boolean = false;
displayLoader: boolean = false;
batchDetailsUrl: string;
batchId: string;
fssTokenScope: any = [];
Expand All @@ -37,7 +35,9 @@ export class EssDownloadExchangesetComponent implements OnInit ,OnDestroy{
@ViewChild('ukhoTarget') ukhoDialogForEnc: ElementRef;
messageType: 'info' | 'warning' | 'success' | 'error' = 'info';
messageDesc = '';

exchangeSetLoading = false;
exchangeSetReady = false;
downloadComplete = false;
constructor(private essUploadFileService: EssUploadFileService,
private fileShareApiService: FileShareApiService,
private msalService: MsalService,
Expand All @@ -48,6 +48,8 @@ export class EssDownloadExchangesetComponent implements OnInit ,OnDestroy{
this.fssSilentTokenRequest = {
scopes: [this.fssTokenScope],
};

this.showProgressMessage(true, false, false);
}

ngOnInit(): void {
Expand Down Expand Up @@ -84,8 +86,7 @@ export class EssDownloadExchangesetComponent implements OnInit ,OnDestroy{
batchStatusAPI() {
this.fileShareApiService.getBatchStatus(this.batchId).subscribe((response) => {
if (response.status == 'Committed') {
this.displayEssLoader = false;
this.displayDownloadBtn = true;
this.showProgressMessage(false, true, false);
}
else if (response.status == 'CommitInProgress' || response.status == 'Incomplete') {
setTimeout(() => {
Expand All @@ -94,7 +95,7 @@ export class EssDownloadExchangesetComponent implements OnInit ,OnDestroy{
}
else {
this.triggerInfoErrorMessage(true,'warning', 'Something went wrong');
this.displayEssLoader = false;
this.showProgressMessage(false, false, false);
}
});
}
Expand All @@ -107,18 +108,19 @@ export class EssDownloadExchangesetComponent implements OnInit ,OnDestroy{
this.msalService.instance.acquireTokenSilent(this.fssSilentTokenRequest).then(response => {
this.fileShareApiService.refreshToken().subscribe((res) => {
this.displayLoader = false;
window.open(this.downloadUrl, '_blank');
window.open(this.downloadUrl, '_blank');
});
}, error => {
this.msalService.instance
.loginPopup(this.fssSilentTokenRequest)
.then(response => {
this.fileShareApiService.refreshToken().subscribe((res) => {
this.displayLoader = false;
window.open(this.downloadUrl, '_blank');
window.open(this.downloadUrl, '_blank');
});
});
});
this.showProgressMessage(false, false, true);
}

switchToESSLandingPage() {
Expand All @@ -142,4 +144,10 @@ export class EssDownloadExchangesetComponent implements OnInit ,OnDestroy{
ngOnDestroy(): void {
this.triggerInfoErrorMessage(false , 'info','');
}

showProgressMessage(showLoading: boolean, showReady: boolean, showComplete: boolean): void {
this.exchangeSetLoading = showLoading;
this.exchangeSetReady = showReady;
this.downloadComplete = showComplete;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<span class="sr-only" role="alert" aria-label="Enc File is Ready"></span>
<h1 id="main" tabindex="-1">Exchange sets</h1>
<app-ess-info-error-message></app-ess-info-error-message>
<p>Select up to {{maxEncSelectionLimit}} ENCs and make an exchange set</p>
<p>Select up to {{maxEncSelectionLimit}} ENCs and make an exchange set. Please note, larger requests may take longer to process.</p>
<div class="showEncListWrapper">
<div style="flex: 5">
<div *ngIf="encList && encList.length > 0" >
Expand Down
Loading
Loading