* Just cleaning up. * web: removing sonarjs from yet another branch. * web: everything except the tests are up-to-date. There was a lot, it turns out, we simply weren't using. * web: update package.json to support WebdriverIO 9 This commit: - Upgrades to WebdriverIO 9.1.2 - Resets our `devDependencies` collection to remove all imports that we either were not using or were duplicates of existing dependencies: - *Babel*, of all things - Storybook addon css user preferences, now native to Storybook 8 - SonarJS, *again*, sigh. - React - Fixes a bug where ESLint would report missing features in our build scripts - Fixes a bug where Wdio might not reach a headless browser before timeout - Replaces Rollup's CSSLit with Vite's CSSLit, which actually works without hacks, for testing. - Moves the package-lock scanner to its own script, with better reporting and tool verification, which also cleans up the package.lock file a little. * web: unify unit and end-to-end tests This commit builds on the Upgrade to WebdriverIO 9.1 and provides *two* variants of the wdio.conf file: One in `browser` mode, so that standalone component tests are uploaded to the browser and run independently, and one in `local` mode that allows the Webdriver-DOM framework to run end-to-end tests. This means that both Component and End-to-End tests use the same drivers, same framework, and same versions, and all tests for the WebUI are contained in this folder. * Prettier just opinionatin' all over the place. * Eslint bein' disagreeable. * Tests embedded like ticks. * Someday I'll get prettier to agree with my IDE. * Re-ran the installation with resolutions enforced. * web: fix type errors in tests Typechecking the tests is pretty messy, first because WebdriverIO passes around a lot of `ChainablePromise` objects, which TSC does not know how to resolve to their final form after a full `await`, and second because I used a lot of metaprogramming to provide getters for the different kinds of subtypes (here: providers) that we are targeting. So there are a lot of compromises here, none of which make me spectacularly happy, but they're all well-commented, so there's that. * But I am done with you, orc. * Fixed broken comment.
		
			
				
	
	
		
			80 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			2.3 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();
 |