web: test LDAP wizard sequence
This commit is contained in:
parent
6457702f00
commit
7e6a9fd3d2
|
@ -8,7 +8,7 @@ help: ## Show this help
|
|||
|
||||
ROOT := $(shell git rev-parse --show-toplevel 2> /dev/null)
|
||||
WDIO = npm run wdio
|
||||
SPEC = $(WDIO) -- --spec ./test/specs
|
||||
SPEC = $(WDIO) -- --logLevel warn --spec ./test/specs
|
||||
|
||||
LOCAL_BLUEPRINTS=$(ROOT)/blueprints/local
|
||||
|
||||
|
@ -35,3 +35,7 @@ test-good-login: node_modules admin-user ## Test that we can log into the serve
|
|||
|
||||
test-bad-login: node_modules admin-user ## Test that bad usernames and passwords create appropriate error messages
|
||||
$(SPEC)/bad-logins.ts
|
||||
|
||||
|
||||
test-application-wizard-ldap: node_modules admin-user
|
||||
$(SPEC)/new-wizard-ldap-application.ts
|
||||
|
|
|
@ -17,7 +17,7 @@ class ApplicationWizardView extends AdminPage {
|
|||
app = ApplicationForm;
|
||||
|
||||
get wizardTitle() {
|
||||
return $(">>>ak-application-wizard-commit-application h1.pf-c-title");
|
||||
return $(">>>ak-wizard-frame .pf-c-wizard__header h1.pf-c-title");
|
||||
}
|
||||
|
||||
get providerList() {
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import { login } from "../utils/login.js";
|
||||
import { randomId } from "../utils/index.js";
|
||||
import ApplicationsListPage from "../pageobjects/applications-list.page.js";
|
||||
import ApplicationsWizardView from "../pageobjects/applications-wizard.page.js";
|
||||
import ApplicationForm from "../pageobjects/application-form.view.js";
|
||||
import ApplicationWizardView from "../pageobjects/application-wizard.page.js";
|
||||
import { expect } from "@wdio/globals";
|
||||
|
||||
describe("Log into Authentik", () => {
|
||||
it("should login with valid credentials and reach the UserLibrary", () => {
|
||||
describe("Configure LDAP Application with Wizard", () => {
|
||||
it("Should configure a simple LDAP Application", async () => {
|
||||
const newPrefix = randomId();
|
||||
|
||||
await login();
|
||||
|
@ -14,9 +13,23 @@ describe("Log into Authentik", () => {
|
|||
expect(await ApplicationsListPage.pageHeader).toHaveText("Applications");
|
||||
|
||||
await ApplicationsListPage.startWizardButton.click();
|
||||
await ApplicationsWizardView.wizardTitle.toBeVisible();
|
||||
expect(await ApplicationsWizardView.wizardTitle).toHaveText("Create Application");
|
||||
await ApplicationWizardView.wizardTitle.waitForDisplayed();
|
||||
expect(await ApplicationWizardView.wizardTitle).toHaveText("New Application");
|
||||
|
||||
await ApplicationForm.name.setValue(`New LDAP Application - ${newPrefix}`);
|
||||
|
||||
await ApplicationWizardView.app.name.setValue(`New LDAP Application - ${newPrefix}`);
|
||||
await ApplicationWizardView.nextButton.click();
|
||||
await ApplicationWizardView.pause()
|
||||
|
||||
await ApplicationWizardView.providerList.waitForDisplayed();
|
||||
await ApplicationWizardView.providerList.$('>>>input[value=ldapprovider]').click();
|
||||
await ApplicationWizardView.nextButton.click();
|
||||
await ApplicationWizardView.pause()
|
||||
|
||||
await ApplicationWizardView.ldap.setBindFlow('default-authentication-flow');
|
||||
await ApplicationWizardView.nextButton.click();
|
||||
await ApplicationWizardView.pause()
|
||||
|
||||
await ApplicationWizardView.commitMessage.waitForDisplayed();
|
||||
expect(await ApplicationWizardView.commitMessage).toHaveText("Your application has been saved");
|
||||
})
|
||||
});
|
||||
|
|
15
tests/wdio/test/utils/index.ts
Normal file
15
tests/wdio/test/utils/index.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
export function randomId() {
|
||||
let dt = new Date().getTime();
|
||||
return "xxxxxxxx".replace(/x/g, (c) => {
|
||||
const r = (dt + Math.random() * 16) % 16 | 0;
|
||||
dt = Math.floor(dt / 16);
|
||||
return (c == "x" ? r : (r & 0x3) | 0x8).toString(16);
|
||||
});
|
||||
}
|
||||
|
||||
export function convertToSlug(text: string) {
|
||||
return text
|
||||
.toLowerCase()
|
||||
.replace(/ /g, "-")
|
||||
.replace(/[^\w-]+/g, "");
|
||||
}
|
Reference in a new issue