Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
release:
types: [published]

permissions:
id-token: write
contents: read

jobs:
publish-npm:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
- v1
- v2

permissions:
contents: read

jobs:
test:
strategy:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
:pencil: - chore
:microscope: - experimental

## [Unreleased]
## [3.6.0]
- :rocket: moved main declarations to package json
- :rocket: added `I refress page until...` and `I click until...` steps

## [3.5.0]
- :rocket: added `into` preposition to type and type chars steps
Expand Down
104 changes: 55 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qavajs/playwright",
"version": "3.5.0",
"version": "3.6.0",
"description": "steps to interact with playwright",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand All @@ -26,16 +26,16 @@
},
"homepage": "https://github.com/qavajs/playwright#readme",
"devDependencies": {
"@types/express": "^5.0.3",
"@types/node": "^24.6.0",
"electron": "^38.2.0",
"@types/express": "^5.0.5",
"@types/node": "^24.10.1",
"electron": "^39.1.2",
"express": "^5.1.0",
"ts-node": "^10.9.2",
"typescript": "^5.9.2"
"typescript": "^5.9.3"
},
"dependencies": {
"@playwright/test": "^1.55.1",
"@qavajs/playwright-runner-adapter": "^1.6.0",
"@qavajs/memory": "^1.10.2"
"@playwright/test": "^1.56.1",
"@qavajs/playwright-runner-adapter": "^1.8.0",
"@qavajs/memory": "^1.10.3"
}
}
16 changes: 7 additions & 9 deletions src/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { When } from '@qavajs/playwright-runner-adapter';
import { Locator, Page } from '@playwright/test';
import { QavajsPlaywrightWorld } from './QavajsPlaywrightWorld';
import { parseCoords, parseCoordsAsObject, sleep } from './utils/utils';
import { parseCoords, parseCoordsAsObject, sleep } from './utils';
import { MemoryValue } from './types';

/**
Expand Down Expand Up @@ -75,7 +75,7 @@ When('I double click {locator}', async function (locator: Locator) {
* @example I clear 'Google Input'
*/
When('I clear {locator}', async function (locator: Locator) {
await locator.fill('');
await locator.clear();
});

/**
Expand All @@ -97,7 +97,7 @@ When('I switch to {int} window', async function (this: QavajsPlaywrightWorld, in
* @example I switch to 'google' window
*/
When('I switch to {value} window', async function (matcher: MemoryValue) {
const urlOrTitle = await this.value(await matcher.value());
const urlOrTitle = await matcher.value();
const poll = async () => {
const pages = this.context.pages();
for (const currentPage of pages) {
Expand Down Expand Up @@ -233,8 +233,7 @@ When('I scroll by {value} in {locator}', async function (offset: MemoryValue, lo
* When I scroll until 'Row 99' to be visible
*/
When('I scroll until {locator} to be visible', async function (targetAlias: Locator) {
const isVisible = () => targetAlias.isVisible();
while (!await isVisible()) {
while (!await targetAlias.isVisible()) {
await this.page.mouse.wheel(0, 100);
await sleep(50);
}
Expand All @@ -249,8 +248,7 @@ When('I scroll until {locator} to be visible', async function (targetAlias: Loca
*/
When('I scroll in {locator} until {locator} to be visible', async function (scrollLocator: Locator, targetLocator: Locator) {
await scrollLocator.hover();
const isVisible = () => targetLocator.isVisible();
while (!await isVisible()) {
while (!await targetLocator.isVisible()) {
await this.page.mouse.wheel(0, 100);
await sleep(50);
}
Expand Down Expand Up @@ -296,7 +294,7 @@ When('I accept alert', async function (this: QavajsPlaywrightWorld) {
* @example I dismiss alert
*/
When('I dismiss alert', async function (this: QavajsPlaywrightWorld) {
await new Promise<void>((resolve)=> this.page.once('dialog', async (dialog) => {
await new Promise<void>(resolve => this.page.once('dialog', async (dialog) => {
await dialog.dismiss();
resolve();
}));
Expand All @@ -308,7 +306,7 @@ When('I dismiss alert', async function (this: QavajsPlaywrightWorld) {
*/
When('I type {value} to alert', async function (this: QavajsPlaywrightWorld, type: MemoryValue) {
const typeValue = await type.value();
await new Promise<void>((resolve)=> this.page.once('dialog', async (dialog) => {
await new Promise<void>(resolve => this.page.once('dialog', async (dialog) => {
await dialog.accept(typeValue);
resolve();
}))
Expand Down
2 changes: 1 addition & 1 deletion src/http.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataTable, When } from '@qavajs/playwright-runner-adapter';
import { dataTable2Object, sendHttpRequest } from './utils/utils';
import { dataTable2Object, sendHttpRequest } from './utils';
import { QavajsPlaywrightWorld } from './QavajsPlaywrightWorld';
import { MemoryValue } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/memory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataTable, When } from '@qavajs/playwright-runner-adapter';
import { dataTable2Object } from './utils/utils';
import { dataTable2Object } from './utils';
import { QavajsPlaywrightWorld } from './QavajsPlaywrightWorld';
import { Locator } from '@playwright/test';
import { MemoryValue } from './types';
Expand Down
2 changes: 1 addition & 1 deletion src/mouse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { When } from '@qavajs/playwright-runner-adapter';
import { parseCoords } from './utils/utils';
import { parseCoords } from './utils';
import { MemoryValue } from './types';

/**
Expand Down
Loading
Loading