LearnNewsExamplesServices
Frontmatter
titledocs: add playwright test for Neo.component.label (#7737)
authorAlachi24
stateClosed
createdAtNov 13, 2025, 3:16 PM
updatedAtJan 1, 2026, 3:48 PM
closedAtJan 1, 2026, 3:48 PM
mergedAt
branchesdevtestplan_docs/Playwright-component
urlhttps://github.com/neomjs/neo/pull/7768
Closed
Alachi24
Alachi24 commented on Nov 13, 2025, 3:16 PM

Please make sure to read the Contributing Guidelines:

https://github.com/neomjs/neo/blob/dev/CONTRIBUTING.md

Does this PR resolve an issue? (Required)

Closes #

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe: Just a test, no refactoring

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills this requirement:

  • It's submitted to the dev branch, not the main branch

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information: closes #7737

kindly review @tobiu

tobiu
tobiu commented on Nov 14, 2025, 10:22 AM

Did you actually run the test file, and ensure that it passes? await expect(label).toHaveAttribute('data-ntype', 'label'); => this one looks like a hallucination to me. Afaik there is no data-ntype DOM attribute.


Alachi24
Alachi24 commented on Nov 14, 2025, 11:29 AM

I did using the AI Agent, the only issue I got was not having a Playwright dependency installed which I've rectified but before that, the response given was everything is in check.

I'd test it again and see the outcome @tobiu


Alachi24
Alachi24 commented on Nov 15, 2025, 9:55 PM

I have done retest using the AI Agent. Kindly check and confirm @tobiu


tobiu
tobiu commented on Nov 15, 2025, 10:26 PM

i am not sure what you are doing, but if i use npm run test-components i get this:

/usr/local/bin/npm run test-components

> neo.mjs@11.4.0 test-components > playwright test -c test/playwright/playwright.config.component.mjs

[WebServer] <i> [webpack-dev-server] Project is running at: [WebServer] <i> [webpack-dev-server] Loopback: http://localhost:8080/, http://[::1]:8080/ [WebServer] <i> [webpack-dev-server] On Your Network (IPv4): http://192.168.178.75:8080/ [WebServer] <i> [webpack-dev-server] On Your Network (IPv6): http://[fdf3:513e:29c0:0:c52:ab3c:4d9a:c1fd]:8080/ [WebServer] <i> [webpack-dev-server] Content not from webpack is served from '/Users/Shared/github/neomjs/neo' directory [WebServer] <i> [webpack-dev-middleware] wait until bundle finished: / [WebServer] <i> [webpack-dev-middleware] wait until bundle finished: /

Running 35 tests using 1 worker

✓ 1 …right/component/button/Base.spec.mjs:19:5 › Neo.button.Base › should create a button with icon and text (483ms) ✓ 2 …ium] › test/playwright/component/button/Base.spec.mjs:47:5 › Neo.button.Base › should show isLoading UI (772ms) ✓ 3 …aywright/component/component/Base.spec.mjs:50:5 › Neo.component.Base › Checking colliding style updates (600ms) ✓ 4 …aywright/component/component/Base.spec.mjs:128:5 › Neo.component.Base › Checking colliding vdom updates (533ms) ✓ 5 …nent/DateSelector.spec.mjs:40:5 › Neo.component.DateSelector › should render the DateSelector component (449ms) ✓ 6 …right/component/component/Image.spec.mjs:37:5 › Neo.component.Image › should render and mount correctly (432ms) ✓ 7 …onent/Image.spec.mjs:47:5 › Neo.component.Image › should update src and alt attributes on config change (330ms) ✘ 8 …Neo.component.Label › Component-Specific Feature Tests › should have baseCls and render as a <label> tag (5.4s) ✓ 9 …9 › Neo.component.Label › Component-Specific Feature Tests › should set textContent via the text config (376ms) ✓ 10 …ponent.Label › Component-Specific Feature Tests › should have user-select: none and white-space: nowrap (444ms) ✓ 11 …omponent/Label.spec.mjs:59:9 › Neo.component.Label › Inherited Behavior Tests › should apply custom cls (434ms) ✓ 12 …ent/component/Label.spec.mjs:64:9 › Neo.component.Label › Inherited Behavior Tests › should be disabled (428ms) ✓ 13 …onent/component/Label.spec.mjs:69:9 › Neo.component.Label › Inherited Behavior Tests › should be hidden (321ms) ✓ 14 …ec.mjs:74:9 › Neo.component.Label › Inherited Behavior Tests › should set innerHTML via the html config (428ms) ✘ 15 …ponent/Label.spec.mjs:80:9 › Neo.component.Label › Inherited Behavior Tests › should apply custom styles (5.3s) ✓ 16 …t/component/Label.spec.mjs:87:9 › Neo.component.Label › Inherited Behavior Tests › should be scrollable (369ms) ✓ 17 …omponent/Label.spec.mjs:93:9 › Neo.component.Label › Inherited Behavior Tests › should apply ui classes (437ms) ✓ 18 …nent/component/Label.spec.mjs:98:9 › Neo.component.Label › Inherited Behavior Tests › should apply role (433ms) ✓ 19 …ent/component/Label.spec.mjs:103:9 › Neo.component.Label › Inherited Behavior Tests › should change tag (349ms) ✘ 20 …ec.mjs:108:9 › Neo.component.Label › Inherited Behavior Tests › should apply wrapperCls and wrapperStyle (5.3s) ✓ 21 …ponent/Label.spec.mjs:122:9 › Neo.component.Label › Inherited Behavior Tests › should show isLoading UI (491ms) ✓ 22 …mponent/Label.spec.mjs:138:9 › Neo.component.Label › Inherited Behavior Tests › should create a tooltip (766ms) ✓ 23 …ium] › test/playwright/component/form/field/ComboBox.spec.mjs:55:5 › Neo.form.field.ComboBox › Editable (848ms) ✓ 24 …/playwright/component/form/field/ComboBox.spec.mjs:114:5 › Neo.form.field.ComboBox › Keyboard navigation (1.3s) ✓ 25 …test/playwright/component/form/field/ComboBox.spec.mjs:170:5 › Neo.form.field.ComboBox › Type to filter (789ms) ✓ 26 …/playwright/component/form/field/ComboBox.spec.mjs:212:5 › Neo.form.field.ComboBox › With store as data (508ms) ✓ 27 …wright/component/form/field/Number.spec.mjs:41:5 › Neo.form.field.Number › should create a number field (441ms) ✓ 28 …d/Number.spec.mjs:49:5 › Neo.form.field.Number › should increment and decrement value with spin buttons (709ms) ✓ 29 …nt/form/field/Number.spec.mjs:65:5 › Neo.form.field.Number › should wrap around when exceeding maxValue (586ms) ✓ 30 …orm/field/Number.spec.mjs:85:5 › Neo.form.field.Number › should wrap around when falling below minValue (481ms) ✓ 31 …laywright/component/form/field/Text.spec.mjs:43:5 › Neo.form.field.Text › Check isTouched on focusLeave (598ms) ✓ 32 …laywright/component/form/field/Text.spec.mjs:57:5 › Neo.form.field.Text › Check isTouched on focusEnter (560ms) ✓ 33 …laywright/component/form/field/Text.spec.mjs:70:5 › Neo.form.field.Text › Check isTouched set initially (437ms) ✓ 34 …mium] › test/playwright/component/form/field/Text.spec.mjs:79:5 › Neo.form.field.Text › Label Positions (659ms) ✓ 35 [chromium] › test/playwright/component/list/Chip.spec.mjs:58:5 › ChipListComponent › Sanity (563ms)

  1. [chromium] › test/playwright/component/component/Label.spec.mjs:39:9 › Neo.component.Label › Component-Specific Feature Tests › should have baseCls and render as a <label> tag
Error: expect(locator).toHaveAttribute(expected) failed

Locator:  locator(&#39;#neo-label-1&#39;)
Expected: &quot;label&quot;
Received: &quot;&quot;
Timeout:  5000ms

Call log:
  - Expect &quot;toHaveAttribute&quot; with timeout 5000ms
  - waiting for locator(&#39;#neo-label-1&#39;)
    9 × locator resolved to &lt;label id=&quot;neo-label-1&quot; class=&quot;neo-label&quot;&gt;Test Label&lt;/label&gt;
      - unexpected value &quot;null&quot;


  40 |             const label = await createLabel(page, {text: &#39;Test Label&#39;});
  41 |             await expect(label).toHaveClass(/neo-label/);
&gt; 42 |             await expect(label).toHaveAttribute(&#39;data-ntype&#39;, &#39;label&#39;);
     |                                 ^
  43 |             expect(await label.evaluate(node =&gt; node.tagName)).toBe(&#39;LABEL&#39;);
  44 |         });
  45 |
    at /Users/Shared/github/neomjs/neo/test/playwright/component/component/Label.spec.mjs:42:33
  1. [chromium] › test/playwright/component/component/Label.spec.mjs:80:9 › Neo.component.Label › Inherited Behavior Tests › should apply custom styles
Error: expect(locator).toHaveCSS(expected) failed

Locator:  locator(&#39;#neo-label-1&#39;)
Expected: &quot;100px&quot;
Received: &quot;720px&quot;
Timeout:  5000ms

Call log:
  - Expect &quot;toHaveCSS&quot; with timeout 5000ms
  - waiting for locator(&#39;#neo-label-1&#39;)
    9 × locator resolved to &lt;label id=&quot;neo-label-1&quot; class=&quot;neo-label&quot;&gt;&lt;/label&gt;
      - unexpected value &quot;720px&quot;


  81 |             const label = await createLabel(page, {style: {color: &#39;rgb(255, 0, 0)&#39;, height: &#39;100px&#39;, width: &#39;200px&#39;}});
  82 |             await expect(label).toHaveCSS(&#39;color&#39;, &#39;rgb(255, 0, 0)&#39;);
&gt; 83 |             await expect(label).toHaveCSS(&#39;height&#39;, &#39;100px&#39;);
     |                                 ^
  84 |             await expect(label).toHaveCSS(&#39;width&#39;, &#39;200px&#39;);
  85 |         });
  86 |
    at /Users/Shared/github/neomjs/neo/test/playwright/component/component/Label.spec.mjs:83:33
  1. [chromium] › test/playwright/component/component/Label.spec.mjs:108:9 › Neo.component.Label › Inherited Behavior Tests › should apply wrapperCls and wrapperStyle
Error: expect(locator).toHaveClass(expected) failed

Locator: locator(&#39;#neo-label-1&#39;).locator(&#39;..&#39;)
Expected pattern: /my-wrapper-class/
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect &quot;toHaveClass&quot; with timeout 5000ms
  - waiting for locator(&#39;#neo-label-1&#39;).locator(&#39;..&#39;)
    7 × locator resolved to &lt;div id=&quot;component-test-viewport&quot; class=&quot;neo-viewport neo-flex-container neo-flex-align-stretch neo-flex-direction-column neo-flex-wrap-nowrap&quot;&gt;…&lt;/div&gt;
      - unexpected value &quot;neo-viewport neo-flex-container neo-flex-align-stretch neo-flex-direction-column neo-flex-wrap-nowrap&quot;


  115 |             });
  116 |             const wrapper = label.locator(&#39;..&#39;);
&gt; 117 |             await expect(wrapper).toHaveClass(/my-wrapper-class/);
      |                                   ^
  118 |             await expect(wrapper).toHaveCSS(&#39;background-color&#39;, &#39;rgb(0, 128, 0)&#39;);
  119 |             await expect(wrapper).toHaveCSS(&#39;padding&#39;, &#39;10px&#39;);
  120 |         });
    at /Users/Shared/github/neomjs/neo/test/playwright/component/component/Label.spec.mjs:117:35

3 failed [chromium] › test/playwright/component/component/Label.spec.mjs:39:9 › Neo.component.Label › Component-Specific Feature Tests › should have baseCls and render as a <label> tag [chromium] › test/playwright/component/component/Label.spec.mjs:80:9 › Neo.component.Label › Inherited Behavior Tests › should apply custom styles [chromium] › test/playwright/component/component/Label.spec.mjs:108:9 › Neo.component.Label › Inherited Behavior Tests › should apply wrapperCls and wrapperStyle 32 passed (39.0s)

Process finished with exit code 1