refactor tests first pass
This commit is contained in:
parent
0ee4f7ea8e
commit
123ee25626
2 changed files with 31 additions and 83 deletions
|
@ -53,22 +53,24 @@ const deleteModalTitle = "Delete user federation provider?";
|
||||||
const disableModalTitle = "Disable user federation provider?";
|
const disableModalTitle = "Disable user federation provider?";
|
||||||
|
|
||||||
describe("User Fed LDAP tests", () => {
|
describe("User Fed LDAP tests", () => {
|
||||||
it("Create Ldap provider from empty state", () => {
|
beforeEach(() => {
|
||||||
cy.visit("");
|
cy.visit("");
|
||||||
|
cy.wait(1000);
|
||||||
loginPage.logIn();
|
loginPage.logIn();
|
||||||
|
cy.wait(1000);
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
|
cy.wait(1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Create Ldap provider from empty state", () => {
|
||||||
cy.get("[data-testid=ldap-card]").click();
|
cy.get("[data-testid=ldap-card]").click();
|
||||||
|
|
||||||
providersPage.fillLdapRequiredGeneralData(
|
providersPage.fillLdapRequiredGeneralData(firstLdapName, firstLdapVendor);
|
||||||
firstLdapName,
|
|
||||||
firstLdapVendor,
|
|
||||||
);
|
|
||||||
providersPage.fillLdapRequiredConnectionData(
|
providersPage.fillLdapRequiredConnectionData(
|
||||||
connectionUrl,
|
connectionUrl,
|
||||||
firstBindType,
|
firstBindType,
|
||||||
firstBindDn,
|
firstBindDn,
|
||||||
firstBindCreds,
|
firstBindCreds
|
||||||
);
|
);
|
||||||
providersPage.fillLdapRequiredSearchingData(
|
providersPage.fillLdapRequiredSearchingData(
|
||||||
firstUsersDn,
|
firstUsersDn,
|
||||||
|
@ -85,14 +87,8 @@ describe("User Fed LDAP tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Update an existing LDAP provider and save", () => {
|
it("Update an existing LDAP provider and save", () => {
|
||||||
cy.visit("");
|
providersPage.clickProviderCard(firstLdapName);
|
||||||
loginPage.logIn();
|
|
||||||
sidebarPage.goToUserFederation();
|
|
||||||
|
|
||||||
cy.get('[data-testid="keycloak-card-title"]')
|
|
||||||
.contains(firstLdapName)
|
|
||||||
.click();
|
|
||||||
cy.wait(1000);
|
|
||||||
providersPage.selectCacheType(newPolicy);
|
providersPage.selectCacheType(newPolicy);
|
||||||
|
|
||||||
cy.contains(defaultLdapDay).click();
|
cy.contains(defaultLdapDay).click();
|
||||||
|
@ -110,25 +106,14 @@ describe("User Fed LDAP tests", () => {
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
|
|
||||||
cy.get('[data-testid="keycloak-card-title"]')
|
providersPage.clickProviderCard(firstLdapName);
|
||||||
.contains(firstLdapName)
|
|
||||||
.click();
|
|
||||||
cy.wait(1000);
|
|
||||||
|
|
||||||
expect(cy.contains(newPolicy).should("exist"));
|
expect(cy.contains(newPolicy).should("exist"));
|
||||||
expect(cy.contains(defaultPolicy).should("not.exist"));
|
expect(cy.contains(defaultPolicy).should("not.exist"));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Change existing LDAP provider and click button to cancel", () => {
|
it("Change existing LDAP provider and click button to cancel", () => {
|
||||||
cy.visit("");
|
providersPage.clickProviderCard(firstLdapName);
|
||||||
loginPage.logIn();
|
|
||||||
sidebarPage.goToUserFederation();
|
|
||||||
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.get('[data-testid="keycloak-card-title"]')
|
|
||||||
.contains(firstLdapName)
|
|
||||||
.click();
|
|
||||||
cy.wait(1000);
|
|
||||||
providersPage.selectCacheType(newPolicy);
|
providersPage.selectCacheType(newPolicy);
|
||||||
|
|
||||||
cy.contains(newLdapDay).click();
|
cy.contains(newLdapDay).click();
|
||||||
|
@ -141,32 +126,21 @@ describe("User Fed LDAP tests", () => {
|
||||||
cy.contains(defaultLdapMinute).click();
|
cy.contains(defaultLdapMinute).click();
|
||||||
|
|
||||||
providersPage.cancel();
|
providersPage.cancel();
|
||||||
|
cy.wait(1000);
|
||||||
|
|
||||||
cy.wait(1000);
|
providersPage.clickProviderCard(firstLdapName);
|
||||||
cy.get('[data-testid="keycloak-card-title"]')
|
|
||||||
.contains(firstLdapName)
|
|
||||||
.click();
|
|
||||||
cy.wait(1000);
|
|
||||||
providersPage.selectCacheType(newPolicy);
|
providersPage.selectCacheType(newPolicy);
|
||||||
|
|
||||||
expect(cy.contains(newLdapDay).should("exist"));
|
expect(cy.contains(newLdapDay).should("exist"));
|
||||||
expect(cy.contains(newLdapHour).should("exist"));
|
expect(cy.contains(newLdapHour).should("exist"));
|
||||||
expect(cy.contains(newLdapMinute).should("exist"));
|
expect(cy.contains(newLdapMinute).should("exist"));
|
||||||
|
|
||||||
expect(cy.contains(defaultLdapMinute).should("not.exist"));
|
expect(cy.contains(defaultLdapMinute).should("not.exist"));
|
||||||
|
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Disable an existing LDAP provider", () => {
|
it("Disable an existing LDAP provider", () => {
|
||||||
cy.visit("");
|
providersPage.clickProviderCard(firstLdapName);
|
||||||
loginPage.logIn();
|
|
||||||
sidebarPage.goToUserFederation();
|
|
||||||
|
|
||||||
cy.get('[data-testid="keycloak-card-title"]')
|
|
||||||
.contains(firstLdapName)
|
|
||||||
.click();
|
|
||||||
cy.wait(1000);
|
|
||||||
|
|
||||||
providersPage.disableEnabledSwitch();
|
providersPage.disableEnabledSwitch();
|
||||||
|
|
||||||
|
@ -184,48 +158,29 @@ describe("User Fed LDAP tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Enable an existing previously-disabled LDAP provider", () => {
|
it("Enable an existing previously-disabled LDAP provider", () => {
|
||||||
cy.visit("");
|
providersPage.clickProviderCard(firstLdapName);
|
||||||
loginPage.logIn();
|
|
||||||
sidebarPage.goToUserFederation();
|
|
||||||
|
|
||||||
cy.wait(1000);
|
|
||||||
|
|
||||||
cy.get('[data-testid="keycloak-card-title"]')
|
|
||||||
.contains(firstLdapName)
|
|
||||||
.click();
|
|
||||||
cy.wait(1000);
|
|
||||||
|
|
||||||
providersPage.enableEnabledSwitch();
|
providersPage.enableEnabledSwitch();
|
||||||
|
|
||||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||||
|
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
|
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
|
|
||||||
expect(cy.contains("Enabled").should("exist"));
|
expect(cy.contains("Enabled").should("exist"));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Create new LDAP provider using the New Provider dropdown", () => {
|
it("Create new LDAP provider using the New Provider dropdown", () => {
|
||||||
cy.visit("");
|
|
||||||
loginPage.logIn();
|
|
||||||
sidebarPage.goToUserFederation();
|
|
||||||
|
|
||||||
// cy get contains
|
// cy get contains
|
||||||
cy.contains("button", "Add new provider", ).click();
|
cy.contains("button", "Add new provider").click();
|
||||||
cy.contains("li", "LDAP").click();
|
cy.contains("li", "LDAP").click();
|
||||||
|
|
||||||
|
providersPage.fillLdapRequiredGeneralData(secondLdapName, secondLdapVendor);
|
||||||
// cy.contains("Add new provider").click();
|
|
||||||
// cy.contains("LDAP").click();
|
|
||||||
|
|
||||||
providersPage.fillLdapRequiredGeneralData(
|
|
||||||
secondLdapName,
|
|
||||||
secondLdapVendor,
|
|
||||||
);
|
|
||||||
providersPage.fillLdapRequiredConnectionData(
|
providersPage.fillLdapRequiredConnectionData(
|
||||||
connectionUrl,
|
connectionUrl,
|
||||||
secondBindType,
|
secondBindType,
|
||||||
secondBindDn,
|
secondBindDn,
|
||||||
secondBindCreds,
|
secondBindCreds
|
||||||
);
|
);
|
||||||
providersPage.fillLdapRequiredSearchingData(
|
providersPage.fillLdapRequiredSearchingData(
|
||||||
secondUsersDn,
|
secondUsersDn,
|
||||||
|
@ -242,11 +197,6 @@ describe("User Fed LDAP tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Delete an LDAP provider from card view using the card's menu", () => {
|
it("Delete an LDAP provider from card view using the card's menu", () => {
|
||||||
|
|
||||||
cy.visit("");
|
|
||||||
loginPage.logIn();
|
|
||||||
sidebarPage.goToUserFederation();
|
|
||||||
|
|
||||||
cy.get('[data-testid="my-ldap-2-dropdown"]').click();
|
cy.get('[data-testid="my-ldap-2-dropdown"]').click();
|
||||||
cy.get('[data-testid="card-delete"]').click();
|
cy.get('[data-testid="card-delete"]').click();
|
||||||
|
|
||||||
|
@ -256,14 +206,7 @@ describe("User Fed LDAP tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Delete an LDAP provider using the Settings view's Action menu", () => {
|
it("Delete an LDAP provider using the Settings view's Action menu", () => {
|
||||||
cy.visit("");
|
providersPage.clickProviderCard(firstLdapName);
|
||||||
loginPage.logIn();
|
|
||||||
sidebarPage.goToUserFederation();
|
|
||||||
|
|
||||||
cy.get('[data-testid="keycloak-card-title"]')
|
|
||||||
.contains(firstLdapName)
|
|
||||||
.click();
|
|
||||||
cy.wait(1000);
|
|
||||||
|
|
||||||
cy.get('[data-testid="action-dropdown"]').click();
|
cy.get('[data-testid="action-dropdown"]').click();
|
||||||
cy.get('[data-testid="delete-ldap-cmd"]').click();
|
cy.get('[data-testid="delete-ldap-cmd"]').click();
|
||||||
|
|
|
@ -68,10 +68,7 @@ export default class CreateLdapProviderPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required fields - these always must be filled out when testing a save, everything else can feasibly be left blank (TEST THIS)
|
// Required fields - these always must be filled out when testing a save, everything else can feasibly be left blank (TEST THIS)
|
||||||
fillLdapRequiredGeneralData(
|
fillLdapRequiredGeneralData(name: string, vendor: string) {
|
||||||
name: string,
|
|
||||||
vendor: string,
|
|
||||||
) {
|
|
||||||
if (name) {
|
if (name) {
|
||||||
cy.get(`[${this.ldapNameInput}]`).type(name);
|
cy.get(`[${this.ldapNameInput}]`).type(name);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +83,7 @@ export default class CreateLdapProviderPage {
|
||||||
connectionUrl: string,
|
connectionUrl: string,
|
||||||
bindType: string,
|
bindType: string,
|
||||||
bindDn: string,
|
bindDn: string,
|
||||||
bindCreds: string,
|
bindCreds: string
|
||||||
) {
|
) {
|
||||||
if (connectionUrl) {
|
if (connectionUrl) {
|
||||||
cy.get(`[${this.ldapConnectionUrlInput}]`).type(connectionUrl);
|
cy.get(`[${this.ldapConnectionUrlInput}]`).type(connectionUrl);
|
||||||
|
@ -135,12 +132,20 @@ export default class CreateLdapProviderPage {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clickProviderCard(cardName) {
|
||||||
|
cy.get('[data-testid="keycloak-card-title"]').contains(cardName).click();
|
||||||
|
cy.wait(1000);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
disableEnabledSwitch() {
|
disableEnabledSwitch() {
|
||||||
cy.get(this.ldapEnabledInput).uncheck({ force: true });
|
cy.get(this.ldapEnabledInput).uncheck({ force: true });
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
enableEnabledSwitch() {
|
enableEnabledSwitch() {
|
||||||
cy.get(this.ldapEnabledInput).check({ force: true });
|
cy.get(this.ldapEnabledInput).check({ force: true });
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
|
|
Loading…
Reference in a new issue