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

12858 fss UI simplified search acceptance tests for new developed features #114

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d91bda5
AB#12920 Updated the Design system for Keyboard focus changes AB#1292…
Mar 8, 2022
ebf0a00
AB#12920 Simplifide Search - Added Bypass link for Filter componant A…
Mar 10, 2022
62ce0c9
12920 - Added code changes for pagination AB#12920 AB#12943
pratibh14837 Mar 10, 2022
5d96fee
AB#12920 UI - Search Input click effect and download Button enter cli…
Mar 11, 2022
df2b437
AB#12920 Reverting Appconfig - AB#12920 AB#12980
Mar 11, 2022
28b7279
12920 - Added code changes for bypass link AB#12920 AB#12943
pratibh14837 Mar 11, 2022
8cd0f11
12920 - Added code changes Go to Filter Menu AB#12920 AB#12943
pratibh14837 Mar 14, 2022
a0d8743
AB#12920 - Cosmetic Changes - AB#12920 AB#12980
Mar 15, 2022
db39bfc
Initial Code Commit AB#12935
prasad14878 Mar 15, 2022
1d0f36c
12920 - code changes for error msg AB#12920 AB#12943
pratibh14837 Mar 15, 2022
f416ea8
AB#12920 - Cosmetic Changes - AB#12920 AB#12980
Mar 16, 2022
fa748e7
AB#12920 - Vulnerability resolved - AB#12920 AB#12980
Mar 17, 2022
4251333
AB#12920 - Resolved faling Tests - AB#12920 AB#12980
Mar 17, 2022
c286c4f
review comment changes
prasad14878 Mar 17, 2022
4971fd8
12858-added acceptance test AB#12937
Mar 17, 2022
d4fcc40
AB#12920 - resolve Failing functional test - AB#12920 AB#12980
Mar 17, 2022
3db09e4
updated config file
Mar 17, 2022
1af4e9e
fixed failed tests
Mar 17, 2022
0cc462d
Merge branch 'main' into Feature/12858-fss-ui-simplified-search-accep…
crdandoukho Mar 18, 2022
b7a4b8c
Merge branch 'Feature/12935-FSS-UI-Show-Download-All-button-in-disabl…
crdandoukho Mar 18, 2022
9f24bc8
Merge branch 'Feature/12920-Simplified-Search-Accessibility-Implement…
crdandoukho Mar 18, 2022
f5f503a
fixed the element change
Mar 18, 2022
0f55098
deleted element visibility check option
Mar 18, 2022
7e1d8b9
12858-updated ukho design syatem package to latest version-4.5.0
rashmish24 Mar 21, 2022
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
27 changes: 0 additions & 27 deletions NVDSuppressions.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
<suppress>
<notes><![CDATA[
file name: ansi-html:0.0.7
Vunerability is if an attacker provides a malicious string, it will get stuck processing the input for an extremely long time.
For now there is no patch available for this vulnerability.
]]></notes>
<packageUrl regex="true">^pkg:npm/ansi\-html@.*$</packageUrl>
<vulnerabilityName>CVE-2021-23424</vulnerabilityName>
</suppress>
<suppress>
<notes><![CDATA[
file name: ansi-html:0.0.7
Vunerability is if an attacker provides a malicious string, it will get stuck processing the input for an extremely long time.
For now there is no patch available for this vulnerability.
]]></notes>
<packageUrl regex="true">^pkg:npm/ansi\-html@.*$</packageUrl>
<vulnerabilityName>1002522</vulnerabilityName>
</suppress>
<suppress>
<notes><![CDATA[
file name: ansi-html:0.0.7
Vunerability is if an attacker provides a malicious string, it will get stuck processing the input for an extremely long time.
For now there is no patch available for this vulnerability.
]]></notes>
<packageUrl regex="true">^pkg:npm/ansi\-html@.*$</packageUrl>
<vulnerabilityName>1005059</vulnerabilityName>
</suppress>
<suppress>
<notes><![CDATA[
file name: json-schema:0.2.3
Expand Down
2 changes: 1 addition & 1 deletion Tests/FunctionalTests/fss-signin-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Test Sign In Page Scenario', () => {
await LoginPortal(page,autoTestConfig.user, autoTestConfig.password, pageObjectsConfig.loginSignInLinkSelector);

await page.waitForSelector(pageObjectsConfig.loginAccountSelector);
expect(await page.innerHTML(pageObjectsConfig.loginAccountLinkSelector)).toEqual(autoTestConfig.userFullName);
expect(await page.innerHTML(pageObjectsConfig.loginAccountLinkSelector)).toContain(autoTestConfig.userFullName);

})

