codeceptjs 4.0.1-beta.18 → 4.0.1-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/helper/Playwright.js +74 -80
- package/lib/helper/extras/PlaywrightLocator.js +13 -34
- package/lib/locator.js +43 -52
- package/package.json +1 -1
- package/typings/promiseBasedTypes.d.ts +220 -32
- package/typings/types.d.ts +343 -40
- package/lib/helper/extras/PlaywrightReactVueLocator.js +0 -52
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
async function findReact(matcher, locator) {
|
|
2
|
-
// Handle both Locator objects and raw locator objects
|
|
3
|
-
const reactLocator = locator.locator || locator
|
|
4
|
-
let _locator = `_react=${reactLocator.react}`;
|
|
5
|
-
let props = '';
|
|
6
|
-
|
|
7
|
-
if (reactLocator.props) {
|
|
8
|
-
props += propBuilder(reactLocator.props);
|
|
9
|
-
_locator += props;
|
|
10
|
-
}
|
|
11
|
-
return matcher.locator(_locator).all();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async function findVue(matcher, locator) {
|
|
15
|
-
// Handle both Locator objects and raw locator objects
|
|
16
|
-
const vueLocator = locator.locator || locator
|
|
17
|
-
let _locator = `_vue=${vueLocator.vue}`;
|
|
18
|
-
let props = '';
|
|
19
|
-
|
|
20
|
-
if (vueLocator.props) {
|
|
21
|
-
props += propBuilder(vueLocator.props);
|
|
22
|
-
_locator += props;
|
|
23
|
-
}
|
|
24
|
-
return matcher.locator(_locator).all();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function findByPlaywrightLocator(matcher, locator) {
|
|
28
|
-
// Handle both Locator objects and raw locator objects
|
|
29
|
-
const pwLocator = locator.locator || locator
|
|
30
|
-
if (pwLocator && pwLocator.toString && pwLocator.toString().includes(process.env.testIdAttribute)) {
|
|
31
|
-
return matcher.getByTestId(pwLocator.pw.value.split('=')[1]);
|
|
32
|
-
}
|
|
33
|
-
const pwValue = typeof pwLocator.pw === 'string' ? pwLocator.pw : pwLocator.pw
|
|
34
|
-
return matcher.locator(pwValue).all();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function propBuilder(props) {
|
|
38
|
-
let _props = '';
|
|
39
|
-
|
|
40
|
-
for (const [key, value] of Object.entries(props)) {
|
|
41
|
-
if (typeof value === 'object') {
|
|
42
|
-
for (const [k, v] of Object.entries(value)) {
|
|
43
|
-
_props += `[${key}.${k} = "${v}"]`;
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
_props += `[${key} = "${value}"]`;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return _props;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { findReact, findVue, findByPlaywrightLocator };
|