vasu31dev / playwright-ts-template

Playwright Typescript Automation testing framework Template is designed for Web (Desktop & Mobile), API, and Electron apps. Stable and Robust layer on top of Playwright with inbuilt Utilities, Linting, Logger, Web hooks, Github actions, Reports and much more
111 stars 5 forks source link

Using fixtures with the framework setup #26

Open amit42147 opened 2 months ago

amit42147 commented 2 months ago

Hello Vasu31dev! What an awesome framework with utility methods and excellent understandability. One unique thing about Playwright is the concept of fixtures or ability to create custom fixtures that can reduce code duplication and especially the import statements that can make a test file clunky.

Is there any way to create custom fixtures for the pages from page object folder that we can call in the tests so that statements like following can be removed or any other repeatable steps across all tests if they are stand alone - example login, import statements like below import { click, clickAndNavigate, fill, gotoURL } from 'vasu-playwright-utils'; import { expectElementToBeVisible } from 'vasu-playwright-utils'; import { getLocator, getLocatorByPlaceholder, getLocatorByRole } from 'vasu-playwright-utils';

vcannam commented 2 months ago

Hi @amit42147, Thank you for the appreciation. I'm glad to hear that you like the framework. It's been a few months since I last updated the framework due to a busy schedule. Fixtures are very powerful in Playwright, and I will definitely add them and update the import statements to make it easier. Thank you so much for your suggestion.