salix-front/test/cypress/integration/parking/parkingList.spec.js

34 lines
1.1 KiB
JavaScript

/// <reference types="cypress" />
describe('ParkingList', () => {
const searchbar = '#searchbar input';
const firstCard = '.q-card:nth-child(1)';
const firstChipId =
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
const firstDetailBtn =
':nth-child(1) > :nth-child(1) > .card-list-body > .actions > .q-btn';
const summaryHeader = '.summaryBody .header';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/parking/list`);
});
it('should redirect on clicking a parking', () => {
cy.get(searchbar).type('{enter}');
cy.get(firstChipId)
.invoke('text')
.then((content) => {
const id = content.substring(4);
cy.get(firstCard).click();
cy.url().should('include', `/parking/${id}/summary`);
});
});
it('should open the details', () => {
cy.get(searchbar).type('{enter}');
cy.get(firstDetailBtn).click();
cy.get(summaryHeader).contains('Basic data');
});
});