Skip to content

Commit

Permalink
fix test frontend occtax
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize committed Mar 11, 2024
1 parent 7465dde commit 1e47158
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions frontend/cypress/e2e/occtax-form-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,21 @@ function filterMapList() {
cy.wait('@getReleves');
}

describe('Testing adding an observation in OccTax', {testIsolation: false}, () => {

describe('Testing adding an observation in OccTax', { testIsolation: false }, () => {
beforeEach(() => {
cy.geonatureLogin();
});


it('should not be possible to add data if any geometry had been selected', () => {
cy.visit('/#/occtax');
cy.get("[data-qa='gn-occtax-btn-add-releve']").click();

// Un recouvrement des champs de saisie (overlay) existe à l'arrivée sur la page
cy.get("div[data-qa='overlay']").click();
cy.get("div#toast-container .toast-warning div[role='alert']").should('exist');

});

it('should add a marker on map, remove overlay and btn sumbit still disabe', () => {

// Après un zoom sur la carte suffisant sur la carte et la sélection d'un point ou la sélection d'une géométrie, le recouvrement des champs de saisie n'existe plus
const plus = cy.get(
'pnx-map > div > div.leaflet-container.leaflet-touch.leaflet-fade-anim.leaflet-grab.leaflet-touch-drag.leaflet-touch-zoom > div.leaflet-control-container > div.leaflet-top.leaflet-right > div.leaflet-control-zoom.leaflet-bar.leaflet-control > a.leaflet-control-zoom-in'
Expand Down Expand Up @@ -207,11 +203,11 @@ describe('Testing adding an observation in OccTax', {testIsolation: false}, () =
// });
// });

// it("Should focus on taxa input", ()=> {
// cy.focused()
// .invoke('attr', 'data-qa')
// .should('eq', 'taxonomy-form-input')
// });
// it("Should focus on taxa input", ()=> {
// cy.focused()
// .invoke('attr', 'data-qa')
// .should('eq', 'taxonomy-form-input')
// });

it('Should be possible to search and select taxa', () => {
const taxonInput = cy.get("input[data-qa='taxonomy-form-input'].ng-invalid");
Expand All @@ -222,7 +218,6 @@ describe('Testing adding an observation in OccTax', {testIsolation: false}, () =
nomValideResult.contains('Canis lupus');
cy.get('[data-qa="occurrence-add-btn"]').should('be.enabled');


cy.get(
'[data-qa="pnx-nomenclature-meth-obs"] > ng-select > div > span.ng-clear-wrapper.ng-star-inserted'
).click();
Expand Down Expand Up @@ -270,10 +265,8 @@ describe('Testing adding an observation in OccTax', {testIsolation: false}, () =
.get('[data-qa="pnx-occtax-taxon-form-count"]')
.children()
.should('have.length', 2);

});


it('Should autocomplete count max with count min value', () => {
// HACK : must reselect countin min from selector otherwise it clear the wrong input (?!) ...
cy.get("[data-qa='counting-count-min']").should('have.value', 1);
Expand Down Expand Up @@ -321,10 +314,7 @@ describe('Testing adding an observation in OccTax', {testIsolation: false}, () =
const cyTaxaHead = cy.get('[data-qa="pnx-occtax-taxon-form-taxa-head-0"]');
cyTaxaHead.should('have.text', taxaNameRef);
cyTaxaHead.click();
cy.get('[data-qa="pnx-occtax-taxon-form-taxa-name-0"]').should('have.text', taxaNameRef);
//Should display good taxa's name
cy.get('[data-qa="pnx-occtax-taxon-form-taxa-name-0"]').should('have.text', taxaNameRef);

cy.get('[data-qa="pnx-occtax-taxon-form-taxa-name-0"]').should('include.text', taxaNameRef);
});

it('Should close observation', () => {
Expand All @@ -347,7 +337,6 @@ describe('Testing adding an observation in OccTax', {testIsolation: false}, () =

it('should edit a releve', () => {
cy.get('[data-qa="edit-releve"]').first().click();

});
it('Should display date', () => {
cy.get("[data-qa='pnx-occtax-releve-form-datemax'] [data-qa='input-date']").should(
Expand Down

0 comments on commit 1e47158

Please sign in to comment.