Giter Site home page Giter Site logo

selenium-nodejs's Introduction

Demo for Selenium with nodejs

Screenshot

Mocha is a feature-rich JavaScript testing framework that runs on Node.js and in the browser. It provides a simple and flexible way to write unit and integration tests for your application. Selenium, on the other hand, is a popular open-source testing framework for web applications. It allows you to automate web browsers and simulate user interactions.

When combined, Mocha and Selenium can provide a powerful solution for testing web applications. Mocha allows you to write tests in a BDD or TDD style, while Selenium provides a way to interact with the web browser and simulate user actions. This combination enables you to test the functionality and user interface of your web application across different browsers and platforms.

This test will run simultaneously on Firefox and Chrome.

To test this Framework, I'm using this example ecommerce website: https://github.com/adrianhajdin/ecommerce_sanity_stripe

the test cases are:

  1. Check if the cart is empty
  2. Add an item to the cart and check if the item is in the cart
  3. Add an item to the cart, remove it from the cart, and check if the cart is empty

if the test fails, it will give you an error and will take a screenshot of the webpage

Install the webdriver

First, we need to install Mozilla Firefox and Google Chrome and then we need to install the webdriver

$ npm install geckodriver
$ npm install chromedriver

Mocha

Then we will install the mocha testing framework

$ npm install mocha

Running the tests

To run the test use this command (it is defined in the package.json)

$ npm test

selenium-nodejs's People

Contributors

andytan87 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.