Skip to content

Conversation

@kensternberg-authentik
Copy link
Collaborator

@kensternberg-authentik kensternberg-authentik commented Jan 1, 2026

elements: Move testing to vitest + playwright

What

Remove WebdriverIO as our testing framework, and switch to using vitest + playwright. Re-write all existing tests to use the new testing framework.

Many of the tests removed were auto-generated and, it turns out, unnecessary. They tested that if you set a property value, the property value was set; this is only relevant if we’re actively changing property values at the host level, something you should never do except when using reflect, which none of the components in the infrastructure collection do.

What’s left are the purely functional tests. In the case of Icons, there are still a lot because a lot of values are forwarded from the :host to the icon. But many are simply missing because they’re pure CSS; they only manifest because :host([somesetting]) triggered a CSS change, and have no behavioral consequences. As a result, they can’t really be tested, only eyeballed, which is why there are storybooks for all of those.

This PR also includes a github action to run these tests in CI/CD.

# What

While testing, I discovered that the `disabled` feature was not working as expected.

The visuals weren’t being applied correctly, which required some CSS work to correct. This also fixed the issue where the pointer events weren’t being disabled at the same time. There were two issues: the concrete controls were being applied to the wrong component, and the CSS cascade was being read in the wrong order. `disabled` takes priority over virtually everything else, so it has to go at the bottom of the CSS field.

After that, I applied [the ARIA rules for disabled links](https://www.w3.org/TR/html-aria/#example-communicate-a-disabled-link-with-aria), which specifies that “to communicate a link as ‘disabled,’ remove the `href` attribute and style accordingly.” That, in turn, caused the underline to go away, which was not desired, so when the displayed part is a “disabled anchor,” I added CSS to force the underline to return.

I have added a story to show that the disabled button and disabled link work as expected.
@netlify
Copy link

netlify bot commented Jan 1, 2026

Deploy Preview for authentik-elements-storybook ready!

Name Link
🔨 Latest commit 7f3de0e
🔍 Latest deploy log https://app.netlify.com/projects/authentik-elements-storybook/deploys/696036a04c563f0008fb5e5b
😎 Deploy Preview https://deploy-preview-50--authentik-elements-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kensternberg-authentik kensternberg-authentik marked this pull request as ready for review January 6, 2026 22:57
expect(button).toHaveElementClass("danger");
// Verify slotted text content
const component = document.querySelector("ak-button");
expect(component?.textContent?.trim()).toBe("Click to leave");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the API, do these need await?

Suggested change
expect(component?.textContent?.trim()).toBe("Click to leave");
await expect(component?.textContent?.trim()).toBe("Click to leave");

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, expect.element does a lookup asynchronously, so it needs to be awaited; in this case, we're just using the standard expect syntax, which is synchronous.

kensternberg-authentik and others added 4 commits January 8, 2026 14:48
Co-authored-by: Teffen Ellis <[email protected]>
Signed-off-by: Ken Sternberg <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]>
Signed-off-by: Ken Sternberg <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]>
Signed-off-by: Ken Sternberg <[email protected]>
@kensternberg-authentik kensternberg-authentik merged commit eccd2eb into main Jan 8, 2026
5 checks passed
@kensternberg-authentik kensternberg-authentik deleted the experiment/playwright branch January 8, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants