From d9049e3de54ec41d202d8aa78762b55d30f24997 Mon Sep 17 00:00:00 2001 From: annelein Date: Wed, 12 Jun 2024 17:17:20 +0200 Subject: [PATCH] fix failing tests --- .../customize_class_page/customize_class.cy.js | 1 + .../customize_class_page/quiz_parsons.cy.js | 8 ++++---- tests/cypress/e2e/tools/classes/class.js | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/cypress/e2e/for-teacher_page/customize_class_page/customize_class.cy.js b/tests/cypress/e2e/for-teacher_page/customize_class_page/customize_class.cy.js index 5debac1ded5..c95e268021d 100644 --- a/tests/cypress/e2e/for-teacher_page/customize_class_page/customize_class.cy.js +++ b/tests/cypress/e2e/for-teacher_page/customize_class_page/customize_class.cy.js @@ -17,6 +17,7 @@ teachers.forEach((teacher) => { cy.intercept('/for-teachers/customize-class/*').as('updateCustomizations'); // Fill in the quiz score cy.getDataCy('quiz_input').clear().type("50").should("have.value", "50"); + cy.wait(500); cy.wait('@updateCustomizations').should('have.nested.property', 'response.statusCode', 200); cy.wait(4000); diff --git a/tests/cypress/e2e/for-teacher_page/customize_class_page/quiz_parsons.cy.js b/tests/cypress/e2e/for-teacher_page/customize_class_page/quiz_parsons.cy.js index 286da16aad3..3555171699a 100644 --- a/tests/cypress/e2e/for-teacher_page/customize_class_page/quiz_parsons.cy.js +++ b/tests/cypress/e2e/for-teacher_page/customize_class_page/quiz_parsons.cy.js @@ -18,10 +18,12 @@ describe('customize class page', () => { selectLevel('2'); // remove the quiz + cy.getDataCy('hide_quiz').scrollIntoView().should('be.visible'); cy.getDataCy('hide_quiz').click(); cy.getDataCy('quiz').should("not.exist") // remove the puzzle + cy.getDataCy('hide_parsons').scrollIntoView().should('be.visible'); cy.getDataCy('hide_parsons').click(); cy.getDataCy('parsons').should("not.exist") @@ -30,11 +32,9 @@ describe('customize class page', () => { cy.getDataCy('available_adventures_current_level').select("parsons") // Now the order should be quiz as last, then parsons. - cy.getDataCy('parsons').should("exist") - + cy.getDataCy('parsons').scrollIntoView().should("exist") // scrol to get quiz into view and make sure its the last one - cy.getDataCy('quiz').scrollIntoView().should('be.visible'); - cy.getDataCy('quiz').last().should("exist") + cy.getDataCy('quiz').scrollIntoView().last().should("exist"); // make sure they are visible loginForStudent(); diff --git a/tests/cypress/e2e/tools/classes/class.js b/tests/cypress/e2e/tools/classes/class.js index e4d6cead19a..64c82f8f193 100644 --- a/tests/cypress/e2e/tools/classes/class.js +++ b/tests/cypress/e2e/tools/classes/class.js @@ -81,10 +81,11 @@ export function openClass(classname) { } export function removeCustomizations(){ - cy.getDataCy('customize_class_button').click(); cy.intercept('/for-teachers/restore-customizations*').as('restoreCustomizations'); + cy.getDataCy('customize_class_button').click(); cy.getDataCy('remove_customizations_button').click(); cy.getDataCy('modal_yes_button').click(); + cy.wait(500); cy.wait('@restoreCustomizations').should('have.nested.property', 'response.statusCode', 200); cy.wait(4000); }