Skip to content

Commit 9f08de9

Browse files
changed simple expects to poll expects (#90)
* changed simple expects to poll expects * replaced _playwrightValueWait_ type with more generic _playwrightValidation_ allowing more wait types
1 parent 9fb3e0f commit 9f08de9

File tree

14 files changed

+150
-211
lines changed

14 files changed

+150
-211
lines changed

.github/workflows/pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
test:
1010
strategy:
1111
matrix:
12-
version: [ 18, 20, 21 ]
12+
version: [ 18, 20 ]
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
88
:beetle: - bugfix
99
:x: - deprecation
1010

11+
## [0.40.0]
12+
- :rocket: changed simple expects to poll expects
13+
- :rocket: replaced _wdioValueWait_ type with more generic _wdioValidation_ allowing more wait types
14+
Breaking change: value waits now depends on _value_ timeout
15+
1116
## [0.39.0]
1217
- :rocket: enabled logger for page objects
1318

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ module.exports = {
1919
timeout: {
2020
present: 10000,
2121
visible: 20000,
22-
page: 10000
22+
page: 10000,
23+
value: 5000, // expect value timeout
24+
valueInterval: 500 //expect value interval
2325
},
2426
capabilities: {
2527
browserName: 'chromium'

package-lock.json

Lines changed: 39 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@qavajs/steps-playwright",
3-
"version": "0.39.0",
3+
"version": "0.40.0",
44
"description": "steps to interact with playwright",
55
"main": "./index.js",
66
"scripts": {
@@ -30,20 +30,20 @@
3030
"@qavajs/console-formatter": "^0.6.0",
3131
"@qavajs/html-formatter": "^0.15.2",
3232
"@qavajs/memory": "^1.6.2",
33-
"@qavajs/po-playwright": "^0.11.3",
33+
"@qavajs/po-playwright": "^0.12.0",
3434
"@qavajs/webstorm-adapter": "^8.0.0",
35-
"@types/chai": "^4.3.10",
35+
"@types/chai": "^4.3.11",
3636
"@types/express": "^4.17.21",
3737
"@vitest/coverage-v8": "^0.34.6",
38-
"electron": "^27.1.0",
38+
"electron": "^27.1.2",
3939
"express": "^4.18.2",
4040
"ts-node": "^10.9.1",
41-
"typescript": "^5.2.2",
41+
"typescript": "^5.3.2",
4242
"vitest": "^0.34.6"
4343
},
4444
"dependencies": {
4545
"@playwright/test": "^1.40.0",
46-
"@qavajs/validation": "^0.6.0",
46+
"@qavajs/validation": "^0.7.0",
4747
"playwright": "^1.40.0"
4848
}
4949
}

src/defaultTimeouts.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export default {
22
present: 10000,
33
visible: 10000,
4-
page: 10000
4+
page: 10000,
5+
value: 5000,
6+
valueInterval: 500
57
}

src/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ BeforeAll(async function () {
3737
await createJSEngine();
3838
});
3939

40-
Before(async function () {
40+
Before({name: 'context init'}, async function () {
4141
const driverConfig = config.browser ?? config.driver;
4242
driverConfig.isElectron = driverConfig.capabilities.browserName === 'electron';
4343
driverConfig.timeout = {
@@ -89,7 +89,7 @@ AfterStep(async function (step: ITestStepHookParameter) {
8989
}
9090
});
9191

92-
After(async function (scenario: ITestCaseHookParameter) {
92+
After({name: 'context teardown'}, async function (scenario: ITestCaseHookParameter) {
9393
if (saveTrace(config.driverConfig, scenario)) {
9494
const path = traceArchive(config.driverConfig, scenario);
9595
await context.tracing.stop({ path });

src/transformers.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { conditionWait, conditionWaitExtractRegexp } from './conditionWait';
2-
import { valueWait, valueWaitExtractRegexp } from './valueWait';
32
import { po } from '@qavajs/po-playwright';
43
import memory from '@qavajs/memory';
54
import { Locator } from 'playwright';
@@ -20,12 +19,3 @@ export function getConditionWait(condition: string): Function {
2019
await conditionWait(element, validation, timeout, Boolean(reverse))
2120
}
2221
}
23-
24-
export function getValueWait(condition: string): Function {
25-
const match = condition.match(valueWaitExtractRegexp) as RegExpMatchArray;
26-
if (!match) throw new Error(`${condition} wait is not implemented`);
27-
const [ _, reverse, validation ] = match;
28-
return async function (valueFn: Function, expected: any, timeout: number) {
29-
await valueWait(valueFn, expected, validation, timeout, Boolean(reverse))
30-
}
31-
}

0 commit comments

Comments
 (0)