🌐
GitHub
gist.github.com › meatnordrink › 1da237065c41c8871b44494ad44dd0c1
Playwright Cheatsheet · GitHub
Playwright Cheatsheet. GitHub Gist: instantly share code, notes, and snippets.
🌐
GitHub
github.com › topics › playwright-typescript
playwright-typescript · GitHub Topics · GitHub
This is a boilerplate/template for a Playwright-Typescript framework for web UI, API, mobile emulation, DB, and visual testing.
Discussions

Playwright Typescript Template
my thoughts: there's a lot of functionality here, which is great, but this is very overbuilt. a lot of this will not be so easy to maintain in the long run. I also really don't like having assertions and other basic Playwright functionality buried in functions, especially when the functions are mostly just single Playwright actions; why wrap them at all? when I look at one of these tests, I have to click thru a bunch of functions to see what's actually happening. like this test has a dozen assertions in it but I don't know exactly what's being asserted without looking at every function. import test from '@lib/BaseTest'; test(`@Smoke Verify Elements Page`, async ({ loginPage, elementsPage, webActions }) => { await loginPage.navigateToURL(); await webActions.clickByText('Elements'); // Click on Elements Icon identified via text selector await webActions.clickByText('Text Box'); //Click on TextBox Navigation Sidebar identified via text selector await elementsPage.enterFullName(`AutoTest`); await elementsPage.clickSubmit(); await elementsPage.verifySubmittedText(); await webActions.clickByText('Check Box'); await elementsPage.clickHomeCheckBox(); await elementsPage.verifyHomeCheckboxSelectedText(); await webActions.clickByText('Radio Button'); await elementsPage.verifyNoRadioButtonDisabled(); await webActions.clickByText('Web Tables'); await elementsPage.verifyFirstColumnTableHeader('First Name'); await elementsPage.editCierraEntry(); await elementsPage.verifyRegistrationForm(); await elementsPage.registrationFormClose(); await webActions.clickByText('Buttons'); await elementsPage.doubleClickButton(); await elementsPage.verifyDoubleClickText(); await elementsPage.rightClickButton(); await elementsPage.verifyRightClickText(); await webActions.clickByText('Upload and Download'); await elementsPage.verifyFileDownload(); await elementsPage.verifyFileUpload(); await webActions.clickByText('Links'); await elementsPage.verifyNewBrowserTab("https://demoqa.com/"); }); there's a mix of page object actions and webActions actions here that I don't understand. why is web actions handling some of the clicking and page object functions handling other clicking? looking at ElementsPage.ts, almost all of these functions are single lines. why have them in functions? all of these single lines could be in the test directly, making the test a lot more clear as to what's actually happening and greatly reducing the amount of code. async enterFullName(name: string): Promise { await this.FULL_NAME_EDITBOX.fill(name); } async clickSubmit(): Promise { await this.SUBMIT_BUTTON.click(); } async verifySubmittedText(): Promise { await expect(this.SUBMITTED_TEXT).toBeVisible(); // Verifies if the text is visble on webpage } async clickHomeCheckBox(): Promise { await this.HOME_CHECK_BOX.check(); } async verifyHomeCheckboxSelectedText(): Promise { await expect(this.HOME_SELECTED_TEXT).toContainText('home'); // Verifies if the locator contains text } async verifyNoRadioButtonDisabled(): Promise { expect(this.NO_RADIO_BUTTON).toBeDisabled() } async verifyFirstColumnTableHeader(header: String): Promise { const headerText = await this.WEB_TABLES_HEADER.allTextContents(); // Get all Text from WebTable Header expect(headerText[0] == header).toBeTruthy(); // Verify the First Column Header here we are comparing string values } async editCierraEntry(): Promise { await this.WEB_TABLES_EDIT_ICON.click(); } async verifyRegistrationForm(): Promise { await expect(this.REGISTRATION_FORM_HEADER).toBeVisible(); } async registrationFormClose(): Promise { await this.REGISTRATION_FORM_CLOSE_BUTTON.click(); } async doubleClickButton(): Promise { await this.DOUBLE_CLICK_BUTTON.dblclick(); } More on reddit.com
🌐 r/QualityAssurance
16
13
July 18, 2023
The Complete Playwright Cheatsheet
I wouldn't actually use a lot of those snippets. There are better ways. Like with the browser, just use the Page Fixture and don't create your own context. Also this doesn't tell you where to put these commands. It's just a big list. Some of this is code and some if it is console commands and there's no real distinction. More on reddit.com
🌐 r/QualityAssurance
5
13
December 21, 2023
Ideas to speed up Playwright End-to-End tests? (Typescript, GitHub Actions)
Well even though ideally you run all tests against all PRs eventually you may have too many tests. Just a couple of ideas: run more workers/threads try to mock where you can maybe try component testing pick a subset (smoke) test set run that create a map of code files to tests. Determine what tests to run based on files being changed I would probably pick a small set of must pass test. Put this in front of prs. Run the rest of the test maybe twice or once a day Not sure any of these ideas will help but ya…. More on reddit.com
🌐 r/QualityAssurance
44
31
May 9, 2024
Playwright framework best practices/structure?
imo do all assertions in your spec file (no assertions in a page object) do all page interactions in a page object file (no locators in a spec file) use playwright's expect assertions over generic assertions (toBe, etc). playwright's internal error handing is awesome fixtures are useful I do something similar to this setup, where I have page object classes and page component classes. for example, I have a table page component that contains locators and functions for interacting with tables on various pages across our site. this way I don't have to rewrite the same table code in every page object- https://github.com/microsoft/playwright/issues/1604#issuecomment-1004711489 don't be afraid to parametrize tests or dynamically generate tests for repetitive testing. if you need to assert the same thing on a bunch of different pages, put them in an object and loop through it instead of writing the same test over and over, etc. https://playwright.dev/docs/best-practices More on reddit.com
🌐 r/QualityAssurance
22
30
March 28, 2023
🌐
GitHub
github.com › akshayp7 › playwright-typescript-playwright-test
GitHub - akshayp7/playwright-typescript-playwright-test: This is a boilerplate/template for a Playwright-Typescript framework for web UI, API, mobile emulation, DB, and visual testing. Docker image, SonarQube, Lighthouse, GitHub Actions setup with Slack notifications are also implemented. · GitHub
This is a boilerplate/template for a Playwright-Typescript framework for web UI, API, mobile emulation, DB, and visual testing. Docker image, SonarQube, Lighthouse, GitHub Actions setup with Slack notifications are also implemented.
Starred by 660 users
Forked by 209 users
Languages   TypeScript 94.3% | JavaScript 3.9% | Dockerfile 1.8%
🌐
GitHub
github.com › topics › playwright
playwright · GitHub Topics · GitHub
By using the Playwright API, you can write scripts to create new browser pages, navigate to URLs, and interact with elements on a page. Along with a test runner, Playwright can be used to automate user interactions to validate and test web ...
🌐
GitHub
github.com › mxschmitt › awesome-playwright
GitHub - mxschmitt/awesome-playwright: A curated list of awesome tools, utils and projects using Playwright · GitHub
2 weeks ago - playwright-examples - Various testing scenarios with Playwright. TypeScript - Playwright is used to test TypeScript.js across browsers.
Starred by 1.4K users
Forked by 198 users
🌐
Reddit
reddit.com › r/qualityassurance › playwright typescript template
r/QualityAssurance on Reddit: Playwright Typescript Template
July 18, 2023 -

Hi Guys,

I have created a playwright Typescript Template with Pom Model. You can use it to start your new project. Please do Star my work id you like it

https://github.com/akshayp7/playwright-typescript-playwright-test/

Happy Testing

Top answer
1 of 2
6
my thoughts: there's a lot of functionality here, which is great, but this is very overbuilt. a lot of this will not be so easy to maintain in the long run. I also really don't like having assertions and other basic Playwright functionality buried in functions, especially when the functions are mostly just single Playwright actions; why wrap them at all? when I look at one of these tests, I have to click thru a bunch of functions to see what's actually happening. like this test has a dozen assertions in it but I don't know exactly what's being asserted without looking at every function. import test from '@lib/BaseTest'; test(`@Smoke Verify Elements Page`, async ({ loginPage, elementsPage, webActions }) => { await loginPage.navigateToURL(); await webActions.clickByText('Elements'); // Click on Elements Icon identified via text selector await webActions.clickByText('Text Box'); //Click on TextBox Navigation Sidebar identified via text selector await elementsPage.enterFullName(`AutoTest`); await elementsPage.clickSubmit(); await elementsPage.verifySubmittedText(); await webActions.clickByText('Check Box'); await elementsPage.clickHomeCheckBox(); await elementsPage.verifyHomeCheckboxSelectedText(); await webActions.clickByText('Radio Button'); await elementsPage.verifyNoRadioButtonDisabled(); await webActions.clickByText('Web Tables'); await elementsPage.verifyFirstColumnTableHeader('First Name'); await elementsPage.editCierraEntry(); await elementsPage.verifyRegistrationForm(); await elementsPage.registrationFormClose(); await webActions.clickByText('Buttons'); await elementsPage.doubleClickButton(); await elementsPage.verifyDoubleClickText(); await elementsPage.rightClickButton(); await elementsPage.verifyRightClickText(); await webActions.clickByText('Upload and Download'); await elementsPage.verifyFileDownload(); await elementsPage.verifyFileUpload(); await webActions.clickByText('Links'); await elementsPage.verifyNewBrowserTab("https://demoqa.com/"); }); there's a mix of page object actions and webActions actions here that I don't understand. why is web actions handling some of the clicking and page object functions handling other clicking? looking at ElementsPage.ts, almost all of these functions are single lines. why have them in functions? all of these single lines could be in the test directly, making the test a lot more clear as to what's actually happening and greatly reducing the amount of code. async enterFullName(name: string): Promise { await this.FULL_NAME_EDITBOX.fill(name); } async clickSubmit(): Promise { await this.SUBMIT_BUTTON.click(); } async verifySubmittedText(): Promise { await expect(this.SUBMITTED_TEXT).toBeVisible(); // Verifies if the text is visble on webpage } async clickHomeCheckBox(): Promise { await this.HOME_CHECK_BOX.check(); } async verifyHomeCheckboxSelectedText(): Promise { await expect(this.HOME_SELECTED_TEXT).toContainText('home'); // Verifies if the locator contains text } async verifyNoRadioButtonDisabled(): Promise { expect(this.NO_RADIO_BUTTON).toBeDisabled() } async verifyFirstColumnTableHeader(header: String): Promise { const headerText = await this.WEB_TABLES_HEADER.allTextContents(); // Get all Text from WebTable Header expect(headerText[0] == header).toBeTruthy(); // Verify the First Column Header here we are comparing string values } async editCierraEntry(): Promise { await this.WEB_TABLES_EDIT_ICON.click(); } async verifyRegistrationForm(): Promise { await expect(this.REGISTRATION_FORM_HEADER).toBeVisible(); } async registrationFormClose(): Promise { await this.REGISTRATION_FORM_CLOSE_BUTTON.click(); } async doubleClickButton(): Promise { await this.DOUBLE_CLICK_BUTTON.dblclick(); }
2 of 2
2
I thought POM is not recommended for Playwright, even though it's possible to do. What advantages do you see in using it?
🌐
GitHub
github.com › BakkappaN › Playwright-TypeScript-Framework
GitHub - BakkappaN/Playwright-TypeScript-Framework: Playwright TypeScript Automation Framework · GitHub
Step3: Add below config in playwright.config.js file.
Starred by 4 users
Forked by 4 users
Languages   TypeScript 92.2% | JavaScript 7.8%
🌐
BrowserCat
browsercat.com › home
Playwright Cheatsheet for Javascript & Typescript
Master your tools, but don't memorize. Hands down, the best playwright javascript guide on the internet. Every action, with ample links. Download as PDF or desktop wallpaper.
Find elsewhere
🌐
BugBug
bugbug.io › blog › testing frameworks
Playwright Cheat Sheet
August 5, 2025 - Use the playwright-github-action for GitHub Actions integration.
🌐
GitHub
github.com › ortoniKC › Playwright-TypeScript-Jest
GitHub - ortoniKC/Playwright-TypeScript-Jest: Playwright YouTube Tutorial
Playwright YouTube Tutorial. Contribute to ortoniKC/Playwright-TypeScript-Jest development by creating an account on GitHub.
Starred by 48 users
Forked by 21 users
Languages   TypeScript 97.5% | JavaScript 2.5% | TypeScript 97.5% | JavaScript 2.5%
🌐
GitHub
github.com › michalkasiarz › playwright-typescript-poc
GitHub - michalkasiarz/playwright-typescript-poc: Automated testing project using Playwright with TypeScript, Page Object Pattern, ESLint, and Prettier integration. A well-structured test suite demonstrating reliable end-to-end testing techniques and solid practices for maintainable and efficient test code · GitHub
Automated testing project using Playwright with TypeScript, Page Object Pattern, ESLint, and Prettier integration. A well-structured test suite demonstrating reliable end-to-end testing techniques and solid practices for maintainable and efficient ...
Author   michalkasiarz
🌐
GitHub
github.com › nirtal85 › Playwright-Typescript-Example
GitHub - nirtal85/Playwright-Typescript-Example: Enterprise-Grade Playwright TypeScript Architecture 🎭 | Production-Ready Boilerplate with Biome, Allure & CI/CD.
Enterprise-Grade Playwright TypeScript Architecture 🎭 | Production-Ready Boilerplate with Biome, Allure & CI/CD. - nirtal85/Playwright-Typescript-Example
Starred by 25 users
Forked by 11 users
Languages   TypeScript
🌐
Playwright
playwright.dev › typescript
TypeScript | Playwright
Note that Playwright does not check the types and will run tests even if there are non-critical TypeScript compilation errors. We recommend you run TypeScript compiler alongside Playwright. For example on GitHub actions:
🌐
GitHub
github.com › vasu31dev › playwright-ts
GitHub - vasu31dev/playwright-ts: Playwright TypeScript Framework: a robust solution for testing Web (Desktop & Mobile), API, and Electron apps. With customized utilities, linting, logging, webhooks, and GitHub actions, it offers a stable and robust layer that enhances Playwright's capabilities. Stay tuned for updates, and star if valuable!
Playwright TypeScript Framework: a robust solution for testing Web (Desktop & Mobile), API, and Electron apps. With customized utilities, linting, logging, webhooks, and GitHub actions, it offers a stable and robust layer that enhances Playwright's ...
Starred by 96 users
Forked by 21 users
Languages   TypeScript 98.9% | Shell 1.1% | TypeScript 98.9% | Shell 1.1%
🌐
Codoid
codoid.com › automation-testing › playwright-cheatsheet-quick-tips-for-testers
Playwright Cheatsheet: Quick Tips for Testers - Codoid
September 6, 2024 - This playwright cheat sheet covers all the essential commands, functions, and best practices you need for seamless web automation and testing. Perfect for beginners and experts alike.
Address   TIDEL Park, 305, 3rd Floor, D-North, 4, Rajiv Gandhi Salai, Tharamani,, 600113, Chennai
🌐
GitHub
github.com › playwright-community › playwright-jest-examples
GitHub - playwright-community/playwright-jest-examples: Demonstrates the usage of Playwright (cross-browser automation library in Node.js) in combination with Jest on GitHub Actions to test various setups. · GitHub
Demonstrates the usage of Playwright (cross-browser automation library in Node.js) in combination with Jest on GitHub Actions to test various sites. JavaScript example · TypeScript example · create-react-app example in TypeScript · playwright-video example in JavaScript ·
Starred by 109 users
Forked by 47 users
Languages   TypeScript 41.0% | JavaScript 27.1% | CSS 19.1% | HTML 12.8%
🌐
awesome-playwright
mxschmitt.github.io › awesome-playwright
Awesome Playwright | awesome-playwright
playwright-examples - Various testing scenarios with Playwright. TypeScript - Playwright is used to test TypeScript.js across browsers.
🌐
QA Wiki
ray.run › rayrun › blog › mastering playwright test automation: your comprehensive cheat sheet
Mastering Playwright Test Automation: Your Comprehensive Cheat Sheet
June 1, 2023 - This cheat sheet is designed to provide you with everything you need to kickstart your Playwright journey – from setting up your first test to tackling advanced scenarios.