Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINTENANCE] Complete Frontend Test #2939

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ export class ValidationSyntheseListComponent implements OnInit, OnChanges, After

viewFitList(id_observations) {
if (id_observations.length) {
this.mapListService.zoomOnSeveralSelectedLayers(this._ms.map, id_observations);

const group = this.mapListService.getSelectedLayers(this._ms.map, id_observations);
this._ms.getMap().fitBounds(group.getBounds());
}
}

Expand Down
10 changes: 10 additions & 0 deletions frontend/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default defineConfig({
fixturesFolder: 'cypress/fixtures',
defaultCommandTimeout: 30000,
requestTimeout: 10000,

e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
Expand All @@ -16,5 +17,14 @@ export default defineConfig({
},
baseUrl: 'http://127.0.0.1:4200',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
supportFile: false,
},

component: {
devServer: {
framework: 'angular',
bundler: 'webpack',
},
specPattern: '**/*.cy.ts',
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ describe('Testing metadata', () => {
description: "description de mon cadre d'acquisition",
startDate: '17/03/2022',
};
const newJdd = {
name: 'Mon jeu de données',
shortname: 'Mon jdd',
description: 'description de mon jdd',
};

beforeEach(() => {
cy.geonatureLogin();
Expand Down Expand Up @@ -47,7 +42,7 @@ describe('Testing metadata', () => {
cy.get('[data-qa="pnx-metadata-jdd-delete-' + jddUUID + '"]').should('be.disabled');

// go to the JDD detail page
cy.get('[data-qa="pnx-metadata-jdd-' + jddUUID + '"]').click();
cy.get(`[data-qa="pnx-metadata-jdd-${jddUUID}"]`).click();
cy.get('[data-qa="pnx-metadata-dataset-name"]').contains(jdd);
cy.get('[data-qa="pnx-metadata-exit-jdd"]').click();

Expand Down Expand Up @@ -115,74 +110,78 @@ describe('Testing metadata', () => {
it('should create a new "jeux de données"', () => {
cy.visit('/#/metadata');
cy.get('[data-qa="pnx-metadata-add-jdd"]').click();
cy.fixture("jdd").then((jdd) => {
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('pnx-metadata-actor > div > form > ng-select > div > div > div.ng-input').click();
cy.get('[data-qa="pnx-metadata-organism-ALL"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-select-cadre-acq"]').click();
cy.get('[data-qa="pnx-metadata-jdd-' + cadreAcq + '"]').click({ force: true });
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-input-jdd-name"]').type(newJdd.name);
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-input-jdd-shortname"]').type(newJdd.shortname);
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-input-jdd-description"]').type(newJdd.description);
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get("[data-qa='pnx-dataset-form-datatype'] > ng-select > div > div > div.ng-input").click();
cy.get('[data-qa="5"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get(
'[data-qa="pnx-dataset-form-status-source"] > ng-select > div > div > div.ng-input'
).click();
cy.get('[data-qa="Co"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-objectif"] > ng-select > div > div > div.ng-input').click();
cy.get('[data-qa="7.2"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get(
'[data-qa="pnx-dataset-form-territories"] > ng-select > div > div > div.ng-input'
).click();
cy.get('[data-qa="CLI"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get(
'[data-qa="pnx-dataset-form-collecting-method"] > ng-select > div > div > div.ng-input'
).click();
cy.get('[data-qa="12"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get(
'[data-qa="pnx-dataset-form-data-origin"] > ng-select > div > div > div.ng-input'
).click();
cy.get('[data-qa="NSP"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-resource-type"] > ng-select > div').click();
cy.get('[data-qa="1"]').click();

cy.get('[data-qa="pnx-dataset-form-save-jdd"]').click();
cy.get('[data-qa="pnx-metadata-dataset-name"]').contains(newJdd.name);
cy.get('[data-qa="pnx-metadata-exit-jdd"]').click();
cy.get('pnx-metadata-actor > div > form > ng-select > div > div > div.ng-input').click();
cy.get('[data-qa="pnx-metadata-organism-ALL"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-select-cadre-acq"]').click();
cy.get('[data-qa="pnx-metadata-jdd-' + cadreAcq + '"]').click({ force: true });
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-input-jdd-name"]').type(jdd.name);
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-input-jdd-shortname"]').type(jdd.shortname);
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-input-jdd-description"]').type(jdd.description);
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get("[data-qa='pnx-dataset-form-datatype'] > ng-select > div > div > div.ng-input").click();
cy.get('[data-qa="5"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get(
'[data-qa="pnx-dataset-form-status-source"] > ng-select > div > div > div.ng-input'
).click();
cy.get('[data-qa="Co"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-objectif"] > ng-select > div > div > div.ng-input').click();
cy.get('[data-qa="7.2"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get(
'[data-qa="pnx-dataset-form-territories"] > ng-select > div > div > div.ng-input'
).click();
cy.get('[data-qa="CLI"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get(
'[data-qa="pnx-dataset-form-collecting-method"] > ng-select > div > div > div.ng-input'
).click();
cy.get('[data-qa="12"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get(
'[data-qa="pnx-dataset-form-data-origin"] > ng-select > div > div > div.ng-input'
).click();
cy.get('[data-qa="NSP"]').click();
cy.get("[data-qa='pnx-dataset-form-save-jdd'] ").should('be.disabled');

cy.get('[data-qa="pnx-dataset-form-resource-type"] > ng-select > div').click();
cy.get('[data-qa="1"]').click();

cy.get('[data-qa="pnx-dataset-form-save-jdd"]').click();
cy.get('[data-qa="pnx-metadata-dataset-name"]').contains(jdd.name);
cy.get('[data-qa="pnx-metadata-exit-jdd"]').click();
});

});

it('should delete the new "jeux de données"', () => {
cy.get('[data-qa="pnx-metadata-search"]').clear();
cy.get('[data-qa="pnx-metadata-search"]').type(newJdd.name);
cy.wait(2000);
cy.get('[data-qa="pnx-metadata-acq-framework-header-' + caUUID + '"]').click();
cy.get('[data-qa="pnx-metadata-dataset-name-' + newJdd.name + '"] td > button').click({
multiple: true,
force: true,
cy.fixture("jdd").then((jdd) => {
cy.get('[data-qa="pnx-metadata-search"]').clear();
cy.get('[data-qa="pnx-metadata-search"]').type(jdd.name);
cy.wait(2000);
cy.get('[data-qa="pnx-metadata-acq-framework-header-' + caUUID + '"]').click();
cy.get('[data-qa="pnx-metadata-dataset-name-' + jdd.name + '"] td > button').click({
multiple: true,
force: true,
});
});
});

Expand Down
Loading
Loading