This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/tests/wdio/test/pageobjects/provider-wizard.page.ts

54 lines
1.3 KiB
TypeScript

import AdminPage from "./admin.page.js";
import OauthForm from "./forms/oauth.form.js";
import { $ } from "@wdio/globals";
/**
* sub page containing specific selectors and methods for a specific page
*/
class ProviderWizardView extends AdminPage {
/**
* define selectors using getter methods
*/
oauth = OauthForm;
get wizardTitle() {
return $(">>>ak-wizard .pf-c-wizard__header h1.pf-c-title");
}
get providerList() {
return $(">>>ak-provider-wizard-initial");
}
get nextButton() {
return $(">>>ak-wizard footer button.pf-m-primary");
}
async getProviderType(type: string) {
return await this.providerList.$(`>>>input[value="${type}"]`);
}
get successMessage() {
return $('>>>[data-commit-state="success"]');
}
}
type Pair = [string, string];
// Define a getter for each provider type in the radio button collection.
const providerValues: Pair[] = [["oauth2", "oauth2Provider"]];
providerValues.forEach(([value, name]: Pair) => {
Object.defineProperties(ProviderWizardView.prototype, {
[name]: {
get: function () {
return this.providerList.$(`>>>input[id="ak-provider-${value}-form"]`);
},
},
});
});
export default new ProviderWizardView();