Skip to content

Commit

Permalink
Merge pull request #4 from stazrouti/testing
Browse files Browse the repository at this point in the history
Testing
  • Loading branch information
stazrouti committed Feb 7, 2024
2 parents b1b6a38 + 701c6e8 commit fa83793
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 25 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/Cypress.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ module.exports = defineConfig({
bundler: "webpack",
},
},

e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
29 changes: 29 additions & 0 deletions cypress/e2e/Home.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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()
//book ride
//Select car
cy.get('select#Select-Your-Car-Type').select('Toyota Camry');
//Select pickup
cy.get('select#Pick-up').select('Nis');
//select dropof
cy.get('select#Drop-of').select('Belgrade');
//select date
cy.get('input#picktime').type('2021-05-05');
//drop time
cy.get('input#droptime').type('2021-10-05');
//search book
cy.contains('Search').click();
});



})

56 changes: 56 additions & 0 deletions cypress/e2e/reservation.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
it('book ride', () => {
cy.visit('http://localhost:3000/')
cy.contains('Book Ride').click()
//book ride
//Select car
cy.get('select#Select-Your-Car-Type').select('Toyota Camry');
//Select pickup
cy.get('select#Pick-up').select('Nis');
//select dropof
cy.get('select#Drop-of').select('Belgrade');
//select date
cy.get('input#picktime').type('2021-05-05');
//drop time
cy.get('input#droptime').type('2021-10-05');
//search book
cy.contains('Search').click();
cy.get('.booking-modal') // replace with the actual selector for your modal
.should('be.visible') // Check if the modal is visible
.contains('Toyota Camry') // Check if the modal contains the text

cy.get('h6').contains('Pick-Up Location').should('be.visible');
cy.get('p').contains('Nis').should('be.visible');
cy.get('h6').contains('Drop-Off Location').should('be.visible');
cy.get('p').contains('Belgrade').should('be.visible');

//complete reservation information
cy.get('input[placeholder="Enter your first name"]').type("Aute et consequatur");
cy.get('input[placeholder="Enter your first name"]').should('have.value', "Aute et consequatur");

cy.get('input[placeholder="Enter your last name"]').type("Aute et consequatur");
cy.get('input[placeholder="Enter your last name"]').should('have.value', "Aute et consequatur");

cy.get('input[placeholder="Enter your phone number"]').type("Aute et consequatur");
cy.get('input[placeholder="Enter your first name"]').should('have.value', "Aute et consequatur");

cy.get('input[placeholder="18"]').type("Aute et consequatur");
cy.get('input[placeholder="18"]').should('have.value', "");
cy.get('input[placeholder="18"]').type("20");


cy.get('input[placeholder="Enter your email address"]').type("Aute et consequatur");
/* cy.get('input[placeholder="Enter your email address"]').should('have.value', ""); */

cy.get('input[placeholder="Enter your street address"]').type("Aute et consequatur");
cy.get('input[placeholder="Enter your street address"]').should('have.value', "Aute et consequatur");

cy.get('input[placeholder="Enter your city"]').type("Aute et consequatur");
cy.get('input[placeholder="Enter your city"]').should('have.value', "Aute et consequatur");

cy.get('input[placeholder="Enter your zip code"]').type("1234");
cy.get('input[placeholder="Enter your zip code"]').should('have.value', "1234");
//click on reservation button
cy.contains('Reserve').click();
cy.contains("Check your email to confirm an order.");

})
20 changes: 20 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

0 comments on commit fa83793

Please sign in to comment.