@robeherrera/libs
v1.1.0
Published
Playwright testing utilities library with shared page objects, fixtures, and authentication utilities for UI test automation
Downloads
11
Maintainers
Readme
@robeherrera/libs
A Playwright testing utilities library that provides shared page objects, fixtures, and authentication utilities for UI test automation.
Installation
npm install @robeherrera/libsUsage
Auth Manager
import { AuthManager } from '@robeherrera/libs';
// Fetch a new token
const token = await AuthManager.fetchNewToken(page, 'qa');
// Use existing token if available
const existingToken = await AuthManager.getToken(page, 'qa');Page Objects
import { LoginPage, getUser } from '@robeherrera/libs';
const loginPage = new LoginPage(page);
const user = getUser('qa', false);Test Fixtures
import { apiTest, uiTest } from '@robeherrera/libs';
// Use API test fixture
apiTest('should work with API context', async ({ apiContext }) => {
// Your API test code here
});
// Use UI test fixture
uiTest('should work with UI context', async ({ loginPage }) => {
// Your UI test code here
});API Reference
AuthManager
fetchNewToken(page: Page, env?: string): Fetches a new authentication tokengetToken(page: Page, env?: string): Gets existing token or fetches new one if needed
Page Objects
LoginPage: Page object for login functionalityLoginLocators: Locators for login page elements
Fixtures
apiTest: Test fixture with API contextuiTest: Test fixture with UI context and page objects
Contributing
This library is designed to be used as a submodule or subtree for UI test automation frameworks.
License
ISC
