Skip to content

Commit

Permalink
Merge pull request #5 from stazrouti/testing
Browse files Browse the repository at this point in the history
Testing
  • Loading branch information
stazrouti committed Feb 11, 2024
2 parents fa83793 + c037cc3 commit ff98b97
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 3 deletions.
28 changes: 28 additions & 0 deletions cypress/e2e/About.cy.js
Original file line number Diff line number Diff line change
@@ -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');

});

});

67 changes: 67 additions & 0 deletions cypress/e2e/Faq.cy.js
Original file line number Diff line number Diff line change
@@ -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');
});
});
37 changes: 37 additions & 0 deletions cypress/e2e/Footer.cy.js
Original file line number Diff line number Diff line change
@@ -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('[email protected]').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');
});
});

5 changes: 2 additions & 3 deletions cypress/e2e/Home.cy.js
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
19 changes: 19 additions & 0 deletions cypress/e2e/Vehicle _Models.cy.js
Original file line number Diff line number Diff line change
@@ -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');
});
19 changes: 19 additions & 0 deletions cypress/e2e/back_to_top .cy.js
Original file line number Diff line number Diff line change
@@ -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');
});

0 comments on commit ff98b97

Please sign in to comment.