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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

:microscope: - experimental

## [2.9.0]
- :rocket: added capability to execute script on electron main process
```gherkin
Scenario: evaluate script on main process
When I execute '$js(async ({ app }) => app.showAboutPanel())' script on electron app

Scenario: evaluate script on main process and save result to memory
When I execute '$js(async ({ app }) => app.getAppPath())' script on electron app and save result as 'appPath'
Then I expect '$appPath' memory value to contain 'test-e2e/apps/electron'
```

## [2.8.0]
- :rocket: improved logging to display full path

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ It enables easy and efficient browser automation in a behavior-driven developmen

## Features

- Predefined steps for web automation using Playwright
- 🔄 Seamless integration with `@qavajs/core`
- 🧩 Support for dynamic locators and parameters
- 🧪 Built-in assertions and synchronization steps
- 🔧 Easily extendable for custom needs
- Predefined steps for web automation using Playwright
- Seamless integration with `@qavajs/core`
- Support for dynamic locators and parameters
- Built-in assertions and synchronization steps
- Easily extendable for custom needs

## Installation
```bash
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ require('./lib/poDefine.js');
require('./lib/mouseActions.js');
require('./lib/keyboardActions.js');
require('./lib/dialog.js');
require('./lib/electron.js');
12 changes: 6 additions & 6 deletions package-lock.json

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

34 changes: 30 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@qavajs/steps-playwright",
"version": "2.8.0",
"description": "steps to interact with playwright",
"version": "2.9.0",
"description": "qavajs steps to interact with playwright",
"main": "./index.js",
"scripts": {
"build": "tsc",
Expand Down Expand Up @@ -34,7 +34,7 @@
"@qavajs/validation": "^1.3.0",
"@qavajs/webstorm-adapter": "^8.0.0",
"@types/express": "^5.0.3",
"@types/node": "^24.3.0",
"@types/node": "^24.3.1",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"electron": "^38.0.0",
Expand All @@ -45,5 +45,31 @@
},
"dependencies": {
"@playwright/test": "^1.55.0"
}
},
"keywords": [
"test",
"automation",
"testing",
"qa",
"quality-assurance",
"test-framework",
"test-runner",
"test-automation",
"e2e",
"end-to-end",
"ui-testing",
"integration-testing",
"acceptance-testing",
"functional-testing",
"browser-testing",
"mobile-testing",
"cross-browser",
"bdd",
"gherkin",
"assertions",
"continuous-delivery",
"automation-framework",
"playwright",
"webdriver"
]
}
23 changes: 23 additions & 0 deletions src/electron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { type MemoryValue, When } from '@qavajs/core';

/**
* Execute client function on electron process and save result into memory
* @param {string} functionKey - memory key of function
* @param {string} memoryKey - memory key to store result
* @example I execute '$fn' function and save result as 'result' // fn is function reference
* @example I execute '$js(async ({ app }) => app.getAppPath())' function and save result as 'scroll'
*/
When('I execute {value} function/script on electron app', async function (fn: MemoryValue) {
await this.playwright.driver.evaluate(await fn.value());
});

/**
* Execute client function on electron process and save result into memory
* @param {string} functionKey - memory key of function
* @param {string} memoryKey - memory key to store result
* @example I execute '$fn' function and save result as 'result' // fn is function reference
* @example I execute '$js(async ({ app }) => app.getAppPath())' function on electron app and save result as 'result'
*/
When('I execute {value} function/script on electron app and save result as {value}', async function (fn: MemoryValue, memoryKey: MemoryValue) {
memoryKey.set(await this.playwright.driver.evaluate(await fn.value()));
});
9 changes: 8 additions & 1 deletion test-e2e/features/electron/electron.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ Feature: electron
Scenario: open electron app
* I click 'Open New Window Electron Button'
* I switch to 'qavajs electron app new window' window
* I click 'Close Current Window Electron Button'
* I click 'Close Current Window Electron Button'

Scenario: evaluate script on main process
* I execute '$js(async ({ app }) => app.showAboutPanel())' script on electron app

Scenario: evaluate script on main process and save result to memory
* I execute '$js(async ({ app }) => app.getAppPath())' script on electron app and save result as 'appPath'
* I expect '$appPath' memory value to contain 'test-e2e/apps/electron'