Skip to content

MaksimZinovev/tau-advanced-playwright

 
 

Repository files navigation

Playwright Tests

Advanced Playwright

Hi 👋🏽!

Welcome to the course "Advanced Playwright" by Renata Andrade for the Test Automation University. Look at the Introduction to Playwright course.

About

This is a repo with completed exercises from course Advanced Playwright. Forked from raptatinha/tau-advanced-playwright: Course Advanced Playwright by Renata Andrade for Test Automation University

Chapter 1

  • Exercise 1
  • Exercise 2
  • Exercise 3
  • Exercise 4
  • Exercise 5 - implement the trace of failures in setup
  • Exercise 6 - sign in using stored state
  • Exercise 7 - authentication via API request
  • Exercise 8 - multi-role sign in test

Chapter 2

  • Exercise 1 - implement test using dynamic page object
  • Exercise 2 - implement search test with fixture

Chapter 3

  • Exercise 1 - Implement a new test for "delete 1 book from the collection" using UI and API.

Run exercises tests:

Chapter 1

Exercise 5: tests/setup/global-setup.ts
Exercise 6: npx playwright test login.appl.spec.ts --project=chromium-appl
Exercise 7: npx playwright test profile.api.spec.ts --project=chromium-api
Exercise 8: npx playwright test profile-stored-auth-multi-role-user-saucedemo.spec.ts --project=chromium-saucedemo

Chapter 2

Exercise 1: npx playwright test form-with-dynamic-pom.spec.ts --project=chromium-guest
Exercise 2: npx playwright test book-store.spec.ts --project=chromium

Chapter 3

Exercise 1 (UI): npx playwright test book-with-fixture-and-api-isolated-auth.spec.ts --project=chromium
Exercise 1 (API): npx playwright test book-with-fixture-and-api.spec.ts --project=chromium-auth

Exercise 6 - authentication via API request issue

storageState issue

Dependencies

  • Playwright v1.35.1
  • Node v20.3.0
  • npm v9.6.5
  • VSCode Version: 1.79.1 (Universal)
  • Applitools v1.17.5

Pre requirements:

Fork and clone the project

  1. Copy the project URL https://github.com/raptatinha/tau-advanced-playwright.git;
  2. Fork the project following the GitHub instructions - (use the parameter --clone=true);
  3. Access the forked project cd tau-advanced-playwright

NOTE: Remember to add the secrets & variables to your local repo.

Instal the project

IMPORTANT: Create your .env file following the .env.example. The APPLITOOLS_API_KEY is the only param you'll need to uptdate to your credentials.

On your terminal, type:

  1. npm i

Run the project

Take a look at the package.json - scripts for more details. The tests are using https://demoqa.com/

  • npm run test-ui-c runs all tests on chromium (except the auth)
  • npm run test-ui-auth-admin runs profile-stored-auth-multi-role-admin.spec.ts
  • npm run test-ui-auth-user runs profile-stored-auth-multi-role-user.spec.ts
  • npm run test-ui-auth runs profile-stored-auth-multi-role-example.spec.ts (test will fail due to application limitations)
  • npm run test-vrt runs visual-regression.spec.ts - visual regression testing with applitools

Course Content

Chapter 1: Optimizing authentication

  • Regular authentication with page objects;
  • Stored authentication with global-setup via UI;
  • Stored authentication for multi users;
  • Advanced - auth via API request;

Chapter 2: Dynamic Page Objects & Fixtures

  • Hooks file for reusable page object creation
  • URL builder for dynamic url creation
  • Fixtures file for reusable flows

Chapter 3: Interacting with APIs

  • The APIRequestContext
  • HTTP methods, request options, request URL
  • How to identify an API call and use the swagger
  • Execute request dynamic
  • Error handling
  • Reusability

Chapter 4: Data Management

Chapter 5: Visual Regression with Applitools

  • Implementing a visual regression test
  • Using different check settings
  • Interpreting the results

Chapter 6: Continuous Integration & Observability

  • Github Actions
  • The yml file
  • Slack Integration
  • Parallelization strategy & Sharding

💡 Share on LinkedIn something interesting you've learned! Don't forget to tag me Renata Andrade.

💜 If you have questions, feel free to post them on github.

Happy Testing 🎭

About

Course Advanced Playwright by Renata Andrade for Test Automation University

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%