Page Object, Singleton, and Factory Design Patterns in Test Automation with Playwright & TypeScript

preview_player
Показать описание
In this video, we'll dive into three crucial design patterns for test automation: Page Object Model (POM), Singleton, and Factory. Using Playwright and TypeScript, we'll demonstrate how these patterns can streamline your test automation framework, making it more efficient, modular, and easy to maintain.

Key takeaways:

Page Object Model (POM) - Organize your code to make page interactions more readable and reusable.
Singleton - Optimize resource usage by ensuring only one browser instance is active.
Factory - Create browser contexts or page objects flexibly for different scenarios.
Get hands-on with the code, which is available on GitHub (link in the description). Make sure to like, subscribe, and ring the bell for more content on Playwright and TypeScript!

CHAPTERS:

00:00 Intro
00:35 Install Playwright and write some tests
06:57 Simple PageObject pattern
13:00 Improved PageObject pattern
19:00 Singleton pattern
25:00 Factory pattern
Рекомендации по теме
Комментарии
Автор

I had to subscribe, your content is amazing

mzamomahaeng
Автор

very helpful, i am implementing a framework in my job. i have used an app.ts file that instantiates the new page instances. looking forward to new videos!

gdd
Автор

Did not get the pros of pageFactory in that video. Seems like absolutely useless... More code to get an instance of a needed page. More mess in the code to manage pages. The best way is to have the pages in a custom fixture and pass the pages in the test context or as you did with the class "app" it's also pretty handy, though it's not explicit enough as for my taste.
another point: What is a reason to call open for a page if e.g. "submit" button on a "login" page should bring you to e.g. "dashboard" page so in that case the open method is not needed, but i'd rather have the "dashboard" page initialized automatically. I've never used factory pattern, but i always thought that it should be the way i described.

vitecz
welcome to shbcf.ru