Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Learn Web Automation testing using Selenium Webdriver 4.

License

NotificationsYou must be signed in to change notification settings

mfaisalkhatri/selenium4poc

Repository files navigation

Open Source LoveLicenseJava CI with MavenCodeQL

Don't forget to give a ⭐ to make the project popular.

❓ What is this Repository about?

Talking more about the Scenarios Covered in this project:

  • I have tried to answer the below questions by providing working code example in this repo:
  1. How do I select a value from Table?
  2. How do I tick and untick checkboxes using selenium
  3. How do I right-click using selenium?
  4. How do I drag and drop using selenium?
  5. How do I write code to log in and logout using Selenium?
  6. How do I pass multiple test data value using DataProvider in tests?
  7. How do I mouse hover an element using selenium?
  8. How do I download a file using Selenium?
  9. How do I upload file using selenium?
  10. How do I press keys using selenium?
  11. How do I work with multiple Tab windows in selenium?
  12. How do I work with iFrames using Selenium?
  13. How do I double-click using Selenium WebDriver?
  14. How to check for chrome generated logs when selenium tests are run?

✍️ Blog Links

🎥 Tutorial Videos

Watch the videoWatch the videoWatch the videoWatch the videoWatch the videoWatch the videoWatch the videoWatch the video)

End-to-End Tests for OWASP-Juice-Shop

  • End-to-End tests for Juice Shop Website are running onhttp://localhost:3000 inside the container in GitHub actions.
  • GitHub Actions is used for setting up CI/CD Pipeline

Following is the Automation Test Strategy used for writing End-to-End Tests:

  1. User will navigate to the website and close all the pop-up first.
  2. User will click on Login link and click onNot yet a customer link and register himself on the website.
  3. Once the Registration is successful, User will Log in with that username and password.
  4. After successful Login, User will Add AppleJuice and BananaJuice to the Basket.
  5. After asserting the messages for items added to basket, user will check for the count of items displayed on topofYour Basket link.
  6. User will click onYour Basket link and check the order details and click on Checkout.
  7. User will enter a new Address for Delivery and select it to process further.
  8. User will continue further to Card for Payment and select the card added to make payment.
  9. On the Order Summary page, user will verify all the details like Name, Address, Order details and total amount to bepaid and place order.
  10. User will re-check the details on Order confirmation page and check forThank You message order confirmation anddelivery message.

End-to-End Tests for LambdaTest ECommerce Playground Website

Following is the automation test strategy used for writing end-to-end tests:

  1. The User will navigate to the website.
  2. From the Home Page of the screen, user will navigate to the Registration Page and register himself. Verification willbe done by asserting the registration successful message.
  3. User will click on the Shop by Category option on the top left and select a category for selecting the product topurchase.
  4. From the Product Page, the user will hover on any product which he likes and select the Add to cart option. Once aproduct is added to cart, assertions will be performed to check the success message displayed.
  5. On the Checkout page, user will provide the billing address details and also assertion will be made for product nameand its respective price.
  6. Once a product is checked out, the user lands on the Order Confirmation page, where product name, price and shippingaddress will be asserted and after that Order would be marked as confirmed.
  7. Finally, an Order confirmation message would be verified in the tests which marks the end of the test journey.

How to run the Tests?

Running Juice Shop Tests on your local machine:

  • StartJuice-Shop website locally, for doing this we will make use ofdocker-compose-v3-juiceshop.yml which isavailable in the root folder of this project.

  • Open terminal/command prompt and navigate to the root folder of the project and run the following command:

    docker-compose -f docker-compose-v3-juiceshop.yml up -d

  • Once theJuice-Shop website is up and running, we are good to run the end-to-end tests using the juice shop website.

  • There are 2 ways to run the tests, those are as follows:

    1. TestNG:

    • Right-Click on thetest-suite\testng-juice-shop.xml and selectRun ...\test-suite\testng-juice-shop.xml

    2. Maven:

    • To run the tests in headless mode update the value forheadless property variable totrue

      mvn clean install -Dsuite-xml=test-suite\testng-juice-shop.xml -Dheadless=true

    • To run the tests without headless mode(to see the test running in browser) update the value for headless propertyvariable tofalse

      mvn clean install -Dsuite-xml=test-suite\testng-juice-shop.xml -Dheadless=false

  • Stopping the Juice Shop website running in local

    docker-compose -f docker-compose-v3-juiceshop.yml down

Running Selenium Grid on local and running tests using Selenium Grid

  • Start the Selenium Grid in local using thedocker-compose-v3-seleniumgrid.yml file.

  • Run the following command:docker-compose -f docker-compose-v3-seleniumgrid.yml up -d

    This will start the selenium grid which can be access usinghttp://localhost:4444.

    • To run the tests on Selenium Grid usingTestNG:

      Right click ontest-suite\testng-seleniumgrid-theinternet.xml andselectRun test-suite\testng-seleniumgrid-theinternet.xml

    • To run the tests on Selenium Grid usingMaven:

      mvn clean install -Dsuite-xml=test-suite\testng-seleniumgrid-theinternet.xml

  • Stopping the Selenium Grid:

    docker-compose -f docker-compose-v3-seleniumgrid.yml down

Running all the tests in one go:

  • Start theJuice -Shop website using following command:

    docker-compose -f docker-compose-v3-juiceshop.yml up -d

  • StartSelenium Grid using following command:

    docker-compose -f docker-compose-v3-seleniumgrid.yml up -d

  • Run the tests usingTestNG:

    Right click ontest-suite\testng.xml and selectRun test-suite\testng.xml

  • Run the tests usingMaven in headless mode:

    mvn clean install -Dheadless=true

  • Stopping theJuice-Shop website andSelenium Grid:

    docker-compose -f docker-compose-v3-juiceshop.yml down --remove-orphan

Running LambdaTest ECommerce Playground Tests on your local machine:

  • There are 2 ways to run the tests, those are as follows:

    1. TestNG:

    • Right-Click on thetest-suite\testng-lambdatestecommerce.xml andselectRun ...\test-suite\testng-lambdatestecommerce.xml

    2. Maven:

    • To run the tests in headless mode update the value forheadless property variable totrue

      mvn clean install -Dsuite-xml=test-suite\testng-lambdatestecommerce.xml -Dheadless=true

    • To run the tests without headless mode(to see the test running in browser) update the value for headless propertyvariable tofalse

      mvn clean install -Dsuite-xml=test-suite\testng-lambdatestecommerce.xml -Dheadless=false

❓ Need Assistance?

  • Discuss your queries by writing to me @mohammadfaisalkhatri@gmail.comOR ping me on any of the social media sites using the below link:

💻 Paid Trainings

  • Contact me for Paid trainings related to Test Automation and Software Testing,mail me @mohammadfaisalkhatri@gmail.com or ping me onLinkedIn

💭 Checkout the blogs related to Testing written by me on the following links:

💻 Recommended Proxies

There are cases when proxies may be required to run the tests, this may happen when the software teams are working inisolation at different places.Residential proxies help in keeping the user’s information safe and help in hiding the real location of the userIt acts as a middleman between the device and the internet and keep the users safe from being tracked.

NodeMaven provides high quality proxies with industry-first filtering,super sticky sessions and best customer support.Try outNodeMaven now(Use F86 at checkout to get extra 2GB of proxy)

💡 Cloud platform supporter

Big thanks toLambdaTest for their support to the project with their open source license:

lambdatest

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp