@allwright.dev/vitest 0.1.19 → 0.1.20
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/dist/expectations.js +7 -6
- package/dist/index.js +6 -0
- package/package.json +2 -2
package/dist/expectations.js
CHANGED
|
@@ -46,14 +46,15 @@ function expectedText(expected) {
|
|
|
46
46
|
}
|
|
47
47
|
async function isVisible(locator, command) {
|
|
48
48
|
if ("filter" in locator) {
|
|
49
|
-
return (await locator.filter({ visible: true }).count(command))
|
|
49
|
+
return (await locator.filter({ visible: true }).count(command)) > 0;
|
|
50
50
|
}
|
|
51
51
|
// Android has no visibility-filter query. An absent node is not visible; only
|
|
52
52
|
// its explicit native visibility failure is a negative observation.
|
|
53
|
-
if ((await locator.count(command))
|
|
53
|
+
if ((await locator.count(command)) === 0)
|
|
54
54
|
return false;
|
|
55
55
|
try {
|
|
56
|
-
|
|
56
|
+
await locator.waitFor({ ...command, visible: true });
|
|
57
|
+
return true;
|
|
57
58
|
}
|
|
58
59
|
catch (error) {
|
|
59
60
|
if (error instanceof Error && error.message.startsWith("selector found but not visible: "))
|
|
@@ -67,7 +68,7 @@ export function createLocatorExpect(locator, defaults, negated = false) {
|
|
|
67
68
|
get not() { return callableMatchers(createLocatorExpect(locator, defaults, !negated)); },
|
|
68
69
|
async toHaveText(expected, options = {}) {
|
|
69
70
|
await retryExpectation(async (command) => {
|
|
70
|
-
const
|
|
71
|
+
const text = await locator.textContent(command);
|
|
71
72
|
if (expected instanceof RegExp)
|
|
72
73
|
assertion(text).toMatch(new RegExp(expected.source, expected.flags));
|
|
73
74
|
else
|
|
@@ -76,7 +77,7 @@ export function createLocatorExpect(locator, defaults, negated = false) {
|
|
|
76
77
|
},
|
|
77
78
|
async toContainText(expected, options = {}) {
|
|
78
79
|
await retryExpectation(async (command) => {
|
|
79
|
-
const
|
|
80
|
+
const text = await locator.textContent(command);
|
|
80
81
|
if (expected instanceof RegExp)
|
|
81
82
|
assertion(text).toMatch(new RegExp(expected.source, expected.flags));
|
|
82
83
|
else
|
|
@@ -85,7 +86,7 @@ export function createLocatorExpect(locator, defaults, negated = false) {
|
|
|
85
86
|
},
|
|
86
87
|
async toHaveCount(expected, options = {}) {
|
|
87
88
|
await retryExpectation(async (command) => {
|
|
88
|
-
assertion(
|
|
89
|
+
assertion(await locator.count(command)).toBe(expected);
|
|
89
90
|
}, options, defaults());
|
|
90
91
|
},
|
|
91
92
|
async toBeVisible(options = {}) {
|
package/dist/index.js
CHANGED
|
@@ -355,6 +355,12 @@ function createLazyMobileApp(appResource) {
|
|
|
355
355
|
async registerHook(type) {
|
|
356
356
|
return (await appResource.get()).registerHook(type);
|
|
357
357
|
},
|
|
358
|
+
async goto(url, options) {
|
|
359
|
+
return (await appResource.get()).goto(url, options);
|
|
360
|
+
},
|
|
361
|
+
async navigate(url, options) {
|
|
362
|
+
return (await appResource.get()).navigate(url, options);
|
|
363
|
+
},
|
|
358
364
|
async click(selector, options) {
|
|
359
365
|
return (await appResource.get()).click(selector, options);
|
|
360
366
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allwright.dev/vitest",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Vitest fixtures for the allwright TypeScript client.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"prepublishOnly": "bun run build"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@allwright.dev/core": "0.1.
|
|
50
|
+
"@allwright.dev/core": "0.1.20"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"typescript": "^5.9.2",
|