Skip to content

Commit

Permalink
test: delete some .wait or reduce time
Browse files Browse the repository at this point in the history
  • Loading branch information
syl-p committed Nov 26, 2021
1 parent addcafa commit 278b7aa
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 28 deletions.
4 changes: 1 addition & 3 deletions cypress/integration/pia-angular/client_serveur.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ describe("Client-Server", () => {
cy.get(".pia-navigationBlock-dropdown")
.eq(0)
.trigger("mouseover");
cy.wait(500);
cy.get(".ng-untouched fieldset a")
.eq(0)
.click({ force: true });
cy.wait(500);
});
});

Expand All @@ -41,7 +39,7 @@ describe("Client-Server", () => {
context("Redirection", () => {
it("Click on save", () => {
cy.get(".btn-green").click();
cy.wait(5000);
cy.wait(500); // For animation
cy.get(".btn-green")
.eq(1)
.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ describe("Validation", () => {

it("should valid pia", () => {
cy.validatePia();
// cy.closeValidationEvaluationModal();
});

it("should show report", () => {
Expand Down
7 changes: 2 additions & 5 deletions cypress/integration/pia-angular/entries_card.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ describe("Entries_card", () => {
* Create new pia
*/
it("should add new pia", () => {
cy.create_new_pia().then(() => {
cy.wait(500);
});
cy.create_new_pia();
});

/**
Expand All @@ -38,7 +36,6 @@ describe("Entries_card", () => {
//cy.wait(500);
// Redirect into entries
cy.visit(`/#/entries`);
cy.wait(3000);
cy.get("#pia-edit-2-name")
.clear()
.type("pia edited");
Expand All @@ -59,7 +56,7 @@ describe("Entries_card", () => {
it("should duplicate pia", () => {
// Redirect into entries
cy.visit(`/#/entries`);
cy.wait(3000);
cy.wait(1000); // For async loading (pia list)
cy.get(".pia-cardsBlock.pia").should("have.length", 1);
cy.get(".pia-cardsBlock-toolbar-export a")
.eq(1)
Expand Down
3 changes: 2 additions & 1 deletion cypress/integration/pia-angular/entries_table.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ describe("Entries_table", () => {
// Redirect into entries
cy.visit(`/#/entries`);
cy.get(".pia-filtersBlock-switch").click();
cy.wait(3000);

cy.wait(1000); // for async loading (pia list)
//Edit Title
cy.get(".pia-list-table tbody tr td:eq(1) div")
.click()
Expand Down
1 change: 0 additions & 1 deletion cypress/integration/pia-angular/extra_tests_spec.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ describe("Test Search KnowledgeBase", () => {
it("should search an element", () => {
cy.create_new_pia().then(() => {
cy.visit("/#/pia/2/section/2/item/2");
cy.wait(3000);
cy.get(".pia-knowledgeBaseBlock-searchForm")
.find("input")
.type("Transf");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export function fundamental_principle_validation() {
it("should acept evaluation", () => {
cy.get_current_pia_id(id => {
cy.go_edited_pia(id, 2, 2).then(() => {
cy.wait(3000);
cy.acceptMultipleEval();
cy.closeValidationEvaluationModal();
});
Expand Down
24 changes: 8 additions & 16 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,12 @@ Cypress.Commands.add("skip_onboarding", () => {
});

Cypress.Commands.add("focus_out", () => {
cy.wait(1000);
cy.get(".pia-knowledgeBaseBlock-searchForm form input").type("aaa");
});

Cypress.Commands.add("go_edited_pia", (id = 2, section = 1, item = 1) => {
cy.visit(`/#/pia/${id}/section/${section}/item/${item}`);
cy.wait(3000);
cy.wait(3000); // Let time to load async data (sidebar, content, evaluation...)
});

Cypress.Commands.add("import_pia", () => {
Expand All @@ -69,9 +68,7 @@ Cypress.Commands.add("import_pia", () => {

// Import
cy.get('input[type="file"]#import_file').attachFile(filepath);
cy.wait(5000);

// there is a new pia ?
cy.wait(1000); // Wait for new data save
cy.get(".pia-cardsBlock.pia").should("have.length", 1);
});
/**
Expand All @@ -85,7 +82,6 @@ Cypress.Commands.add("click_on_start", () => {
Cypress.Commands.add("create_new_pia", () => {
cy.click_on_start();
cy.get(".pia-newBlock-item-new-btn button").click();
cy.wait(500);
cy.get("#name").type("PIA Title");
cy.get("#author_name").type("Author name");
cy.get("#evaluator_name").type("Evaluator name");
Expand Down Expand Up @@ -141,8 +137,7 @@ Cypress.Commands.add("test_add_measure", () => {
);
cy.wrap($el)
.parent()
.wait(500)
.click();
.click({ force: true });

expect($el.find("textarea").val().length > 0).to.be.true;

Expand All @@ -163,8 +158,7 @@ Cypress.Commands.add("test_add_measure_from_sidebar", () => {
);
cy.wrap($el)
.parent()
.wait(500)
.click();
.click({ force: true });

expect($el.find("textarea").val().length > 0).to.be.true;

Expand All @@ -191,6 +185,7 @@ Cypress.Commands.add("test_add_tags", () => {
.click({ force: true });
});
});

Cypress.Commands.add("test_add_tags_next", () => {
cy.get("[aria-label='Enter the potential impacts']")
.type("Tag")
Expand Down Expand Up @@ -281,19 +276,16 @@ Cypress.Commands.add("closeCompletedValidationEvaluationModal", () => {
.wait(500);
});
Cypress.Commands.add("closeValidationEvaluationModal", () => {
cy.wait(1000)
.get("#validate-evaluation")
cy.get("#validate-evaluation")
.invoke("show")
.find(".pia-modalBlock-close")
.first()
.click()
.wait(1000);
.click();
});
Cypress.Commands.add("validateModal", () => {
cy.wait(500)
.get(".pia-modalBlock-content .btn.btn-green")
.click()
.wait(500);
.click();
});
Cypress.Commands.add("redirectMeasureOnAcceptation", () => {
cy.visit("/#/entry/2/section/3/item/3");
Expand Down

0 comments on commit 278b7aa

Please sign in to comment.