Files
authentik/web/tests/pageobjects/application-wizard.page.ts
Ken Sternberg 248fcdd1bf web: update tests for Chromedriver 131 (#12199)
* web: Add InvalidationFlow to Radius Provider dialogues

## What

- Bugfix: adds the InvalidationFlow to the Radius Provider dialogues
  - Repairs: `{"invalidation_flow":["This field is required."]}` message, which was *not* propagated
    to the Notification.
- Nitpick: Pretties `?foo=${true}` expressions: `s/\?([^=]+)=\$\{true\}/\1/`

## Note

Yes, I know I'm going to have to do more magic when we harmonize the forms, and no, I didn't add the
Property Mappings to the wizard, and yes, I know I'm going to have pain with the *new* version of
the wizard. But this is a serious bug; you can't make Radius servers with *either* of the current
dialogues at the moment.

* web: fix selector warnings in WebdriverIO

Despite the [promises made](https://webdriver.io/docs/selectors#deep-selectors) by the WebdriverIO
team, we are still getting a lot of warnings and "falling back to pre-BIDI behavior" messages
when we attempt to access ShadowDOM contexts without the "pierce" (`>>>`) syntax.  So I've put
it back wherever it occurred and the system now uses the BIDI controllers correctly.

* web: update to Chromedriver 131 breaks a lot of stuff

This annoying bit of janitorial work cleans up the failure messages and resolution bugs
that arose when updating to the latest version of Chrome.  Keeping track of all the
weakness and breakage while the in-browser testing teams figure out how to live with
the ShadowDOM is just really time-consuming.
2024-12-02 08:19:51 -08:00

80 lines
2.4 KiB
TypeScript

import { $ } from "@wdio/globals";
import AdminPage from "./admin.page.js";
import ApplicationForm from "./forms/application.form.js";
import ForwardProxyForm from "./forms/forward-proxy.form.js";
import LdapForm from "./forms/ldap.form.js";
import OauthForm from "./forms/oauth.form.js";
import RadiusForm from "./forms/radius.form.js";
import SamlForm from "./forms/saml.form.js";
import ScimForm from "./forms/scim.form.js";
import TransparentProxyForm from "./forms/transparent-proxy.form.js";
/**
* sub page containing specific selectors and methods for a specific page
*/
class ApplicationWizardView extends AdminPage {
/**
* define selectors using getter methods
*/
ldap = LdapForm;
oauth = OauthForm;
transparentProxy = TransparentProxyForm;
forwardProxy = ForwardProxyForm;
saml = SamlForm;
scim = ScimForm;
radius = RadiusForm;
app = ApplicationForm;
async wizardTitle() {
return await $(">>>ak-wizard-frame").$(">>>.pf-c-wizard__title");
}
async providerList() {
return await $(">>>ak-application-wizard-authentication-method-choice");
}
async nextButton() {
return await $(">>>ak-wizard-frame").$(">>>footer button.pf-m-primary");
}
async getProviderType(type: string) {
// @ts-expect-error "TSC does not understand the ChainablePromiseElement type at all."
return await this.providerList().$(`input[value="${type}"]`);
}
async successMessage() {
return await $('>>>[data-commit-state="success"]');
}
}
type Pair = [string, string];
// Define a getter for each provider type in the radio button collection.
const providerValues: Pair[] = [
["oauth2provider", "oauth2Provider"],
["ldapprovider", "ldapProvider"],
["proxyprovider-proxy", "proxyProviderProxy"],
["proxyprovider-forwardsingle", "proxyProviderForwardsingle"],
["radiusprovider", "radiusProvider"],
["samlprovider", "samlProvider"],
["scimprovider", "scimProvider"],
];
providerValues.forEach(([value, name]: Pair) => {
Object.defineProperties(ApplicationWizardView.prototype, {
[name]: {
get: async function () {
return await (
await this.providerList()
).$(`>>>div[data-ouid-component-name="${value}"]`);
},
},
});
});
export default new ApplicationWizardView();