mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 17:42:57 +00:00
feat: improved e2e tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* Copyright (C) 2023 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -15,34 +15,41 @@
|
||||
|
||||
describe('search', function () {
|
||||
beforeEach(function () {
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/test.json',
|
||||
cy.interceptSearch({
|
||||
extends: {query: 'test'},
|
||||
fixture: 'search/generic',
|
||||
alias: 'search',
|
||||
});
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search/multi', {
|
||||
fixture: 'search/multi-result.json',
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'search/event-chips',
|
||||
fixture: 'search/event-chips',
|
||||
alias: 'eventChips',
|
||||
});
|
||||
cy.visit('/search');
|
||||
cy.patchSearchPage();
|
||||
});
|
||||
|
||||
it('should have search results', function () {
|
||||
cy.visit('/search');
|
||||
cy.get('ion-searchbar').type('test');
|
||||
cy.wait('@search');
|
||||
cy.get('stapps-data-list-item').should('have.length.greaterThan', 1);
|
||||
});
|
||||
|
||||
it('should display an error message when no results are found', function () {
|
||||
cy.visit('/search');
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/no-results.json',
|
||||
const query = 'a';
|
||||
cy.interceptSearch({
|
||||
extends: {query},
|
||||
});
|
||||
cy.get('ion-searchbar').type(Array.from({length: 10}, () => 'a').join(''));
|
||||
cy.get('ion-searchbar').type(query);
|
||||
cy.wait('@search');
|
||||
cy.get('stapps-data-list-item').should('have.length', 0);
|
||||
cy.get('stapps-data-list').contains('Keine Ergebnisse');
|
||||
});
|
||||
|
||||
it('should have a working clear button', function () {
|
||||
cy.visit('/search');
|
||||
cy.get('ion-searchbar').type('test');
|
||||
cy.get('ion-searchbar').should('have.value', 'test');
|
||||
cy.wait('@search');
|
||||
cy.get('stapps-data-list-item').should('have.length.greaterThan', 1);
|
||||
cy.get('.searchbar-clear-button').click();
|
||||
cy.get('ion-searchbar').should('have.value', '');
|
||||
|
||||
Reference in New Issue
Block a user