mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-10 11:42:59 +00:00
feat: improved e2e tests
This commit is contained in:
@@ -13,35 +13,40 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
describe('ratings', function () {
|
||||
const dishUid = '86464b64-da1e-5578-a5c4-eec23457f596';
|
||||
beforeEach(() => {
|
||||
cy.intercept('https://mobile.server.uni-frankfurt.de/rating', {
|
||||
body: {},
|
||||
}).as('rating');
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
|
||||
fixture: 'search/types/canteen/canteen-1.json',
|
||||
}).as('search');
|
||||
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search/multi', {
|
||||
fixture: 'search/types/dish/dish-1.json',
|
||||
cy.interceptMultiSearch({
|
||||
extends: 'canteen/dishes',
|
||||
fixture: 'canteen/dishes',
|
||||
alias: 'dishes',
|
||||
});
|
||||
cy.interceptGet({
|
||||
uid: dishUid,
|
||||
fixture: 'canteen/canteen',
|
||||
alias: 'detail',
|
||||
});
|
||||
});
|
||||
|
||||
it('should open ratings', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('.rating-stars').should('not.exist');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars').should('exist');
|
||||
});
|
||||
|
||||
it('should submit ratings', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars > ion-icon').first().click({scrollBehavior: 'center'});
|
||||
cy.wait('@rating').its('request.body.rating').should('eq', 5);
|
||||
});
|
||||
|
||||
it('should not be possible to rate twice', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars > ion-icon').first().click({scrollBehavior: 'center'});
|
||||
cy.wait('@rating');
|
||||
cy.get('stapps-rating ion-button').should('have.class', 'button-disabled');
|
||||
@@ -50,16 +55,16 @@ describe('ratings', function () {
|
||||
});
|
||||
|
||||
it('should display a thank you message', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars > ion-icon').first().click({scrollBehavior: 'center'});
|
||||
cy.wait('@rating');
|
||||
cy.get('.thank-you').should('be.visible');
|
||||
});
|
||||
|
||||
it('should be dismissible', function () {
|
||||
cy.visit('/data-detail/86464b64-da1e-5578-a5c4-eec23457f596');
|
||||
cy.get('stapps-rating').click({scrollBehavior: 'center'});
|
||||
cy.visit(`/data-detail/${dishUid}`);
|
||||
cy.get('stapps-rating').first().click({scrollBehavior: 'center'});
|
||||
cy.get('.rating-stars').should('be.visible');
|
||||
cy.get('body').click(0, 0);
|
||||
cy.get('.rating-stars').should('not.exist');
|
||||
|
||||
Reference in New Issue
Block a user