agentq-playwright
v1.0.58
Published
Sample integrate Playwright (typescript) with AgentQ AI.
Readme
AgentQ for Playwright
Sample integrate Playwright (typescript) with AgentQ AI.
Installation & Usage
Setup & run from scratch (if you need start from sample)
- clone this repository
git clone https://github.com/agentq-ai/playwright_typescript.git- install node modules
npm install- Install AgentQ package for Playwright using npm (applicable using yarn as well)
npm install agentq-playwright- Update apiKey on json file
agentq.config.jsonbased on your account profile (you must signin first)
export TOKEN="apiKey"- Run your test
npm run testor
npx playwright testSetup & run from your own Playwright
- Install AgentQ package for Playwright using npm (applicable using yarn as well)
npm install agentq-playwright- Create json file
agentq.config.jsonbased on your account profile (you must signin first)
{
"TOKEN": "apiKey"
}- Below is sample usage q() funciton (using POM and non-POM)
non-POM
- login.spec.ts
import { q, test } from 'agentq-playwright';
import { expect } from '@playwright/test';
test.describe('Login', () => {
test('login success', async ({ page }) => {
await page.goto('https://www.saucedemo.com/');
await q('user fill "username" field with "standard_user"');
await q('user fill "password" field with "standard_user"');
await q('User click "login" button');
});
});POM
- login.page.ts on pages file
import { q } from 'agentq-playwright';
import { type Locator, type Page } from '@playwright/test';
export class LoginPage {
readonly page: Page;
readonly error_text: Locator;
constructor(page: Page) {
this.page = page;
this.error_text = page.locator('[data-test="error"]')
}
async doLogin() {
await q('User fill "username" field with "standard_user"');
await q('User fill "password" field with "standard_user"');
await q('User click "login" button');
}
}- login_fail.spec.ts
import { test } from "agentq-playwright";
import { expect } from "@playwright/test";
import { LoginPage } from '../pages/login.page';
test.describe('Login', () => {
test('login failed', async ({ page }) => {
const loginpage = new LoginPage(page);
await page.goto('https://www.saucedemo.com');
await loginpage.doLogin();
await expect(loginpage.error_text).toBeVisible();
});
});Plans and Rate Limits
- Free: Free of charge
- Pro & Enterprise : visit www.agentq.id or contact [email protected] to upgrade your plan.