Expand Down
80 changes: 76 additions & 4 deletions Tests/FunctionalTests/fss-simplified-search-results.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const { pageObjectsConfig, pageTimeOut } = require('./pageObjects');
import {AcceptCookies, InsertSearchText,
ExpectAllResultsHaveBatchUserAttValue,
ExpectAllResultsContainAnyBatchUserAttValue,
GetTotalResultCount} from './helpermethod';
import {attributeProductType, searchNonExistBatchAttribute} from './helperconstant';
GetTotalResultCount,GetSpecificAttributeCount,filterCheckBox,ExpectAllResultsContainBatchUserAttValue} from './helpermethod';
import {attributeProductType, searchNonExistBatchAttribute,batchAttributeKeys,attributeMediaType} from './helperconstant';

describe('Test Search Result Scenario On Simplified Search Page', () => {
jest.setTimeout(pageTimeOut.timeOutInMilliSeconds);
Expand Down Expand Up @@ -81,8 +81,7 @@ describe('Test Search Result Scenario On Simplified Search Page', () => {

//verify Choose files to download and Download buttons are available on the page
expect(await page.isVisible(pageObjectsConfig.chooseFileDownloadSelector)).toBeTruthy();
expect(await page.isVisible(pageObjectsConfig.fileDownloadButton)).toBeTruthy();


//Click on expand button
await page.click(pageObjectsConfig.chooseFileDownloadSelector);

Expand All @@ -94,4 +93,77 @@ describe('Test Search Result Scenario On Simplified Search Page', () => {
expect(fileDownloadStatus).toContain("check");
})

it('Verify search results specific batch attributes on filter panel', async () => {
await InsertSearchText(page, attributeProductType.value);

await page.waitForSelector(pageObjectsConfig.searchResultTableSelector);
await ExpectAllResultsHaveBatchUserAttValue(page, attributeProductType.value);

const filterSpeficAttributeCount=await GetSpecificAttributeCount(page, attributeProductType.key, attributeProductType.value );

expect(filterSpeficAttributeCount).toEqual(1);

})

it('Verify configured batch attributes will be displayed on the filter panel', async () => {
await InsertSearchText(page, attributeProductType.value);

await page.waitForSelector(pageObjectsConfig.searchResultTableSelector);
await ExpectAllResultsHaveBatchUserAttValue(page, attributeProductType.value);

const configuredBatchAttibutes=await page.$$eval(pageObjectsConfig.filterBatchAttributes ,elements => { return elements.map(element => element.textContent) });

var match = (batchAttributeKeys.length == configuredBatchAttibutes.length) && batchAttributeKeys.every(function(element, index) {
return element === configuredBatchAttibutes[index];
});

expect(match).toBeTruthy();

})

it('Verify batch attributes filter can select or deselect', async () => {
await InsertSearchText(page, attributeProductType.value);

await page.waitForSelector(pageObjectsConfig.searchResultTableSelector);
await ExpectAllResultsHaveBatchUserAttValue(page, attributeProductType.value);
//select filter check box
await page.check(await filterCheckBox(attributeProductType.key, attributeProductType.value));
await page.check(await filterCheckBox(attributeMediaType.key, attributeMediaType.value));

// Assert the filter checked state
expect(await page.isChecked(await filterCheckBox(attributeProductType.key, attributeProductType.value))).toBeTruthy()
expect(await page.isChecked(await filterCheckBox(attributeMediaType.key, attributeMediaType.value))).toBeTruthy()

//clicks on clear filter buttton
await page.click(pageObjectsConfig.clearFilterButton);

// Assert the filter checked state
expect(await page.isChecked(await filterCheckBox(attributeProductType.key, attributeProductType.value))).toBeFalsy()
expect(await page.isChecked(await filterCheckBox(attributeMediaType.key, attributeMediaType.value))).toBeFalsy()

})

it('Select batch attributes filter and clicks on Apply filters button and refine the search', async () => {
await InsertSearchText(page, attributeProductType.value);

await page.waitForSelector(pageObjectsConfig.searchResultTableSelector);
await ExpectAllResultsHaveBatchUserAttValue(page, attributeProductType.value);
//select batch attributes filter
await page.check(await filterCheckBox(attributeProductType.key, attributeProductType.value));
await page.check(await filterCheckBox(attributeMediaType.key, attributeMediaType.value));

// Assert the filter checked state
expect(await page.isChecked(await filterCheckBox(attributeProductType.key, attributeProductType.value))).toBeTruthy()
expect(await page.isChecked(await filterCheckBox(attributeMediaType.key, attributeMediaType.value))).toBeTruthy()

//clicks on clear filter buttton
await page.click(pageObjectsConfig.applyFilterButton);

await page.waitForSelector(pageObjectsConfig.searchResultTableSelector);
await ExpectAllResultsContainBatchUserAttValue(page,attributeProductType.value);
await ExpectAllResultsContainBatchUserAttValue(page,attributeMediaType.value);
})



})
8 changes: 8 additions & 0 deletions Tests/FunctionalTests/helperconstant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,13 @@ export const attributeBusinessUnit: BatchAttribute = { key: 'BusinessUnit', valu
export const attributeProductType: BatchAttribute = { key: 'Product Type', value: 'AVCS' };
export const attributeFileSize: BatchAttribute = {key: 'FileSize', value: '1000'};
export const attributeMimeType: BatchAttribute = {key: 'MimeType', value: 'text/plain'};
export const attributeMediaType: BatchAttribute = {key: 'Media Type', value: 'DVD'};

export const searchNonExistBatchAttribute = 'pqtestresult';

export const batchAttributeKeys = [
'Media Type',
'Product Type',
'Week Number',
'Year'
]
15 changes: 15 additions & 0 deletions Tests/FunctionalTests/helpermethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,18 @@ export async function GetCountOfBatchRows(page: Page): Promise<number> {
// count the result rows
return await page.$$eval(`//table[@class='${pageObjectsConfig.searchAttributeTable.substring(1)}']`, matches => matches.length);
}

export async function GetSpecificAttributeCount(page: Page,batchAtributeType : string, batchAttributeValue : string) : Promise<number>{

let searchString=`//ukho-expansion[.//h3[text()='${batchAtributeType}']]//ukho-checkbox/label[text()='${batchAttributeValue}']`
const resultCount = await page.$$eval(searchString, matches => matches.length);
return resultCount

}

export async function filterCheckBox(batchAtributeType: string, batchAttributeValue : string) : Promise<string>{

let checkBoxMatch=`//ukho-expansion[.//h3[text()='${batchAtributeType}']]//ukho-checkbox/label[text()='${batchAttributeValue}']`;
return checkBoxMatch;

}
19 changes: 11 additions & 8 deletions Tests/FunctionalTests/pageObjects.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"pageObjectsConfig":
{
"homePageHeaderSelector":"#main-menu h2",
"homePageHeaderSelector":"#main-menu h1",
"homePageHeaderText":"File Share Service",
"searchLinkSelector":"ukho-header #Search >a",
"searchLinkText":"Search",
"signinLinkSelector":"ukho-header [id='signInButton'] >a",
"signinLinkText":"Sign In",
"signinLinkSelector":"ukho-header [id='signInButton']",
"signinLinkText":"Sign in",
"accessibilityLinkSelector": "text=Accessibility",
"privacypolicyLinkSelector": "text=Privacy policy",
"marinedataportalLinkSelector" : "a > img[alt='Admiralty - Maritime Data Solutions Logo']",
Expand All @@ -24,8 +24,8 @@
"loginPopupSignInPasswordSelector" : "#password",
"loginPopupSignInButtonSelector" : "#next",
"loginSignInLinkSelector" : "#signInButton",
"loginAccountSelector" : "#accountSection",
"loginAccountLinkSelector" : "#accountSection #profile > a",
"loginAccountSelector" : ".sectionDropdown",
"loginAccountLinkSelector" : "button[aria-describedby='signedInButtonTextDescription']",
"searchPageContainerHeaderSelector" : "h1#main",
"searchPageContainerHeaderText" : "Search files",
"searchButtonSelector": "#Search",
Expand Down Expand Up @@ -55,8 +55,8 @@
"groupCheckBox2Selector" : "#fss-querytable-group-2 input",
"groupingButton" : ".delete.grouping",
"chooseFileDownloadSelector" : "(//h3[text()='Choose files to download'])[1]",
"fileDownloadButton" : "(//h3[text()='Choose files to download'])[1]/following::div[@class='fileDownload'][1]",
"fileDownloadButtonStatus" : "(//h3[text()='Choose files to download'])[1]/following::div[@class='fileDownload'][1]/i",
"fileDownloadButton" : "(//h3[text()='Choose files to download'])[1]/following::button[contains(@aria-label,'Download')][1]",
"fileDownloadButtonStatus" : "(//h3[text()='Choose files to download'])[1]/following::button[contains(@aria-label,'Download')][1]",
"attributeTableCellNameSelector" : "(//table[@class='attribute-table']//tr[2]//td[1])[1]",
"systemTableBatchExpirySelector" : "(//table[@class='system-attribute-table']//tr[2]//td[3])[1]",
"SystemAttributeCellName" : "//table[@class='attribute-table']//tr[2]//td[1]",
Expand All @@ -81,7 +81,10 @@
"simplifiedTableRowsSelector" : "//*[contains(@class, 'SimplifiedSearchResult')]//table[@class='attribute-table']//tr[.//td]",
"paginatorTextSelector" : "[aria-label='pagination']>p",
"paginatorLinkPrevious" : "a[aria-label='Previous Page']",
"paginatorLinkNext":"a[aria-label='Next Page']"
"paginatorLinkNext":"a[aria-label='Next Page']",
"filterBatchAttributes" : ".filters h3",
"clearFilterButton": "button.text-link[type='reset']",
"applyFilterButton": "//button[text()='Apply filters']"
},
"pageTimeOut":
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/UnitTests/fss-header.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('FssHeaderComponent', () => {
const fixture = TestBed.createComponent(FssHeaderComponent);
fixture.detectChanges();
const header = fixture.debugElement.query(By.css('ukho-header')).nativeElement;
expect(header.querySelector('h2').textContent).toContain(AppConfigService.settings["fssConfig"].fssTitle);
expect(header.querySelector('h1').textContent).toContain(AppConfigService.settings["fssConfig"].fssTitle);
});

test('should exist', () => {
Expand Down
13 changes: 9 additions & 4 deletions Tests/UnitTests/fss-search-results.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,21 @@ describe('FssSearchResultsComponent', () => {
component.ngOnChanges();
tick(100);
fixture.detectChanges();
expect(batches.length).toBeGreaterThan(0);
fixture.whenStable().then(() => {
batches.forEach((item: SearchResultViewModel) => {
let css = "[id='" + item.BatchID.value + "']";
const home = fixture.debugElement.query(By.css(css)).nativeElement;
let pnlBatchDetailsId = "[id='" + item.BatchID.value + "']";
const pnlBatchDetails = fixture.debugElement.query(By.css(pnlBatchDetailsId)).nativeElement;
if (item.allFilesZipSize) {
expect(home.querySelector("ukho-button").textContent).toEqual("Download all");
expect(pnlBatchDetails.querySelector("a").textContent).toEqual("Download all");
expect(pnlBatchDetails.querySelector("a").classList.contains('isDownloadAllDisabled')).toBe(false);
expect(pnlBatchDetails.querySelector("ukho-dialogue")).toBeNull();
}
else
{
expect(home.querySelector("ukho-button")).toBeNull();
expect(pnlBatchDetails.querySelector("a").textContent).toEqual("Download all");
expect(pnlBatchDetails.querySelector("a").classList.contains('isDownloadAllDisabled')).toBe(true);
expect(pnlBatchDetails.querySelector("ukho-dialogue").textContent).toEqual("'Download all' function will be available when the files have been prepared You can select and download individual files, or try again later ");
}
});
});
Expand Down
9 changes: 8 additions & 1 deletion Tests/UnitTests/fss-search.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ import { PublicClientApplication } from '@azure/msal-browser';
import { HttpClientModule } from '@angular/common/http';
import { AppConfigService } from '../../src/app/core/services/app-config.service';
import { AnalyticsService } from '../../src/app/core/services/analytics.service';
import { RouterTestingModule } from '@angular/router/testing';
import { ActivatedRoute, Router } from '@angular/router';

describe('FssSearchComponent', () => {
let component: FssSearchComponent;
let fixture: ComponentFixture<FssSearchComponent>;
let msalService: MsalService;
let analyticsService: AnalyticsService;
let router : Router;
let route : ActivatedRoute;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HttpClientModule],
imports: [HttpClientModule, RouterTestingModule.withRoutes([])],
declarations: [FssSearchComponent],
schemas: [NO_ERRORS_SCHEMA],
providers: [
Expand Down Expand Up @@ -58,8 +62,11 @@ describe('FssSearchComponent', () => {

beforeEach(() => {
fixture = TestBed.createComponent(FssSearchComponent);
router = TestBed.get(Router);
route = TestBed.get(ActivatedRoute);
component = fixture.componentInstance;
fixture.detectChanges();

});

it('should create FssSearchComponent', () => {
Expand Down
37 changes: 21 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading