diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd08da..1d1990d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,11 +14,12 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how :microscope: - experimental -## [Unreleased] +## [2.10.0] - :rocket: added step to interact with electron app menu ```gherkin When I click 'Test > Open Page' electron menu ``` +- :rocket: added `into` preposition to type and type chars steps ## [2.9.0] - :rocket: added capability to execute script on electron main process diff --git a/package-lock.json b/package-lock.json index dce655d..3f052d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,29 +1,29 @@ { "name": "@qavajs/steps-playwright", - "version": "2.9.0", + "version": "2.10.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@qavajs/steps-playwright", - "version": "2.9.0", + "version": "2.10.0", "license": "MIT", "dependencies": { "@playwright/test": "^1.55.0" }, "devDependencies": { "@cucumber/cucumber": "^12.2.0", - "@qavajs/console-formatter": "^1.0.0", - "@qavajs/core": "^2.6.0", - "@qavajs/html-formatter": "^0.18.1", + "@qavajs/console-formatter": "^1.1.1", + "@qavajs/core": "^2.7.0", + "@qavajs/html-formatter": "^1.0.0", "@qavajs/memory": "^1.10.2", "@qavajs/validation": "^1.3.0", "@qavajs/webstorm-adapter": "^8.0.0", "@types/express": "^5.0.3", - "@types/node": "^24.3.1", + "@types/node": "^24.5.1", "@vitest/coverage-v8": "^3.2.4", "@vitest/ui": "^3.2.4", - "electron": "^38.0.0", + "electron": "^38.1.2", "express": "^5.1.0", "ts-node": "^10.9.2", "typescript": "^5.9.2", @@ -1076,9 +1076,9 @@ "license": "MIT" }, "node_modules/@qavajs/console-formatter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@qavajs/console-formatter/-/console-formatter-1.0.0.tgz", - "integrity": "sha512-ti3AVsOu6AjsNmSTxaxmAdqcKGxlr8CjyokUISsoZETODuT9esrsy3DgrOI43/yV8VPQfhKAY5SWrVXyQ41hqA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@qavajs/console-formatter/-/console-formatter-1.1.1.tgz", + "integrity": "sha512-L5hfZlvQgXTCKoYfPV86OWLcN8/nHxO3BAfI8sK+jNAMhvbAhocjqIJOFFosc4nXnTqhcTywHi15T17RWll5ig==", "dev": true, "license": "MIT", "dependencies": { @@ -1089,16 +1089,16 @@ } }, "node_modules/@qavajs/core": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@qavajs/core/-/core-2.6.0.tgz", - "integrity": "sha512-/zaean+7Eete6KVqeTpovutrQTkqpP5LRFzUfz19HXOLoHzVsSeYcnlINi+ZFJhM82CTlRde8ToC3RcVa2+2tQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@qavajs/core/-/core-2.7.0.tgz", + "integrity": "sha512-yZfbYe85fI6K1mBLfQeDAs5BjWf1PFt4yUf6WkkCLcyTpnhHdje8iSu2EdnR4DbxtnouKUATpDsW69RKR3blDg==", "dev": true, "license": "MIT", "dependencies": { "@qavajs/memory": "^1.10.2", "@qavajs/validation": "^1.3.0", "@swc/core": "^1.13.5", - "chalk": "^5.6.0", + "chalk": "^5.6.2", "yargs": "^17.7.2" }, "bin": { @@ -1110,9 +1110,9 @@ } }, "node_modules/@qavajs/core/node_modules/chalk": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.0.tgz", - "integrity": "sha512-46QrSQFyVSEyYAgQ22hQ+zDa60YHA4fBstHmtSApj1Y5vKtG27fWowW03jCk5KcbXEWPZUIR894aARCA/G1kfQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", "dev": true, "license": "MIT", "engines": { @@ -1123,9 +1123,9 @@ } }, "node_modules/@qavajs/html-formatter": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@qavajs/html-formatter/-/html-formatter-0.18.1.tgz", - "integrity": "sha512-+TlZ4NZvIdeK+BhfaPYcnOwx0Mk+i6WbIujmDtufwo7ndhmTrZtK1+fG2IEB+GIctniqvemjNCyP18XQ6rr8SQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@qavajs/html-formatter/-/html-formatter-1.0.0.tgz", + "integrity": "sha512-Ic68ePyDbbwrTRsSCsgMIs4KcbYDeFHYdkfx/egj8ppLH/7KTT/AOqcTfUtRYxCsB66klWdLuTlwdAXq3QEXow==", "dev": true }, "node_modules/@qavajs/memory": { @@ -1855,13 +1855,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.3.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.1.tgz", - "integrity": "sha512-3vXmQDXy+woz+gnrTvuvNrPzekOi+Ds0ReMxw0LzBiK3a+1k0kQn9f2NWk+lgD4rJehFUmYy2gMhJ2ZI+7YP9g==", + "version": "24.5.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.5.1.tgz", + "integrity": "sha512-/SQdmUP2xa+1rdx7VwB9yPq8PaKej8TD5cQ+XfKDPWWC+VDJU4rvVVagXqKUzhKjtFoNA8rXDJAkCxQPAe00+Q==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.10.0" + "undici-types": "~7.12.0" } }, "node_modules/@types/normalize-package-data": { @@ -2918,9 +2918,9 @@ "license": "MIT" }, "node_modules/electron": { - "version": "38.0.0", - "resolved": "https://registry.npmjs.org/electron/-/electron-38.0.0.tgz", - "integrity": "sha512-egljptiPJqbL/oamFCEY+g3RNeONWTVxZSGeyLqzK8xq106JhzuxnhJZ3sxt4DzJFaofbGyGJA37Oe9d+gVzYw==", + "version": "38.1.2", + "resolved": "https://registry.npmjs.org/electron/-/electron-38.1.2.tgz", + "integrity": "sha512-WXUcN3W8h8NTTZViA3KNX0rV2YBU0X0mEUM3ubupXTDY4QtIN7tmiqYVOKSKpR2LckTmBWGuEeY4D6xVoffwKQ==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -5805,9 +5805,9 @@ } }, "node_modules/undici-types": { - "version": "7.10.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", - "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.12.0.tgz", + "integrity": "sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ==", "dev": true, "license": "MIT" }, @@ -5904,9 +5904,9 @@ } }, "node_modules/vite": { - "version": "6.3.5", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", - "integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==", + "version": "6.3.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.6.tgz", + "integrity": "sha512-0msEVHJEScQbhkbVTb/4iHZdJ6SXp/AvxL2sjwYQFfBqleHtnCqv1J3sa9zbWz/6kW1m9Tfzn92vW+kZ1WV6QA==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 6a238df..d6404ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@qavajs/steps-playwright", - "version": "2.9.0", + "version": "2.10.0", "description": "qavajs steps to interact with playwright", "main": "./index.js", "scripts": { @@ -27,17 +27,17 @@ "homepage": "https://github.com/qavajs/steps-playwright#readme", "devDependencies": { "@cucumber/cucumber": "^12.2.0", - "@qavajs/console-formatter": "^1.0.0", - "@qavajs/core": "^2.6.0", - "@qavajs/html-formatter": "^0.18.1", + "@qavajs/console-formatter": "^1.1.1", + "@qavajs/core": "^2.7.0", + "@qavajs/html-formatter": "^1.0.0", "@qavajs/memory": "^1.10.2", "@qavajs/validation": "^1.3.0", "@qavajs/webstorm-adapter": "^8.0.0", "@types/express": "^5.0.3", - "@types/node": "^24.3.1", + "@types/node": "^24.5.1", "@vitest/coverage-v8": "^3.2.4", "@vitest/ui": "^3.2.4", - "electron": "^38.0.0", + "electron": "^38.1.2", "express": "^5.1.0", "ts-node": "^10.9.2", "typescript": "^5.9.2", diff --git a/src/actions.ts b/src/actions.ts index 476205d..fd45982 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -16,8 +16,9 @@ When('I open {value} url', async function (url: MemoryValue): Promise { * @param {string} alias - element to type * @param {string} value - value to type * @example I type 'wikipedia' to 'Google Input' + * @example I type 'wikipedia' into 'Google Input' */ -When('I type {value} to {playwrightLocator}', async function (value: MemoryValue, locator: Locator): Promise { +When('I type {value} (in)to {playwrightLocator}', async function (value: MemoryValue, locator: Locator): Promise { const typeValue = await value.value() await locator.fill(typeValue); }); @@ -27,8 +28,9 @@ When('I type {value} to {playwrightLocator}', async function (value: MemoryValue * @param {string} alias - element to type * @param {string} value - value to type * @example I type 'wikipedia' chars to 'Google Input' + * @example I type 'wikipedia' chars into 'Google Input' */ -When('I type {value} chars to {playwrightLocator}', async function (value: MemoryValue, locator: Locator) { +When('I type {value} chars (in)to {playwrightLocator}', async function (value: MemoryValue, locator: Locator) { const typeValue = await value.value(); await locator.pressSequentially(typeValue); }); diff --git a/src/memory.ts b/src/memory.ts index 9502e62..07012c9 100644 --- a/src/memory.ts +++ b/src/memory.ts @@ -5,7 +5,7 @@ import { type MemoryValue, When } from '@qavajs/core'; * Save text of element to memory * @param {string} locator - element to get value * @param {string} key - key to store value - * @example I save text of '#1 of Search Results' as 'firstSearchResult' + * @example I save text of 'Search Results (1)' as 'firstSearchResult' */ When('I save text of {playwrightLocator} as {value}', async function (locator: Locator, key: MemoryValue) { key.set(await locator.innerText()); diff --git a/test-e2e/features/actions.feature b/test-e2e/features/actions.feature index cc6e9d0..663ed2a 100644 --- a/test-e2e/features/actions.feature +++ b/test-e2e/features/actions.feature @@ -25,14 +25,24 @@ Feature: actions And I click '{$x}, {$y}' coordinates in 'Body' Then I expect text of 'Action' to be equal 'Button4' - Scenario: type - When I type 'test value' to 'Input' + Scenario Outline: type () + When I type 'test value' 'Input' Then I expect text of 'Action' to be equal 'test value' - Scenario: type chars - When I type 'test value' chars to 'Input' + Examples: + | word | + | to | + | into | + + Scenario Outline: type chars () + When I type 'test value' chars 'Input' Then I expect text of 'Action' to be equal 'test value' + Examples: + | word | + | to | + | into | + Scenario: clear When I type 'test value' to 'Input' When I clear 'Input'