From a11b5fad6028dd8a1ebb34d7f77dfdf2596a7b65 Mon Sep 17 00:00:00 2001 From: PontusPilatus Date: Thu, 16 May 2024 14:56:27 +0200 Subject: [PATCH] added test for contact us --- Cypress/specs/contactUs.feature | 7 +++++++ Cypress/specs/step_definitions/contactUs.js | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Cypress/specs/contactUs.feature create mode 100644 Cypress/specs/step_definitions/contactUs.js diff --git a/Cypress/specs/contactUs.feature b/Cypress/specs/contactUs.feature new file mode 100644 index 0000000..fb1c861 --- /dev/null +++ b/Cypress/specs/contactUs.feature @@ -0,0 +1,7 @@ +Feature: Contact Us + + Scenario: Navigate to Contact Us page and send a message + Given I am on the homepage + When I click on Contact Us + Then I can fill in my name, email and message + Then I can submit my message diff --git a/Cypress/specs/step_definitions/contactUs.js b/Cypress/specs/step_definitions/contactUs.js new file mode 100644 index 0000000..3e512be --- /dev/null +++ b/Cypress/specs/step_definitions/contactUs.js @@ -0,0 +1,19 @@ +import { Given, When, Then } from "@badeball/cypress-cucumber-preprocessor"; + +When('I click on Contact Us', () => { + cy.get(':nth-child(4) > a').click(); +}); + +Then('I should be on the Contact Us page', () => { + cy.url().should('include', '/contact'); +}); + +Then('I can fill in my name, email and message', () => { + cy.get('#name').type('Testköpare'); + cy.get('#email').type('test@mail.se'); + cy.get('#message').type('This is a test message'); +}); + +Then('I can submit my message', () => { + cy.get('form > button').click(); +}); \ No newline at end of file