Mitesh411 / Simba

Customized Playwright Framework for Web and API automation with scalability and powerful data engine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simba - Playwright Automation Framework

Simba is Java based clean code playwright automation framework architected using several useful design patterns.

Software Dependencies

Dependency Version Feature
Playwright 1.28.0 End to End Automation - Browser & API
TestNG 7.4.0 The Test Runner to execute suite
JSON 20220924 Create & Parse JSON Files for API
Apache POI 5.2.3 Read Excel files for test data
Data Faker 1.6.0 Create runtime fake test data
Owner 1.0.12 Minimize the properties file code
Extent Reports 3.1.5 The HTML reporting library

Design Pattern Used

  • Factory Pattern is used to reuse existing browser contexts instead of rebuilding them each time.
  • Bridge pattern is used to switch implementations between UI and API at runtime.
  • Decorator pattern is used to assign extra behaviors like highlight, retry .. to pages & elements at runtime without breaking the code that uses these objects.
  • Chain of Responsibility pattern is used to navigate from a pattern/page to other.
  • Observer pattern is used to switch to different data, browser on failure when retried.

Framework - How to design your new test?

  • Step 1: Use the main source for the framework desaign.
  • Step 2: Refer the test source for the sample test code (Salesforce).
  • Step 3: Create your own app instance url and update the config.
  • Step 4: Build your pages like the sample using the right method and locator.
  • Step 5: Use the test data in your tests from faker or API or excel.
  • Step 6: Build your tests using the pages
  • Step 7: Once ready, run in the debug mode and look at the logs for details

Amazing Usecases that you should try !

✅ Single framework for both UI 🧭 and API Automation

  •  Single framework designed using bridge pattern to allow conversation between UI and API simultaneously.
  •  You can create data using API and use that data to your UI tests to make your tests independent.
  •  Your UI tests can execute the test and as part of the assertions, it make sense to validate using API.

✅ Fastest test execution 🚀 with configurable speed control

  • Playwright engine is comparatively (above 30% on average) faster than other UI automation frameworks.
  • Sometimes it requires a slow down to eliminate the script flakiness with configurable speed included through the listeners.

  •   // Sample code to control your delays
      setSlowMo(ConfigurationManager.configuration().slowMotion());
✅ Debug Faster with Snaps, Videos 🎥 and Tracings with configurable options

  •   Playwright library provides full/partial snaps, videos (webm) and trace viewer that captures network calls.
  •   Our framework allows configuration for framework user to either plugin on demand for every run or failures.

  •   // Sample code to control your delays
      setRecordVideoDir(Paths.get(folderName));
✅ Automated logins 💡 to avoid too many login tests

  •  Configurable automated logins can avoid unnecessary login tests through storing the state of the user.
  •  The user can either use the existing login storage or decide to login automated through configuration.

  • # Auto Login
    auto.login = true
✅ Automated retries 🔁 with different browser and/or data

  •  Configurable retries with different data using the TestNG listener upon failure of the earlier data.
  •  Configurable retries with different browser using the TestNG listener upon failure of earlier browser.

  • # Retry Switch
    retry.data.switch = true
    retry.browser.switch = false
✅ Automated test data generation/selection for your CRUD operations

  •  Java Faker is used to generate random test data for most of your CREATE requests.
  •  You can also use ENUM for the master data obtained using the API requests from server.
  •  For all idempotent requests, the framework allows you to read data using API, Excel.

Framework - How does it execute tests?

  • Step 01: You run your designed testng xml with listeners.
  • Step 02: The testng annotations (@Before) initialize the setup.
  • Step 03: The playwright script invokes the browser and actions.
  • Step 04: Simulatenously, the reporting engine captures the result.
  • Step 05: Upon success completion, the videos, reports are published.
  • Step 06: Upon failure, the testng retry is invoked with different data/browser.
  • Step 07: Step 02 - 06 continues until success or max retries.
  • Step 08: Look at the results folder for html results.
  • Step 09: Look at the videos for the exact details.
  • Step 10: Share the traceviewer results to your developer through defect log.

2023 Roadmap !

  • Single framework to switch from Playwright to Selenium or vice versa.
  • Defect Management tools integration LIKE Jira and users choice.

License

The project is MIT licensed.

About

Customized Playwright Framework for Web and API automation with scalability and powerful data engine.

License:MIT License


Languages

Language:Java 100.0%