diff --git a/cypress/e2e/About.cy.js b/cypress/e2e/About.cy.js new file mode 100644 index 0000000..9b1f05f --- /dev/null +++ b/cypress/e2e/About.cy.js @@ -0,0 +1,28 @@ +describe('Footer', () => { + beforeEach(() => { + cy.visit("http://localhost:3000/about"); + + }); + + it('displays About information', () => { + cy.get('h3').contains('About').should('exist'); + cy.get('h2').contains('You start the engine and your adventure begins').should('exist'); + cy.get('p').contains('Certain but she but shyness why cottage. Guy the put instrument sir entreaties affronting. Pretended exquisite see cordially the you. Weeks quiet do vexed or whose. Motionless if no to affronting imprudence no precaution. My indulged as disposal strongly attended.').should('exist'); + + }); + + it('plan section', () => { + cy.get('h3').contains('Plan your trip now').should('exist'); + cy.get('h2').contains('Quick & easy car rental').should('exist'); + cy.get('h3').contains('Contact Operator').should('exist'); + + }); + + it('Banner', () => { + cy.get('h2').contains('Book a car by getting in touch with us').should('exist'); + cy.get('h3').contains('(123) 456-7869').should('exist'); + + }); + + }); + \ No newline at end of file diff --git a/cypress/e2e/Faq.cy.js b/cypress/e2e/Faq.cy.js new file mode 100644 index 0000000..6862d53 --- /dev/null +++ b/cypress/e2e/Faq.cy.js @@ -0,0 +1,67 @@ +describe('Faq component tests', () => { + beforeEach(() => { + cy.visit('http://localhost:3000/'); + }); + + it('renders Faq component', () => { + cy.get('.faq-content').should('exist'); + cy.get('h5').contains('FAQ'); + cy.get('h2').contains('Frequently Asked Questions'); + }); + + it('initially sets activeQ state to "q1"', () => { + cy.get('p').contains('1. What is special about comparing rental car deals?'); + cy.get('#q1').should('have.class', 'active-question'); + // Simulate a click to toggle the question state + cy.get('#q1').click(); + + // Now, the class 'active-question' should be removed + cy.get('#q1').should('not.have.class', 'active-question'); + }); + + it('initially sets activeQ state to "q2"', () => { + // the class 'active-question' should be removed + cy.get('#q2').should('not.have.class', 'active-question'); + cy.get('p').contains('2. How do I find the car rental deals?'); + // Simulate a click to toggle the question state + cy.get('#q2').click(); + cy.get('#q2').should('have.class', 'active-question'); + cy.get('#q2').click(); + cy.get('#q2').should('not.have.class', 'active-question'); + }); + + it('initially sets activeQ state to "q3"', () => { + // the class 'active-question' should be removed + cy.get('#q3').should('not.have.class', 'active-question'); + cy.get('p').contains('2. How do I find the car rental deals?'); + // Simulate a click to toggle the question state + cy.get('#q3').click(); + cy.get('#q3').should('have.class', 'active-question'); + cy.get('#q3').click(); + cy.get('#q3').should('not.have.class', 'active-question'); + }); + + it('test open close multiple times', () => { + cy.get('#q1').click(); + // the class 'active-question' should be removed + cy.get('#q1').should('not.have.class', 'active-question'); + cy.get('#q2').should('not.have.class', 'active-question'); + cy.get('#q3').should('not.have.class', 'active-question'); + + // Simulate a click to toggle the question state + cy.get('#q1').click(); + cy.get('#q1').should('have.class', 'active-question'); + cy.get('#q2').should('not.have.class', 'active-question'); + cy.get('#q3').should('not.have.class', 'active-question'); + + cy.get('#q2').click(); + cy.get('#q1').should('not.have.class', 'active-question'); + cy.get('#q2').should('have.class', 'active-question'); + cy.get('#q3').should('not.have.class', 'active-question'); + + cy.get('#q3').click(); + cy.get('#q1').should('not.have.class', 'active-question'); + cy.get('#q2').should('not.have.class', 'active-question'); + cy.get('#q3').should('have.class', 'active-question'); + }); +}); diff --git a/cypress/e2e/Footer.cy.js b/cypress/e2e/Footer.cy.js new file mode 100644 index 0000000..c0a292c --- /dev/null +++ b/cypress/e2e/Footer.cy.js @@ -0,0 +1,37 @@ +describe('Footer', () => { + beforeEach(() => { + cy.visit("http://localhost:3000/"); + + }); + + it('displays company information', () => { + cy.get('.footer-content__1').should('exist'); + + + cy.contains('CAR Rental').should('exist'); + cy.contains('We offers a big range of vehicles for all your driving needs. We have the perfect car to meet your needs.').should('exist'); + cy.contains('(123) -456-789').should('exist'); + cy.contains('carrental@gmail.com').should('exist'); + cy.contains('Design by XpeedStudio').should('exist'); + }); + + it('navigates to external link', () => { + cy.get('.footer-content__1 a[href="https://xpeedstudio.com/"]').should('exist'); + cy.get('.footer-content__1 a[href="https://xpeedstudio.com/"]').should('have.attr', 'target', '_blank'); + cy.get('.footer-content__1 a[href="https://xpeedstudio.com/"]').should('have.attr', 'rel', 'noreferrer'); + }); + + it('displays working hours', () => { + cy.get('.footer-content__2 li').contains('Working Hours').should('exist'); + cy.get('.footer-content__2 li').contains('Mon - Fri: 9:00AM - 9:00PM').should('exist'); + cy.get('.footer-content__2 li').contains('Sat: 9:00AM - 19:00PM').should('exist'); + cy.get('.footer-content__2 li').contains('Sun: Closed').should('exist'); + }); + + it('handles subscription form', () => { + cy.get('.footer-content__2 li').contains('Subscription').should('exist'); + cy.get('.footer-content__2 input[type="email"]').should('exist'); + cy.get('.footer-content__2 button.submit-email').should('exist'); + }); + }); + \ No newline at end of file diff --git a/cypress/e2e/Home.cy.js b/cypress/e2e/Home.cy.js index e265299..c008b41 100644 --- a/cypress/e2e/Home.cy.js +++ b/cypress/e2e/Home.cy.js @@ -1,10 +1,9 @@ describe('template spec', () => { + beforeEach(() => { - // Common setup code cy.visit('http://localhost:3000/'); - - }); + it('home rendering', () => { cy.visit('http://localhost:3000/') cy.contains('Book Ride').click() diff --git a/cypress/e2e/Vehicle _Models.cy.js b/cypress/e2e/Vehicle _Models.cy.js new file mode 100644 index 0000000..9f76330 --- /dev/null +++ b/cypress/e2e/Vehicle _Models.cy.js @@ -0,0 +1,19 @@ +it("show car details", () => { + cy.visit("http://localhost:3000/"); + cy.get('.pick-container__title') // replace with the actual selector for your modal + .should('be.visible') // Check if the modal is visible + .contains('Vehicle Models'); + + cy.get('.pick-description__table__col').should('be.visible').contains('Audi'); + cy.get('.pick-description__table__col').should('be.visible').contains('AC'); + + /* cy.get('BMW 320 ModernLine'); */ + cy.get('#btn4').click(); + cy.get('.pick-description__table__col').should('be.visible').contains('320'); + cy.get('.pick-description__table__col').should('be.visible').contains('BMW'); + cy.get('.pick-description__table__col').should('be.visible').contains('AC'); + cy.get('.pick-description__table__col').should('be.visible').contains('Diesel'); + + cy.get('.cta-btn').click(); + cy.expect('http://localhost:3000/#booking-section'); +}); diff --git a/cypress/e2e/back_to_top .cy.js b/cypress/e2e/back_to_top .cy.js new file mode 100644 index 0000000..04d8ca3 --- /dev/null +++ b/cypress/e2e/back_to_top .cy.js @@ -0,0 +1,19 @@ +it("show car details", () => { + cy.visit("http://localhost:3000/"); + cy.get('.pick-container__title') // replace with the actual selector for your modal + .should('be.visible') // Check if the modal is visible + .contains('Vehicle Models'); + + cy.get('.pick-description__table__col').should('be.visible').contains('Audi'); + cy.get('.pick-description__table__col').should('be.visible').contains('AC'); + + /* cy.get('BMW 320 ModernLine'); */ + cy.get('#btn4').click(); + cy.get('.pick-description__table__col').should('be.visible').contains('320'); + cy.get('.pick-description__table__col').should('be.visible').contains('BMW'); + cy.get('.pick-description__table__col').should('be.visible').contains('AC'); + cy.get('.pick-description__table__col').should('be.visible').contains('Diesel'); + + cy.get('.show-scroll').click({force: true}); + cy.get('.show-scroll').should('not.exist'); +});