nativeproof 0.9.0 → 0.10.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ All notable changes to NativeProof are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/) and the project adheres to
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## 0.10.0
8
+
9
+ Element enabled-state assertions.
10
+
11
+ **Added**
12
+
13
+ - **`Locator.isEnabled()` / `isDisabled()` and `expect(locator).toBeEnabled()` / `toBeDisabled()`** —
14
+ read the matched element's `enabled` attribute (present and not `enabled="false"` is enabled, matching
15
+ Playwright's default-enabled semantics). Auto-waiting, `.not` inverts. For asserting a button/control
16
+ flips between enabled and disabled as a form validates.
17
+
7
18
  ## 0.9.0
8
19
 
9
20
  Regex frame matching — `expect(mock)` matches traffic by pattern.
package/README.md CHANGED
@@ -489,6 +489,7 @@ await expect(member.spinner).not.toBeVisible({ timeout: 5_000 });
489
489
  - `toShow(text, opts?)` — the selector is present **and** `text` appears in the source.
490
490
  - `toHaveText(text, opts?)` — the matched node's **own** text contains / matches `text`.
491
491
  - `toBeChecked(opts?)` — the matched checkbox / switch is checked (`checked="true"`).
492
+ - `toBeEnabled(opts?)` / `toBeDisabled(opts?)` — the matched element's `enabled` state.
492
493
  - `toHaveCount(n, opts?)` — exactly `n` elements match the selector.
493
494
  - `opts` is `{ timeout?, interval? }` (ms).
494
495
 
package/dist/expect.d.ts CHANGED
@@ -16,6 +16,10 @@ export interface LocatorAssertions {
16
16
  toHaveText(text: string | RegExp, options?: WaitOptions): Promise<void>;
17
17
  /** The matched checkbox/switch is checked (`checked="true"`). */
18
18
  toBeChecked(options?: WaitOptions): Promise<void>;
19
+ /** The matched element is enabled (present and not `enabled="false"`). */
20
+ toBeEnabled(options?: WaitOptions): Promise<void>;
21
+ /** The matched element is present and `enabled="false"`. */
22
+ toBeDisabled(options?: WaitOptions): Promise<void>;
19
23
  /** Exactly `count` elements match the selector. */
20
24
  toHaveCount(count: number, options?: WaitOptions): Promise<void>;
21
25
  }
package/dist/expect.js CHANGED
@@ -28,6 +28,12 @@ class LocatorExpectation {
28
28
  toBeChecked(options = {}) {
29
29
  return this.check(() => this.locator.isChecked(), "be checked", options);
30
30
  }
31
+ toBeEnabled(options = {}) {
32
+ return this.check(() => this.locator.isEnabled(), "be enabled", options);
33
+ }
34
+ toBeDisabled(options = {}) {
35
+ return this.check(() => this.locator.isDisabled(), "be disabled", options);
36
+ }
31
37
  toHaveCount(count, options = {}) {
32
38
  return this.check(async () => (await this.locator.count()) === count, `have count ${count}`, options);
33
39
  }
package/dist/locator.d.ts CHANGED
@@ -130,6 +130,10 @@ export declare class Locator {
130
130
  fill(text: string, options?: WaitOptions): Promise<void>;
131
131
  /** True if the matched node is a checked checkbox/switch (`checked="true"`). */
132
132
  isChecked(): Promise<boolean>;
133
+ /** True if the matched node is present and not `enabled="false"` (matches Playwright's default-enabled). */
134
+ isEnabled(): Promise<boolean>;
135
+ /** True if the matched node is present and explicitly `enabled="false"`. */
136
+ isDisabled(): Promise<boolean>;
133
137
  /** Tap to bring a checkbox/switch to checked; a no-op if it already is. */
134
138
  check(options?: WaitOptions): Promise<void>;
135
139
  /** Tap to bring a checkbox/switch to unchecked; a no-op if it already is. */
package/dist/locator.js CHANGED
@@ -212,6 +212,16 @@ export class Locator {
212
212
  const node = this.pick(await this.matchedNodes());
213
213
  return node !== null && /\bchecked="true"/.test(node);
214
214
  }
215
+ /** True if the matched node is present and not `enabled="false"` (matches Playwright's default-enabled). */
216
+ async isEnabled() {
217
+ const node = this.pick(await this.matchedNodes());
218
+ return node !== null && !/\benabled="false"/.test(node);
219
+ }
220
+ /** True if the matched node is present and explicitly `enabled="false"`. */
221
+ async isDisabled() {
222
+ const node = this.pick(await this.matchedNodes());
223
+ return node !== null && /\benabled="false"/.test(node);
224
+ }
215
225
  /** Tap to bring a checkbox/switch to checked; a no-op if it already is. */
216
226
  async check(options = {}) {
217
227
  await this.setChecked(true, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nativeproof",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Native Mobile E2E test framework inspired by Playwright (fixtures, locators, expect, route-style mocking) on Appium/WebdriverIO.",