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 324c8d9
🔍 Latest deploy log https://app.netlify.com/projects/authentik-elements-storybook/deploys/695d9604c5c7bb00086f5bbb
😎 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
@property({ reflect: true, type: Boolean, attribute: "disabled" })
public _disabled = false;
@property({ reflect: true, type: Boolean })
disabled = false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Revealed during testing: the disabled flag wasn't being read correctly (I'm still new to this whole internals-with-CSS-states thing), and the button wasn't being disabled correctly.

--button--m-danger--BackgroundColor: var(--button--m-link--m-danger--BackgroundColor);
}

:is(:host:disabled, :host([disabled])) #main {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Part of the problem is that I was writing the disabled state to the wrong place; obviously, the concrete CSS declaration must go on the component being modified.

writeFile,
} from "./lib/utilities.mjs";

// @ts-expect-error no types provided
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We now provide all of these...

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.

2 participants