From 5f4e04f7bdd2cdeed8bf45e456bf45550f6dc9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Rebelo?= Date: Tue, 25 Jul 2023 01:58:47 +0200 Subject: [PATCH] test: minor fixes --- cypress/e2e/evolution.cy.js | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/cypress/e2e/evolution.cy.js b/cypress/e2e/evolution.cy.js index 95f126a..3b91ff8 100644 --- a/cypress/e2e/evolution.cy.js +++ b/cypress/e2e/evolution.cy.js @@ -14,12 +14,12 @@ for (let i in TESTING_EXAMPLES) { cy.visit(`http://localhost:8000`); }); - it(`a new poster for the text ${e.text} (no elite)`, () => { - evolve(e.text, 0); + it(`a new poster for the text ${e.text} (elite = 1)`, () => { + evolve(e.text, 1); }); - it(`a new poster for the text ${e.text} (elite=1)`, () => { - evolve(e.text, 1); + it(`a new poster for the text ${e.text} (no elite)`, () => { + evolve(e.text, 0); }); }); } @@ -31,19 +31,15 @@ const evolve = (text, elite = 0) => { cy.get('button.btn.btn-primary.mb-2').click(); cy.get('#bt-start-evo').click(); cy.get('#evolve-bt').click(); - if (elite > 0) { - cy.get('#elite-size-input').invoke('val', elite).trigger('change'); - } - cy.get('#start-bt').click(); - cy.get('.navbar-toggler-icon').click(); - - cy.window().then((w) => { - // evolving - // expect(w.app.population.evolving, { timeout: 600000 }).to.equal(false); - cy.wrap(isEvolving(w.app.population), { timeout: 600000 }).then((res) => { - console.log (`evolution is complete (no. generations=${res.nGen})`); - }) - + cy.get('#elite-size-input').invoke('val', elite).trigger('change').then(() => { + cy.get('#start-bt').click(); + cy.get('.navbar-toggler-icon').click(); + cy.window().then((w) => { + // evolving + cy.wrap(isEvolving(w.app.population), { timeout: 600000 }).then((res) => { + console.log (`evolution is complete (no. generations=${res.nGen})`); + }) + }); }); }