/example-booking-tests-with-webdriverio

This is a project example with JavaScript and WebdriverIO using the booking.com.

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Example Booking Tests Using Webdriver.IO.

A search on the Booking.com website was proposed for this challenge, using the city of Porto, check-in for the 1st day of the next month, and check-out for the 7th day of the next month.

After consulting the automation, it must log the number of properties and list all the properties presented on the first page.

Below we have an index with all the necessary steps to read, execute and maintain the code.




🖐🏻 Approach

I preferred using the best practices and approaches for in the future we have easy maintenance and the best project evolution.

For this project, I decided to use the WebdriverIO framework because I haven't experience with Cypress. For more details about WebdriveIO, please access the documentation.

💾 Dependecies


📁 How to access the project

To clone this project click here

To install all dependencies and run, just execute the below command in the root folder:

npm install

🛠️ Open and run the project

This project is able to run all tests in Google Chrome Browser, if you like to perform the tests in another browser, feel free to change the configuration file.


🛥 Example to select browsers:

  • Google Chrome
capabilities: [
  {
    maxInstances: 1,
    browserName: "chrome",
    acceptInsecureCerts: true,
  }
]
  • Mozilla Firefox
capabilities: [
  {
    maxInstances: 1,
    browserName: "firefox",
    acceptInsecureCerts: true,
  }
]
  • Apple Safari
capabilities: [
  {
    maxInstances: 1,
    browserName: "safari",
    acceptInsecureCerts: true,
  }
]

Remeber to enable the Webdriver Support

  • For multiple Browser at the same time
capabilities: [
{
    maxInstances: 1,
    browserName: "chrome",
    acceptInsecureCerts: true,
  },
  {
    maxInstances: 1,
    browserName: "firefox",
    acceptInsecureCerts: true,
  }
]

🔎 Inspection Code

  • Lint

A tool for identifying and reporting on patterns found in ECMAScript/JavaScript code, with the goal of making code more consistent and avoiding bugs. Use the command below to verify this project:

npm run lint

If you use the Microsoft VSCODE, the IDE accept the current configuration file.

  • Audit Submits all dependencies configured in this project to your default registry and asks for a report of known vulnerabilities.
npm audit
  • Prettier

Keep the code with a default formatter pattern defined by the company, for this task use the command below to execute the prettier:

npm run format

✅ Test Execution

npm test