From 78ad976e76e3d5e886a416b1388d5090b1cff426 Mon Sep 17 00:00:00 2001 From: Daniil Tkachev Date: Thu, 16 Jan 2025 12:06:51 +0100 Subject: [PATCH] TC-47 Test cypress e2e --- .github/oxid-esales/cypress.sh | 15 +++++++++-- .../frontend_tests/home_page_test.cy.js | 26 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.github/oxid-esales/cypress.sh b/.github/oxid-esales/cypress.sh index 8d64995..4abf25c 100755 --- a/.github/oxid-esales/cypress.sh +++ b/.github/oxid-esales/cypress.sh @@ -115,15 +115,16 @@ docker compose up -d || { mv docker-compose.yml.backup docker-compose.yml exit 1 } +$EXIT_CODE=$? echo "Waiting for services to stabilize..." sleep 30 -"$SCRIPT_DIR/db_backup.sh" restore +#"$SCRIPT_DIR/db_backup.sh" restore echo "Displaying Cypress logs..." docker compose logs cypress || echo "No logs available for Cypress." - +exit $EXIT_CODE NO_MAKE_UP=false # Parse arguments @@ -143,3 +144,13 @@ if [ "$NO_MAKE_UP" == "false" ]; then else echo -e "${GREEN}Skipping 'make up' as per user request (--no_make_up=true).${NC}" fi + + +# Exit with the Cypress exit code +if [ $EXIT_CODE -eq 0 ]; then + echo "Cypress tests passed successfully!" + exit 0 +else + echo "Cypress tests failed with exit code: $EXIT_CODE" + exit $EXIT_CODE +fi diff --git a/tests/e2e/cypress/frontend_tests/home_page_test.cy.js b/tests/e2e/cypress/frontend_tests/home_page_test.cy.js index bbe93fc..a519626 100644 --- a/tests/e2e/cypress/frontend_tests/home_page_test.cy.js +++ b/tests/e2e/cypress/frontend_tests/home_page_test.cy.js @@ -42,6 +42,32 @@ describe('Login Test', () => { cy.wait(1000); cy.get('.sticky-md-top button.btn.btn-highlight.btn-lg.w-100') + .click({ force: true }); + + cy.get('#brandTypeSelect + .select2') + .click(); + + // Then click on the VISA option + cy.get('.select2-results__option:contains("VISA")') + .click(); + + // Now continue with filling in the card details + cy.get('#cardNumber') + .should('be.visible') + .type('4921 8180 8989 8988'); + + cy.get('#expiryMonth') + .select('12'); + + cy.get('#expiryYear') + .select('2025'); + + cy.get('#cardCode_masked') + .type('999'); + + cy.wait(3000); + + cy.get('#buttonRow #nextBtn') .should('be.visible') .click();