mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Fix bugs / stability issues with search e2e tests
This commit is contained in:
@@ -31,7 +31,7 @@ describe('Search from Navigation Bar', () => {
|
|||||||
// Wait for search results to come back from the above GET command
|
// Wait for search results to come back from the above GET command
|
||||||
cy.wait('@search-results');
|
cy.wait('@search-results');
|
||||||
// At least one search result should be displayed
|
// 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)', () => {
|
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
|
// Wait for search results to come back from the above GET command
|
||||||
cy.wait('@search-results');
|
cy.wait('@search-results');
|
||||||
// At least one search result should be displayed
|
// 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', () => {
|
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
|
// Wait for search results to come back from the above GET command
|
||||||
cy.wait('@search-results');
|
cy.wait('@search-results');
|
||||||
// At least one search result should be displayed
|
// 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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,13 +1,8 @@
|
|||||||
import { Options } from 'cypress-axe';
|
import { Options } from 'cypress-axe';
|
||||||
|
import { TEST_SEARCH_TERM } from 'cypress/support';
|
||||||
import { testA11y } from 'cypress/support/utils';
|
import { testA11y } from 'cypress/support/utils';
|
||||||
|
|
||||||
describe('Search Page', () => {
|
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', () => {
|
it('should redirect to the correct url when query was set and submit button was triggered', () => {
|
||||||
const queryString = 'Another interesting query string';
|
const queryString = 'Another interesting query string';
|
||||||
cy.visit('/search');
|
cy.visit('/search');
|
||||||
@@ -18,13 +13,14 @@ describe('Search Page', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should load results and pass accessibility tests', () => {
|
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
|
// <ds-search-page> tag must be loaded
|
||||||
cy.get('ds-search-page').should('exist');
|
cy.get('ds-search-page').should('exist');
|
||||||
|
|
||||||
// At least one search result should be displayed
|
// 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
|
// Click each filter toggle to open *every* filter
|
||||||
// (As we want to scan filter section for accessibility issues as well)
|
// (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', () => {
|
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
|
// Click button in sidebar to display grid view
|
||||||
cy.get('ds-search-sidebar [data-e2e="grid-view"]').click();
|
cy.get('ds-search-sidebar [data-e2e="grid-view"]').click();
|
||||||
@@ -57,8 +53,8 @@ describe('Search Page', () => {
|
|||||||
// <ds-search-page> tag must be loaded
|
// <ds-search-page> tag must be loaded
|
||||||
cy.get('ds-search-page').should('exist');
|
cy.get('ds-search-page').should('exist');
|
||||||
|
|
||||||
// At least one grid element (card) should be displayed
|
// At least one grid object (card) should be displayed
|
||||||
cy.get('ds-item-search-result-grid-element').should('be.visible');
|
cy.get('[data-e2e="grid-object"]').should('be.visible');
|
||||||
|
|
||||||
// Analyze <ds-search-page> for accessibility issues
|
// Analyze <ds-search-page> for accessibility issues
|
||||||
testA11y('ds-search-page',
|
testA11y('ds-search-page',
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
(paginationChange)="onPaginationChange($event)">
|
(paginationChange)="onPaginationChange($event)">
|
||||||
<div class="card-columns row" *ngIf="objects?.hasSucceeded">
|
<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-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>
|
<ds-listable-object-component-loader [object]="object" [viewMode]="viewMode" [context]="context" [linkType]="linkType"></ds-listable-object-component-loader>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
(sortFieldChange)="onSortFieldChange($event)"
|
(sortFieldChange)="onSortFieldChange($event)"
|
||||||
(paginationChange)="onPaginationChange($event)">
|
(paginationChange)="onPaginationChange($event)">
|
||||||
<ul *ngIf="objects?.hasSucceeded" class="list-unstyled" [ngClass]="{'ml-4': selectable}">
|
<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"
|
<ds-selectable-list-item-control *ngIf="selectable" [index]="i"
|
||||||
[object]="object"
|
[object]="object"
|
||||||
[selectionConfig]="selectionConfig"
|
[selectionConfig]="selectionConfig"
|
||||||
|
Reference in New Issue
Block a user