Fix bugs / stability issues with search e2e tests

This commit is contained in:
Tim Donohue
2022-02-09 15:07:08 -06:00
parent 53042179f0
commit 8c865b758e
4 changed files with 12 additions and 16 deletions

View File

@@ -31,7 +31,7 @@ describe('Search from Navigation Bar', () => {
// Wait for search results to come back from the above GET command
cy.wait('@search-results');
// At least one search result should be displayed
cy.get('ds-item-search-result-list-element').should('be.visible');
cy.get('[data-e2e="list-object"]').should('be.visible');
});
it('should go to search page with correct query if submitted (from search)', () => {
@@ -46,7 +46,7 @@ describe('Search from Navigation Bar', () => {
// Wait for search results to come back from the above GET command
cy.wait('@search-results');
// At least one search result should be displayed
cy.get('ds-item-search-result-list-element').should('be.visible');
cy.get('[data-e2e="list-object"]').should('be.visible');
});
it('should allow user to also submit query by clicking icon', () => {
@@ -61,6 +61,6 @@ describe('Search from Navigation Bar', () => {
// Wait for search results to come back from the above GET command
cy.wait('@search-results');
// At least one search result should be displayed
cy.get('ds-item-search-result-list-element').should('be.visible');
cy.get('[data-e2e="list-object"]').should('be.visible');
});
});

View File

@@ -1,13 +1,8 @@
import { Options } from 'cypress-axe';
import { TEST_SEARCH_TERM } from 'cypress/support';
import { testA11y } from 'cypress/support/utils';
describe('Search Page', () => {
it('should contain query value when navigating to page with query parameter', () => {
const queryString = 'test query';
cy.visit('/search?query=' + queryString);
cy.get('[data-e2e="search-box"]').should('have.value', queryString);
});
it('should redirect to the correct url when query was set and submit button was triggered', () => {
const queryString = 'Another interesting query string';
cy.visit('/search');
@@ -18,13 +13,14 @@ describe('Search Page', () => {
});
it('should load results and pass accessibility tests', () => {
cy.visit('/search');
cy.visit('/search?query=' + TEST_SEARCH_TERM);
cy.get('[data-e2e="search-box"]').should('have.value', TEST_SEARCH_TERM);
// <ds-search-page> tag must be loaded
cy.get('ds-search-page').should('exist');
// At least one search result should be displayed
cy.get('ds-item-search-result-list-element').should('be.visible');
cy.get('[data-e2e="list-object"]').should('be.visible');
// Click each filter toggle to open *every* filter
// (As we want to scan filter section for accessibility issues as well)
@@ -49,7 +45,7 @@ describe('Search Page', () => {
});
it('should have a working grid view that passes accessibility tests', () => {
cy.visit('/search');
cy.visit('/search?query=' + TEST_SEARCH_TERM);
// Click button in sidebar to display grid view
cy.get('ds-search-sidebar [data-e2e="grid-view"]').click();
@@ -57,8 +53,8 @@ describe('Search Page', () => {
// <ds-search-page> tag must be loaded
cy.get('ds-search-page').should('exist');
// At least one grid element (card) should be displayed
cy.get('ds-item-search-result-grid-element').should('be.visible');
// At least one grid object (card) should be displayed
cy.get('[data-e2e="grid-object"]').should('be.visible');
// Analyze <ds-search-page> for accessibility issues
testA11y('ds-search-page',

View File

@@ -13,7 +13,7 @@
(paginationChange)="onPaginationChange($event)">
<div class="card-columns row" *ngIf="objects?.hasSucceeded">
<div class="card-column col col-sm-6 col-lg-4" *ngFor="let column of (columns$ | async)" @fadeIn>
<div class="card-element" *ngFor="let object of column">
<div class="card-element" *ngFor="let object of column" data-e2e="grid-object">
<ds-listable-object-component-loader [object]="object" [viewMode]="viewMode" [context]="context" [linkType]="linkType"></ds-listable-object-component-loader>
</div>
</div>

View File

@@ -12,7 +12,7 @@
(sortFieldChange)="onSortFieldChange($event)"
(paginationChange)="onPaginationChange($event)">
<ul *ngIf="objects?.hasSucceeded" class="list-unstyled" [ngClass]="{'ml-4': selectable}">
<li *ngFor="let object of objects?.payload?.page; let i = index; let last = last" class="mt-4 mb-4 d-flex" [class.border-bottom]="hasBorder && !last">
<li *ngFor="let object of objects?.payload?.page; let i = index; let last = last" class="mt-4 mb-4 d-flex" [class.border-bottom]="hasBorder && !last" data-e2e="list-object">
<ds-selectable-list-item-control *ngIf="selectable" [index]="i"
[object]="object"
[selectionConfig]="selectionConfig"