Skip to content

serenity-dojo/playwright-in-java-sample-code

Repository files navigation

Mastering Modern Test Automation With Playwright In Java

This repository contains the sample code for the Mastering Modern Test Automation With Playwright In Java course. It is designed to complement your learning experience, providing hands-on examples and exercises for each module of the course.

About the Course

Modern web testing demands modern solutions, and Playwright has emerged as the go-to testing framework for dynamic web applications. By combining the power of Playwright with Java's enterprise-grade ecosystem, this course will equip you with the skills needed to build reliable, maintainable test automation frameworks.

Key Highlights:

  • Superior auto-wait and asynchronous testing capabilities
  • Multi-browser support for Chromium, Firefox, and WebKit
  • Network interception and mocking capabilities
  • Rich debugging and codegen tools
  • Seamless integration with Java tools like JUnit and Cucumber

You’ll learn:

  • Playwright fundamentals, architecture, and best practices
  • Writing robust tests for modern web applications
  • Using advanced features like API mocking, parallel execution, and CI/CD integration
  • Behavior-Driven Development (BDD) using Cucumber
  • Generating professional test reports with Allure
  • Leveraging AI tools to accelerate test writing

Access the Course Material

Enroll in the course and access all the learning resources here: Mastering Modern Test Automation With Playwright In Java


Git Branches and Corresponding Udemy Course Modules

The branch structure of this repository follows the convention sample-code/<module-name>. Each branch corresponds to a module in the course and contains the sample code for that specific topic. Some of the module branches include:

The table below maps each Git branch in this repository to its corresponding Udemy course module. Click the links to access the relevant lecture directly.

Module Git Branch Udemy Lecture Link
Start Here sample-code/start-here Start Here
Module 3 sample-code/module-3-my-first-playwright-test My First Playwright Test
Module 4 sample-code/module-4-interacting-with-elements Interacting With Field Elements
Module 5 sample-code/module-5-refactoring Refactoring
Module 6 sample-code/module-6-browser-options Browser Options
Module 7 sample-code/module-7-browser-contexts Browser Contexts
Module 8 sample-code/module-8-locators Locators
Module 9 sample-code/module-9-forms Forms
Module 10 sample-code/module-10-assertions Assertions
Module 11 sample-code/module-11-waits Waits
Module 12 sample-code/module-12-mocking-api-calls Mocking API Calls
Module 13 sample-code/module-13-page-objects Page Objects
Module 14 sample-code/module-14-organizing-your-tests Organizing Your Tests
Module 15 sample-code/module-15-parallel-execution Parallel Execution
Module 16 sample-code/module-16-allure-reporting Allure Reporting
Module 17 sample-code/module-17-cucumber Cucumber

How to Use This Repository

The exercises in this repository are designed to build on each other in a sequential order, providing you with a progressive learning experience. Here's how you can make the most of the exercises:

Step 1: Starting the Exercises

Begin your journey into Playwright and Java test automation by setting up your workspace. You have two options to start:

  1. Use the sample-code/start-here branch: This branch contains a basic starting point with all the necessary configuration files (like a Maven pom.xml file) to help you get started quickly.
  2. Start with an empty Maven project: If you prefer to set up everything from scratch, you can create your own Maven project and follow along with the course to configure it step by step. This approach is great for reinforcing your understanding of the setup process.

Step 2: Follow Along With the Coding Exercises

Each course module introduces new concepts and techniques, with corresponding exercises for hands-on practice. Follow these steps as you progress:

  1. Follow the Exercises in Order: The modules are designed to build upon each other. Completing them in order ensures you gain a solid understanding of each concept before moving to the next.

  2. Reference the Module-Specific Sample Code: Each module's sample code is available in the corresponding branch, named sample-code/. For example:

    • sample-code/module-3-my-first-playwright-test
    • sample-code/module-6-browser-options You can check out these branches to view the sample solution for each module if you get stuck or want to see how the exercises are implemented.
  3. Work on the Exercises in Your Own Branch: Create your own branch to experiment with the exercises. For example:

git checkout -b module-3-exercises

This approach allows you to practice and experiment without affecting the main codebase or other branches.

Feel free to submit pull requests or raise issues if you find bugs or areas for improvement.

Step 3: Using Sample Solutions to Unblock Yourself

If you encounter challenges while working through an exercise:

  1. Check the Sample Solution: Switch to the branch for the current module to review the sample code and compare it with your own:
git checkout sample-code/<module-name>
  1. Learn From the Solution: Pay attention to how the concepts are applied and implemented. Take note of any differences between your code and the solution, and try to understand why those differences exist.

Step 4: Starting Fresh at Any Point

If you want to start over or reset your work for a specific module:

  1. Checkout the Previous Module's Sample Code: Each module builds on the previous one, and the starting point for a module is the final state of the previous module. For example: If you are working on Module 5 and want to start fresh, check out the code from sample-code/module-4-interacting-with-elements. Use the following command:
git checkout sample-code/<previous-module-name>
  1. Create a New Branch From the Previous Module: After checking out the previous module's sample code, create a new branch to start your work:
git checkout -b module-5-exercises
  1. Continue From the Reset State: Use the previous module's code as the starting point for the new module, and continue with the exercises.

Step 5: Submitting Your Work

If you are following along as part of the Serenity Dojo coaching program, you will be able to get feedback about your work from one of the Serenity Dojo coaches. Here is how you do that:

  1. Push Your Changes to Your Repository: Push your completed exercises to your forked repository to save your work:
git push origin <your-branch-name>
  1. Share Your Branch: If requested, share the branch link with your instructor or team for review.

About

Sample code for the Serenity Dojo Playwright In Java course

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published