salix-front/test/cypress/integration/claim/claimPhoto.spec.js

50 lines
1.8 KiB
JavaScript
Raw Normal View History

2023-02-22 13:55:29 +00:00
/// <reference types="cypress" />
describe('ClaimPhoto', () => {
2025-03-04 07:54:18 +00:00
const carrouselClose = '.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon';
2023-02-22 13:55:29 +00:00
beforeEach(() => {
const claimId = 1;
2023-02-24 11:51:29 +00:00
cy.login('developer');
cy.visit(`/#/claim/${claimId}/photos`);
2023-02-22 13:55:29 +00:00
});
2023-02-23 14:20:07 +00:00
it('should add new file', () => {
cy.get('label > .q-btn').click();
cy.get('label > .q-btn input').selectFile('test/cypress/fixtures/image.jpg', {
2023-02-22 13:55:29 +00:00
force: true,
});
cy.get('.q-notification__message').should('have.text', 'Data saved');
});
it('should add new file with drag and drop', () => {
cy.get('.container').should('be.visible').and('exist');
2023-02-22 13:55:29 +00:00
cy.get('.container').selectFile('test/cypress/fixtures/image.jpg', {
action: 'drag-drop',
});
cy.get('.q-notification__message').should('have.text', 'Data saved');
});
2025-02-26 15:29:20 +00:00
2025-03-03 12:45:09 +00:00
it('should open first image dialog change to second and close', () => {
2025-03-04 07:54:18 +00:00
cy.dataCy('file-1').click();
cy.get(carrouselClose).click();
2025-03-04 07:54:18 +00:00
cy.dataCy('file-1').click();
cy.get('.q-carousel__control > button').as('nextButton').click();
2025-03-04 08:39:37 +00:00
cy.get('.q-carousel__slide > .q-ma-none').should('be.visible');
cy.get(carrouselClose).click();
2024-05-27 14:13:40 +00:00
});
2023-02-22 13:55:29 +00:00
2023-02-24 11:51:29 +00:00
it('should remove third and fourth file', () => {
cy.dataCy('delete-button-4').click();
2024-05-27 14:13:40 +00:00
cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
2024-05-27 14:13:40 +00:00
).click();
2023-02-24 11:51:29 +00:00
cy.get('.q-notification__message').should('have.text', 'Data deleted');
cy.dataCy('delete-button-3').click();
2024-05-27 14:13:40 +00:00
cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
2024-05-27 14:13:40 +00:00
).click();
2023-02-22 13:55:29 +00:00
cy.get('.q-notification__message').should('have.text', 'Data deleted');
});
});