Configure Cypress to use the correct types (#1168)

This commit is contained in:
Jon Koops 2021-09-17 15:23:34 +02:00 committed by GitHub
parent 0160738ec0
commit 775885c56b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 381 additions and 310 deletions

View file

@ -23,7 +23,7 @@ describe("Events tests", () => {
it("Check search dropdown display", () => { it("Check search dropdown display", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-realm-events-tab").click(); cy.findByTestId("rs-realm-events-tab").click();
realmSettingsPage realmSettingsPage
.toggleSwitch(realmSettingsPage.enableEvents) .toggleSwitch(realmSettingsPage.enableEvents)
@ -67,20 +67,20 @@ describe("Events tests", () => {
keycloakBefore(); keycloakBefore();
loginPage.logIn(); loginPage.logIn();
sidebarPage.goToEvents(); sidebarPage.goToEvents();
cy.getId("admin-events-tab").click(); cy.findByTestId("admin-events-tab").click();
}); });
it("Check admin events search form fields display", () => { it("Check admin events search form fields display", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-realm-events-tab").click(); cy.findByTestId("rs-realm-events-tab").click();
cy.getId("rs-admin-events-tab").click(); cy.findByTestId("rs-admin-events-tab").click();
realmSettingsPage realmSettingsPage
.toggleSwitch(realmSettingsPage.enableAdminEvents) .toggleSwitch(realmSettingsPage.enableAdminEvents)
.save(realmSettingsPage.eventsAdminSave); .save(realmSettingsPage.eventsAdminSave);
sidebarPage.goToEvents(); sidebarPage.goToEvents();
cy.getId("admin-events-tab").click(); cy.findByTestId("admin-events-tab").click();
sidebarPage.waitForPageLoad(); sidebarPage.waitForPageLoad();
adminEventsTab.shouldHaveFormFields(); adminEventsTab.shouldHaveFormFields();
}); });
@ -91,7 +91,7 @@ describe("Events tests", () => {
it("Check admin events search and removal work", () => { it("Check admin events search and removal work", () => {
sidebarPage.goToEvents(); sidebarPage.goToEvents();
cy.getId("admin-events-tab").click(); cy.findByTestId("admin-events-tab").click();
adminEventsTab.shouldDoAdminEventsSearchAndRemoveChips(); adminEventsTab.shouldDoAdminEventsSearchAndRemoveChips();
}); });
@ -109,7 +109,7 @@ describe("Events tests", () => {
keycloakBefore(); keycloakBefore();
loginPage.logIn(); loginPage.logIn();
sidebarPage.goToEvents(); sidebarPage.goToEvents();
cy.getId("admin-events-tab").click(); cy.findByTestId("admin-events-tab").click();
}); });
it("Check auth dialog opens and is not empty", () => { it("Check auth dialog opens and is not empty", () => {

View file

@ -33,8 +33,8 @@ describe("Realm settings", () => {
const goToKeys = () => { const goToKeys = () => {
const keysUrl = `/auth/admin/realms/${realmName}/keys`; const keysUrl = `/auth/admin/realms/${realmName}/keys`;
cy.intercept(keysUrl).as("keysFetch"); cy.intercept(keysUrl).as("keysFetch");
cy.getId("rs-keys-tab").click(); cy.findByTestId("rs-keys-tab").click();
cy.getId("rs-keys-list-tab").click(); cy.findByTestId("rs-keys-list-tab").click();
cy.wait(["@keysFetch"]); cy.wait(["@keysFetch"]);
return this; return this;
@ -44,27 +44,33 @@ describe("Realm settings", () => {
const keysUrl = `/auth/admin/realms/${realmName}/keys`; const keysUrl = `/auth/admin/realms/${realmName}/keys`;
cy.intercept(keysUrl).as("keysFetch"); cy.intercept(keysUrl).as("keysFetch");
cy.getId("rs-keys-tab").click(); cy.findByTestId("rs-keys-tab").click();
cy.getId("rs-providers-tab").click(); cy.findByTestId("rs-providers-tab").click();
cy.getId("provider-name-link").contains("test_aes-generated").click(); cy.findAllByTestId("provider-name-link")
.contains("test_aes-generated")
.click();
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-keys-tab").click(); cy.findByTestId("rs-keys-tab").click();
cy.getId("rs-providers-tab").click(); cy.findByTestId("rs-providers-tab").click();
cy.getId("provider-name-link").contains("test_hmac-generated").click(); cy.findAllByTestId("provider-name-link")
.contains("test_hmac-generated")
.click();
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-keys-tab").click(); cy.findByTestId("rs-keys-tab").click();
cy.getId("rs-providers-tab").click(); cy.findByTestId("rs-providers-tab").click();
cy.getId("provider-name-link").contains("test_rsa").click(); cy.findAllByTestId("provider-name-link").contains("test_rsa").click();
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-keys-tab").click(); cy.findByTestId("rs-keys-tab").click();
cy.getId("rs-providers-tab").click(); cy.findByTestId("rs-providers-tab").click();
cy.getId("provider-name-link").contains("test_rsa-generated").click(); cy.findAllByTestId("provider-name-link")
.contains("test_rsa-generated")
.click();
cy.wait(["@keysFetch"]); cy.wait(["@keysFetch"]);
@ -74,14 +80,14 @@ describe("Realm settings", () => {
/*const deleteProvider = (providerName: string) => { /*const deleteProvider = (providerName: string) => {
const url = `/auth/admin/realms/${realmName}/users/*`; const url = `/auth/admin/realms/${realmName}/users/*`;
cy.intercept(url).as("reload"); cy.intercept(url).as("reload");
cy.getId("provider-name") cy.findByTestId("provider-name")
.contains(providerName) .contains(providerName)
.parentsUntil(".pf-c-data-list__item-row") .parentsUntil(".pf-c-data-list__item-row")
.find(".pf-c-dropdown__toggle") .find(".pf-c-dropdown__toggle")
.click() .click()
.getId(realmSettingsPage.deleteAction) .findByTestId(realmSettingsPage.deleteAction)
.click(); .click();
cy.getId(realmSettingsPage.modalConfirm).click(); cy.findByTestId(realmSettingsPage.modalConfirm).click();
cy.wait(["@reload"]); cy.wait(["@reload"]);
return this; return this;
@ -113,7 +119,7 @@ describe("Realm settings", () => {
it("Go to login tab", () => { it("Go to login tab", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-login-tab").click(); cy.findByTestId("rs-login-tab").click();
realmSettingsPage.toggleSwitch(realmSettingsPage.userRegSwitch); realmSettingsPage.toggleSwitch(realmSettingsPage.userRegSwitch);
realmSettingsPage.toggleSwitch(realmSettingsPage.forgotPwdSwitch); realmSettingsPage.toggleSwitch(realmSettingsPage.forgotPwdSwitch);
realmSettingsPage.toggleSwitch(realmSettingsPage.rememberMeSwitch); realmSettingsPage.toggleSwitch(realmSettingsPage.rememberMeSwitch);
@ -121,7 +127,7 @@ describe("Realm settings", () => {
it("Go to email tab", () => { it("Go to email tab", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-email-tab").click(); cy.findByTestId("rs-email-tab").click();
cy.wait(1000); cy.wait(1000);
@ -133,13 +139,13 @@ describe("Realm settings", () => {
realmSettingsPage.save(realmSettingsPage.emailSaveBtn); realmSettingsPage.save(realmSettingsPage.emailSaveBtn);
realmSettingsPage.fillHostField("localhost"); realmSettingsPage.fillHostField("localhost");
cy.getId(realmSettingsPage.testConnectionButton).click(); cy.findByTestId(realmSettingsPage.testConnectionButton).click();
realmSettingsPage.fillEmailField( realmSettingsPage.fillEmailField(
"example" + (Math.random() + 1).toString(36).substring(7) + "@example.com" "example" + (Math.random() + 1).toString(36).substring(7) + "@example.com"
); );
cy.getId(realmSettingsPage.modalTestConnectionButton).click(); cy.findByTestId(realmSettingsPage.modalTestConnectionButton).click();
masthead.checkNotificationMessage("Error! Failed to send email."); masthead.checkNotificationMessage("Error! Failed to send email.");
}); });
@ -148,7 +154,7 @@ describe("Realm settings", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.intercept(`/auth/admin/realms/${realmName}/keys`).as("load"); cy.intercept(`/auth/admin/realms/${realmName}/keys`).as("load");
cy.getId("rs-themes-tab").click(); cy.findByTestId("rs-themes-tab").click();
cy.wait(["@load"]); cy.wait(["@load"]);
realmSettingsPage.selectLoginThemeType("keycloak"); realmSettingsPage.selectLoginThemeType("keycloak");
@ -165,7 +171,7 @@ describe("Realm settings", () => {
it("Enable user events", () => { it("Enable user events", () => {
cy.intercept("GET", `/auth/admin/realms/${realmName}/keys`).as("load"); cy.intercept("GET", `/auth/admin/realms/${realmName}/keys`).as("load");
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-realm-events-tab").click(); cy.findByTestId("rs-realm-events-tab").click();
cy.wait(["@load"]); cy.wait(["@load"]);
realmSettingsPage realmSettingsPage
@ -202,37 +208,37 @@ describe("Realm settings", () => {
it("Go to keys tab", () => { it("Go to keys tab", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-keys-tab").click(); cy.findByTestId("rs-keys-tab").click();
}); });
it("add Providers", () => { it("add Providers", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-keys-tab").click(); cy.findByTestId("rs-keys-tab").click();
cy.getId("rs-providers-tab").click(); cy.findByTestId("rs-providers-tab").click();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();
cy.getId("option-aes-generated").click(); cy.findByTestId("option-aes-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_aes-generated"); realmSettingsPage.enterConsoleDisplayName("test_aes-generated");
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();
cy.getId("option-ecdsa-generated").click(); cy.findByTestId("option-ecdsa-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_ecdsa-generated"); realmSettingsPage.enterConsoleDisplayName("test_ecdsa-generated");
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();
cy.getId("option-hmac-generated").click(); cy.findByTestId("option-hmac-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_hmac-generated"); realmSettingsPage.enterConsoleDisplayName("test_hmac-generated");
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();
cy.getId("option-rsa-generated").click(); cy.findByTestId("option-rsa-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_rsa-generated"); realmSettingsPage.enterConsoleDisplayName("test_rsa-generated");
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
}); });
@ -247,8 +253,8 @@ describe("Realm settings", () => {
const url = `/auth/admin/realms/${realmName}/keys`; const url = `/auth/admin/realms/${realmName}/keys`;
cy.intercept(url).as("load"); cy.intercept(url).as("load");
cy.getId("rs-keys-tab").click(); cy.findByTestId("rs-keys-tab").click();
cy.getId("rs-providers-tab").click(); cy.findByTestId("rs-providers-tab").click();
cy.wait("@load"); cy.wait("@load");
@ -267,7 +273,7 @@ describe("Realm settings", () => {
it("add locale", () => { it("add locale", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-localization-tab").click(); cy.findByTestId("rs-localization-tab").click();
addBundle(); addBundle();
@ -279,9 +285,9 @@ describe("Realm settings", () => {
it("Realm header settings", () => { it("Realm header settings", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.get("#pf-tab-securityDefences-securityDefences").click(); cy.get("#pf-tab-securityDefences-securityDefences").click();
cy.getId("headers-form-tab-save").should("be.disabled"); cy.findByTestId("headers-form-tab-save").should("be.disabled");
cy.get("#xFrameOptions").clear().type("DENY"); cy.get("#xFrameOptions").clear().type("DENY");
cy.getId("headers-form-tab-save").should("be.enabled").click(); cy.findByTestId("headers-form-tab-save").should("be.enabled").click();
masthead.checkNotificationMessage("Realm successfully updated"); masthead.checkNotificationMessage("Realm successfully updated");
}); });
@ -289,7 +295,7 @@ describe("Realm settings", () => {
it("add session data", () => { it("add session data", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-sessions-tab").click(); cy.findByTestId("rs-sessions-tab").click();
realmSettingsPage.populateSessionsPage(); realmSettingsPage.populateSessionsPage();
realmSettingsPage.save("sessions-tab-save"); realmSettingsPage.save("sessions-tab-save");
@ -301,30 +307,48 @@ describe("Realm settings", () => {
sidebarPage.goToAuthentication(); sidebarPage.goToAuthentication();
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-sessions-tab").click(); cy.findByTestId("rs-sessions-tab").click();
cy.getId(realmSettingsPage.ssoSessionIdleInput).should("have.value", 1); cy.findByTestId(realmSettingsPage.ssoSessionIdleInput).should(
cy.getId(realmSettingsPage.ssoSessionMaxInput).should("have.value", 2); "have.value",
cy.getId(realmSettingsPage.ssoSessionIdleRememberMeInput).should( 1
);
cy.findByTestId(realmSettingsPage.ssoSessionMaxInput).should(
"have.value",
2
);
cy.findByTestId(realmSettingsPage.ssoSessionIdleRememberMeInput).should(
"have.value", "have.value",
3 3
); );
cy.getId(realmSettingsPage.ssoSessionMaxRememberMeInput).should( cy.findByTestId(realmSettingsPage.ssoSessionMaxRememberMeInput).should(
"have.value", "have.value",
4 4
); );
cy.getId(realmSettingsPage.clientSessionIdleInput).should("have.value", 5); cy.findByTestId(realmSettingsPage.clientSessionIdleInput).should(
cy.getId(realmSettingsPage.clientSessionMaxInput).should("have.value", 6); "have.value",
5
);
cy.findByTestId(realmSettingsPage.clientSessionMaxInput).should(
"have.value",
6
);
cy.getId(realmSettingsPage.offlineSessionIdleInput).should("have.value", 7); cy.findByTestId(realmSettingsPage.offlineSessionIdleInput).should(
cy.getId(realmSettingsPage.offlineSessionMaxSwitch).should( "have.value",
7
);
cy.findByTestId(realmSettingsPage.offlineSessionMaxSwitch).should(
"have.value", "have.value",
"on" "on"
); );
cy.getId(realmSettingsPage.loginTimeoutInput).should("have.value", 9); cy.findByTestId(realmSettingsPage.loginTimeoutInput).should(
cy.getId(realmSettingsPage.loginActionTimeoutInput).should( "have.value",
9
);
cy.findByTestId(realmSettingsPage.loginActionTimeoutInput).should(
"have.value", "have.value",
10 10
); );
@ -333,7 +357,7 @@ describe("Realm settings", () => {
it("add token data", () => { it("add token data", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-tokens-tab").click(); cy.findByTestId("rs-tokens-tab").click();
realmSettingsPage.populateTokensPage(); realmSettingsPage.populateTokensPage();
realmSettingsPage.save("tokens-tab-save"); realmSettingsPage.save("tokens-tab-save");
@ -344,34 +368,46 @@ describe("Realm settings", () => {
it("check that token data was saved", () => { it("check that token data was saved", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.getId("rs-tokens-tab").click(); cy.findByTestId("rs-tokens-tab").click();
cy.getId(realmSettingsPage.accessTokenLifespanInput).should( cy.findByTestId(realmSettingsPage.accessTokenLifespanInput).should(
"have.value", "have.value",
1 1
); );
cy.getId(realmSettingsPage.accessTokenLifespanImplicitInput).should( cy.findByTestId(realmSettingsPage.accessTokenLifespanImplicitInput).should(
"have.value", "have.value",
2 2
); );
cy.getId(realmSettingsPage.clientLoginTimeoutInput).should("have.value", 3); cy.findByTestId(realmSettingsPage.clientLoginTimeoutInput).should(
cy.getId(realmSettingsPage.userInitiatedActionLifespanInput).should( "have.value",
3
);
cy.findByTestId(realmSettingsPage.userInitiatedActionLifespanInput).should(
"have.value", "have.value",
4 4
); );
cy.getId(realmSettingsPage.defaultAdminInitatedInput).should( cy.findByTestId(realmSettingsPage.defaultAdminInitatedInput).should(
"have.value", "have.value",
5 5
); );
cy.getId(realmSettingsPage.emailVerificationInput).should("have.value", 6); cy.findByTestId(realmSettingsPage.emailVerificationInput).should(
"have.value",
6
);
cy.getId(realmSettingsPage.idpEmailVerificationInput).should( cy.findByTestId(realmSettingsPage.idpEmailVerificationInput).should(
"have.value", "have.value",
7 7
); );
cy.getId(realmSettingsPage.forgotPasswordInput).should("have.value", 8); cy.findByTestId(realmSettingsPage.forgotPasswordInput).should(
"have.value",
8
);
cy.getId(realmSettingsPage.executeActionsInput).should("have.value", 9); cy.findByTestId(realmSettingsPage.executeActionsInput).should(
"have.value",
9
);
}); });
}); });

View file

@ -91,7 +91,7 @@ describe("Users test", () => {
console.log(groupsList); console.log(groupsList);
groupsListCopy.forEach((element) => { groupsListCopy.forEach((element) => {
cy.getId(`${element}-check`).click(); cy.findByTestId(`${element}-check`).click();
}); });
createUserPage.joinGroups(); createUserPage.joinGroups();
@ -127,7 +127,7 @@ describe("Users test", () => {
const groupsListCopy = groupsList.slice(1, 2); const groupsListCopy = groupsList.slice(1, 2);
groupsListCopy.forEach((element) => { groupsListCopy.forEach((element) => {
cy.getId(`${element}-check`).click(); cy.findByTestId(`${element}-check`).click();
}); });
userGroupsPage.joinGroups(); userGroupsPage.joinGroups();
@ -139,7 +139,7 @@ describe("Users test", () => {
// Go to user groups // Go to user groups
userGroupsPage.goToGroupsTab(); userGroupsPage.goToGroupsTab();
cy.contains("Leave").click(); cy.contains("Leave").click();
cy.getId("modalConfirm").click(); cy.findByTestId("modalConfirm").click();
}); });
it("Go to user consents test", () => { it("Go to user consents test", () => {
@ -147,8 +147,8 @@ describe("Users test", () => {
listingPage.goToItemDetails(itemId); listingPage.goToItemDetails(itemId);
cy.getId("user-consents-tab").click(); cy.findByTestId("user-consents-tab").click();
cy.getId("empty-state").contains("No consents"); cy.findByTestId("empty-state").contains("No consents");
}); });
it("Delete user test", () => { it("Delete user test", () => {

View file

@ -1,4 +1,3 @@
/// <reference types="cypress" />
// *********************************************************** // ***********************************************************
// This example plugins/index.js can be used to load plugins // This example plugins/index.js can be used to load plugins
// //
@ -12,11 +11,10 @@
// This function is called when a project is opened or re-opened (e.g. due to // This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing) // the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
module.exports = (on, config) => { const configurePlugins: Cypress.PluginConfig = (on, config) => {
// `on` is used to hook into various events Cypress emits // `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config // `config` is the resolved Cypress config
}; };
export default configurePlugins;

View file

@ -24,6 +24,4 @@
// -- This will overwrite an existing command -- // -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.add("getId", (selector, ...args) => { import "@testing-library/cypress/add-commands";
return cy.get(`[data-testid="${selector}"]`, ...args);
});

View file

@ -2,7 +2,7 @@ export default class ListingPage {
private actionMenu = "action-dropdown"; private actionMenu = "action-dropdown";
clickAction(action: string) { clickAction(action: string) {
cy.getId(this.actionMenu).click().getId(action).click(); cy.findByTestId(this.actionMenu).click().findByTestId(action).click();
return this; return this;
} }
} }

View file

@ -5,7 +5,7 @@ export default class RealmSelector {
private realmContextSelector = ".keycloak__realm_selector__context_selector"; private realmContextSelector = ".keycloak__realm_selector__context_selector";
shouldContainAll(realmsList: string[]) { shouldContainAll(realmsList: string[]) {
cy.getId(this.realmSelector) cy.findByTestId(this.realmSelector)
.scrollIntoView() .scrollIntoView()
.get("ul") .get("ul")
.should((realms) => { .should((realms) => {
@ -19,7 +19,7 @@ export default class RealmSelector {
} }
openRealmContextSelector() { openRealmContextSelector() {
cy.getId(this.realmSelector).scrollIntoView(); cy.findByTestId(this.realmSelector).scrollIntoView();
cy.get(this.realmContextSelector).click(); cy.get(this.realmContextSelector).click();
return this; return this;

View file

@ -17,20 +17,20 @@ export default class SidebarPage {
private userFederationBtn = "#nav-item-user-federation"; private userFederationBtn = "#nav-item-user-federation";
getCurrentRealm() { getCurrentRealm() {
return cy.getId(this.realmsDrpDwn).scrollIntoView().invoke("text"); return cy.findByTestId(this.realmsDrpDwn).scrollIntoView().invoke("text");
} }
goToRealm(realmName: string) { goToRealm(realmName: string) {
cy.getId(this.realmsDrpDwn).scrollIntoView().click(); cy.findByTestId(this.realmsDrpDwn).scrollIntoView().click();
cy.getId(this.realmsList).get("ul").contains(realmName).click(); cy.findByTestId(this.realmsList).get("ul").contains(realmName).click();
return this; return this;
} }
goToCreateRealm() { goToCreateRealm() {
cy.getId(this.realmsDrpDwn).scrollIntoView(); cy.findByTestId(this.realmsDrpDwn).scrollIntoView();
cy.getId(this.realmsDrpDwn).click(); cy.findByTestId(this.realmsDrpDwn).click();
cy.getId(this.createRealmBtn).click(); cy.findByTestId(this.createRealmBtn).click();
return this; return this;
} }

View file

@ -2,7 +2,7 @@ export default class GroupModal {
private openPartialImport = "openPartialImportModal"; private openPartialImport = "openPartialImportModal";
open() { open() {
cy.getId(this.openPartialImport).click(); cy.findByTestId(this.openPartialImport).click();
return this; return this;
} }
@ -20,43 +20,43 @@ export default class GroupModal {
}; };
importButton() { importButton() {
return cy.getId("import-button"); return cy.findByTestId("import-button");
} }
cancelButton() { cancelButton() {
return cy.getId("cancel-button"); return cy.findByTestId("cancel-button");
} }
groupsCheckbox() { groupsCheckbox() {
return cy.getId("groups-checkbox"); return cy.findByTestId("groups-checkbox");
} }
usersCheckbox() { usersCheckbox() {
return cy.getId("users-checkbox"); return cy.findByTestId("users-checkbox");
} }
userCount() { userCount() {
return cy.getId("users-count"); return cy.findByTestId("users-count");
} }
clientCount() { clientCount() {
return cy.getId("clients-count"); return cy.findByTestId("clients-count");
} }
groupCount() { groupCount() {
return cy.getId("groups-count"); return cy.findByTestId("groups-count");
} }
idpCount() { idpCount() {
return cy.getId("identityProviders-count"); return cy.findByTestId("identityProviders-count");
} }
realmRolesCount() { realmRolesCount() {
return cy.getId("realmRoles-count"); return cy.findByTestId("realmRoles-count");
} }
clientRolesCount() { clientRolesCount() {
return cy.getId("clientRoles-count"); return cy.findByTestId("clientRoles-count");
} }
realmSelector() { realmSelector() {
@ -65,6 +65,6 @@ export default class GroupModal {
selectRealm(realm: string) { selectRealm(realm: string) {
this.realmSelector().click(); this.realmSelector().click();
cy.getId(realm + "-select-option").click(); cy.findByTestId(realm + "-select-option").click();
} }
} }

View file

@ -2,7 +2,7 @@ export default class RealmSettings {
private actionDropdown = "action-dropdown"; private actionDropdown = "action-dropdown";
clickActionMenu() { clickActionMenu() {
cy.getId(this.actionDropdown).click(); cy.findByTestId(this.actionDropdown).click();
return this; return this;
} }
} }

View file

@ -16,22 +16,22 @@ export default class RoleMappingTab {
} }
goToScopeTab() { goToScopeTab() {
cy.getId(this.scopeTab).click(); cy.findByTestId(this.scopeTab).click();
return this; return this;
} }
clickAssignRole(notEmpty = true) { clickAssignRole(notEmpty = true) {
cy.getId(notEmpty ? this.assignEmptyRole : this.assignRole).click(); cy.findByTestId(notEmpty ? this.assignEmptyRole : this.assignRole).click();
return this; return this;
} }
clickAssign() { clickAssign() {
cy.getId(this.assign).click(); cy.findByTestId(this.assign).click();
return this; return this;
} }
clickUnAssign() { clickUnAssign() {
cy.getId(this.unAssign).click(); cy.findByTestId(this.unAssign).click();
return this; return this;
} }
@ -52,7 +52,7 @@ export default class RoleMappingTab {
checkRoles(roleNames: string[]) { checkRoles(roleNames: string[]) {
if (roleNames.length) { if (roleNames.length) {
cy.getId(this.assignedRolesTable) cy.findByTestId(this.assignedRolesTable)
.get(this.namesColumn) .get(this.namesColumn)
.should((roles) => { .should((roles) => {
for (let index = 0; index < roleNames.length; index++) { for (let index = 0; index < roleNames.length; index++) {
@ -61,7 +61,7 @@ export default class RoleMappingTab {
} }
}); });
} else { } else {
cy.getId(this.assignedRolesTable).should("not.exist"); cy.findByTestId(this.assignedRolesTable).should("not.exist");
} }
return this; return this;
} }

View file

@ -5,11 +5,11 @@ export default class DuplicateFlowModal {
fill(name?: string, description?: string) { fill(name?: string, description?: string) {
if (name) { if (name) {
cy.getId(this.aliasInput).type(name); cy.findByTestId(this.aliasInput).type(name);
if (description) cy.get(this.descriptionInput).type(description); if (description) cy.get(this.descriptionInput).type(description);
} }
cy.getId(this.confirmButton).click(); cy.findByTestId(this.confirmButton).click();
return this; return this;
} }
} }

View file

@ -7,13 +7,13 @@ export default class FlowDetails {
} }
private getExecution(name: string) { private getExecution(name: string) {
return cy.getId(name); return cy.findByTestId(name);
} }
moveRowTo(from: string, to: string) { moveRowTo(from: string, to: string) {
cy.getId(from).trigger("dragstart").trigger("dragleave"); cy.findByTestId(from).trigger("dragstart").trigger("dragleave");
cy.getId(to) cy.findByTestId(to)
.trigger("dragenter") .trigger("dragenter")
.trigger("dragover") .trigger("dragover")
.trigger("drop") .trigger("drop")
@ -38,15 +38,18 @@ export default class FlowDetails {
} }
private clickEditDropdownForFlow(subFlowName: string, option: string) { private clickEditDropdownForFlow(subFlowName: string, option: string) {
cy.getId(`${subFlowName}-edit-dropdown`).click().contains(option).click(); cy.findByTestId(`${subFlowName}-edit-dropdown`)
.click()
.contains(option)
.click();
} }
addExecution(subFlowName: string, executionTestId: string) { addExecution(subFlowName: string, executionTestId: string) {
this.clickEditDropdownForFlow(subFlowName, "Add step"); this.clickEditDropdownForFlow(subFlowName, "Add step");
cy.get(".pf-c-pagination").should("exist"); cy.get(".pf-c-pagination").should("exist");
cy.getId(executionTestId).click(); cy.findByTestId(executionTestId).click();
cy.getId("modal-add").click(); cy.findByTestId("modal-add").click();
return this; return this;
} }
@ -55,8 +58,8 @@ export default class FlowDetails {
this.clickEditDropdownForFlow(subFlowName, "Add condition"); this.clickEditDropdownForFlow(subFlowName, "Add condition");
cy.get(".pf-c-pagination").should("not.exist"); cy.get(".pf-c-pagination").should("not.exist");
cy.getId(executionTestId).click(); cy.findByTestId(executionTestId).click();
cy.getId("modal-add").click(); cy.findByTestId("modal-add").click();
return this; return this;
} }

View file

@ -65,7 +65,7 @@ export default class AdvancedTab {
} }
clickRegisterNodeManually() { clickRegisterNodeManually() {
cy.getId(this.registerNodeManually).click(); cy.findByTestId(this.registerNodeManually).click();
return this; return this;
} }

View file

@ -66,7 +66,7 @@ export default class CreateClientPage {
changeSwitches(switches: string[]) { changeSwitches(switches: string[]) {
for (const uiSwitch of switches) { for (const uiSwitch of switches) {
cy.getId(uiSwitch).check({ force: true }); cy.findByTestId(uiSwitch).check({ force: true });
} }
return this; return this;
} }

View file

@ -8,17 +8,17 @@ export default class InitialAccessTokenTab {
private saveBtn = "save"; private saveBtn = "save";
goToInitialAccessTokenTab() { goToInitialAccessTokenTab() {
cy.getId(this.initialAccessTokenTab).click(); cy.findByTestId(this.initialAccessTokenTab).click();
return this; return this;
} }
shouldBeEmpty() { shouldBeEmpty() {
cy.getId(this.emptyAction).should("exist"); cy.findByTestId(this.emptyAction).should("exist");
return this; return this;
} }
shouldNotBeEmpty() { shouldNotBeEmpty() {
cy.getId(this.emptyAction).should("not.exist"); cy.findByTestId(this.emptyAction).should("not.exist");
return this; return this;
} }
@ -32,14 +32,14 @@ export default class InitialAccessTokenTab {
} }
createNewToken(expiration: number, count: number) { createNewToken(expiration: number, count: number) {
cy.getId(this.emptyAction).click(); cy.findByTestId(this.emptyAction).click();
cy.getId(this.expirationInput).type(`${expiration}`); cy.findByTestId(this.expirationInput).type(`${expiration}`);
cy.getId(this.countInput).type(`${count}`); cy.findByTestId(this.countInput).type(`${count}`);
return this; return this;
} }
save() { save() {
cy.getId(this.saveBtn).click(); cy.findByTestId(this.saveBtn).click();
return this; return this;
} }
} }

View file

@ -14,22 +14,24 @@ export default class KeysTab {
} }
checkSaveDisabled(disabled = true) { checkSaveDisabled(disabled = true) {
cy.getId(this.saveKeys).should((!disabled ? "not." : "") + "be.disabled"); cy.findByTestId(this.saveKeys).should(
(!disabled ? "not." : "") + "be.disabled"
);
return this; return this;
} }
toggleUseJwksUrl() { toggleUseJwksUrl() {
cy.getId(this.useJwksUrl).click({ force: true }); cy.findByTestId(this.useJwksUrl).click({ force: true });
return this; return this;
} }
clickGenerate() { clickGenerate() {
cy.getId(this.generate).click(); cy.findByTestId(this.generate).click();
return this; return this;
} }
clickConfirm() { clickConfirm() {
cy.getId(this.confirm).click(); cy.findByTestId(this.confirm).click();
return this; return this;
} }
@ -38,12 +40,9 @@ export default class KeysTab {
keyPassword: string, keyPassword: string,
storePassword: string storePassword: string
) { ) {
cy.getId(this.keyAlias) cy.findByTestId(this.keyAlias).type(keyAlias);
.type(keyAlias) cy.findByTestId(this.keyPassword).type(keyPassword);
.getId(this.keyPassword) cy.findByTestId(this.storePassword).type(storePassword);
.type(keyPassword)
.getId(this.storePassword)
.type(storePassword);
return this; return this;
} }
} }

View file

@ -24,7 +24,7 @@ export default class AdminEventsTab {
authValDataRow = 'tbody > tr > [data-label="Value"]'; authValDataRow = 'tbody > tr > [data-label="Value"]';
shouldHaveFormFields() { shouldHaveFormFields() {
cy.getId(this.searchAdminEventDrpDwnBtn).click(); cy.findByTestId(this.searchAdminEventDrpDwnBtn).click();
cy.get(this.searchForm).contains("Resource types"); cy.get(this.searchForm).contains("Resource types");
cy.get(this.searchForm).contains("Operation types"); cy.get(this.searchForm).contains("Operation types");
cy.get(this.searchForm).contains("Resource path"); cy.get(this.searchForm).contains("Resource path");
@ -37,16 +37,16 @@ export default class AdminEventsTab {
} }
shouldHaveSearchBtnDisabled() { shouldHaveSearchBtnDisabled() {
cy.getId(this.searchAdminEventDrpDwnBtn).click(); cy.findByTestId(this.searchAdminEventDrpDwnBtn).click();
cy.getId(this.searchEventsBtn).should("have.attr", "disabled"); cy.findByTestId(this.searchEventsBtn).should("have.attr", "disabled");
} }
shouldDoAdminEventsSearchAndRemoveChips() { shouldDoAdminEventsSearchAndRemoveChips() {
cy.getId(this.searchAdminEventDrpDwnBtn).click(); cy.findByTestId(this.searchAdminEventDrpDwnBtn).click();
cy.getId(this.resourcePathInputFld).type("events/config"); cy.findByTestId(this.resourcePathInputFld).type("events/config");
cy.intercept("/auth/admin/realms/master/admin-events*").as("eventsFetch"); cy.intercept("/auth/admin/realms/master/admin-events*").as("eventsFetch");
cy.getId(this.searchEventsBtn).click(); cy.findByTestId(this.searchEventsBtn).click();
cy.wait("@eventsFetch"); cy.wait("@eventsFetch");
cy.get("table").contains("td", "events/config").should("be.visible"); cy.get("table").contains("td", "events/config").should("be.visible");
@ -57,15 +57,15 @@ export default class AdminEventsTab {
} }
shouldHaveSearchBtnEnabled() { shouldHaveSearchBtnEnabled() {
cy.getId(this.searchAdminEventDrpDwnBtn).click(); cy.findByTestId(this.searchAdminEventDrpDwnBtn).click();
cy.getId(this.ipAddressInputFld).type("11111"); cy.findByTestId(this.ipAddressInputFld).type("11111");
cy.getId(this.searchEventsBtn).should("not.have.attr", "disabled"); cy.findByTestId(this.searchEventsBtn).should("not.have.attr", "disabled");
} }
shouldDoNoResultsSearch() { shouldDoNoResultsSearch() {
cy.getId(this.searchAdminEventDrpDwnBtn).click(); cy.findByTestId(this.searchAdminEventDrpDwnBtn).click();
cy.getId(this.resourcePathInputFld).type("events/test"); cy.findByTestId(this.resourcePathInputFld).type("events/test");
cy.getId(this.searchEventsBtn).click(); cy.findByTestId(this.searchEventsBtn).click();
cy.get(this.adminEventsTabTitle).contains("No events logged"); cy.get(this.adminEventsTabTitle).contains("No events logged");
} }

View file

@ -19,7 +19,7 @@ export default class UserEventsTab {
} }
shouldHaveFormFields() { shouldHaveFormFields() {
cy.getId(this.searchEventDrpDwnBtn).click(); cy.findByTestId(this.searchEventDrpDwnBtn).click();
cy.get(this.searchForm).contains("User ID"); cy.get(this.searchForm).contains("User ID");
cy.get(this.searchForm).contains("Event type"); cy.get(this.searchForm).contains("Event type");
cy.get(this.searchForm).contains("Client"); cy.get(this.searchForm).contains("Client");
@ -29,22 +29,22 @@ export default class UserEventsTab {
} }
shouldHaveEventTypeOptions() { shouldHaveEventTypeOptions() {
cy.getId(this.searchEventDrpDwnBtn).click(); cy.findByTestId(this.searchEventDrpDwnBtn).click();
cy.get(this.eventTypeList).should("exist"); cy.get(this.eventTypeList).should("exist");
} }
shouldHaveSearchBtnDisabled() { shouldHaveSearchBtnDisabled() {
cy.getId(this.searchEventDrpDwnBtn).click(); cy.findByTestId(this.searchEventDrpDwnBtn).click();
cy.getId(this.searchEventsBtn).should("have.attr", "disabled"); cy.findByTestId(this.searchEventsBtn).should("have.attr", "disabled");
} }
shouldDoSearchAndRemoveChips() { shouldDoSearchAndRemoveChips() {
cy.getId(this.searchEventDrpDwnBtn).click(); cy.findByTestId(this.searchEventDrpDwnBtn).click();
cy.get(this.eventTypeInputFld).type("LOGIN"); cy.get(this.eventTypeInputFld).type("LOGIN");
cy.get(this.eventTypeOption).contains("LOGIN").click(); cy.get(this.eventTypeOption).contains("LOGIN").click();
cy.intercept("/auth/admin/realms/master/events*").as("eventsFetch"); cy.intercept("/auth/admin/realms/master/events*").as("eventsFetch");
cy.getId(this.searchEventsBtn).click(); cy.findByTestId(this.searchEventsBtn).click();
cy.wait("@eventsFetch"); cy.wait("@eventsFetch");
cy.get("table").contains("td", "LOGIN"); cy.get("table").contains("td", "LOGIN");
@ -59,15 +59,15 @@ export default class UserEventsTab {
} }
shouldHaveSearchBtnEnabled() { shouldHaveSearchBtnEnabled() {
cy.getId(this.searchEventDrpDwnBtn).click(); cy.findByTestId(this.searchEventDrpDwnBtn).click();
cy.getId(this.userIdInputFld).type("11111"); cy.findByTestId(this.userIdInputFld).type("11111");
cy.getId(this.searchEventsBtn).should("not.have.attr", "disabled"); cy.findByTestId(this.searchEventsBtn).should("not.have.attr", "disabled");
} }
shouldDoNoResultsSearch() { shouldDoNoResultsSearch() {
cy.getId(this.searchEventDrpDwnBtn).click(); cy.findByTestId(this.searchEventDrpDwnBtn).click();
cy.getId(this.userIdInputFld).type("test"); cy.findByTestId(this.userIdInputFld).type("test");
cy.getId(this.searchEventsBtn).click(); cy.findByTestId(this.searchEventsBtn).click();
cy.get(this.userEventsTabTitle).contains("No events logged"); cy.get(this.userEventsTabTitle).contains("No events logged");
} }
} }

View file

@ -26,7 +26,7 @@ export default class GroupDetailPage {
} }
clickMembersTab() { clickMembersTab() {
cy.getId(this.memberTab).click(); cy.findByTestId(this.memberTab).click();
return this; return this;
} }
@ -61,22 +61,22 @@ export default class GroupDetailPage {
} }
clickAdd() { clickAdd() {
cy.getId(this.addMember).click(); cy.findByTestId(this.addMember).click();
return this; return this;
} }
clickIncludeSubGroups() { clickIncludeSubGroups() {
cy.getId(this.includeSubGroupsCheck).click(); cy.findByTestId(this.includeSubGroupsCheck).click();
return this; return this;
} }
clickAttributesTab() { clickAttributesTab() {
cy.getId(this.attributesTab).click(); cy.findByTestId(this.attributesTab).click();
return this; return this;
} }
clickAddMembers() { clickAddMembers() {
cy.getId(this.addMembers).click(); cy.findByTestId(this.addMembers).click();
return this; return this;
} }

View file

@ -5,7 +5,7 @@ export default class GroupModal {
open(name?: string) { open(name?: string) {
if (name) { if (name) {
cy.getId(name).click(); cy.findByTestId(name).click();
} else { } else {
cy.get("button").contains("Create").click(); cy.get("button").contains("Create").click();
} }
@ -13,18 +13,18 @@ export default class GroupModal {
} }
fillGroupForm(name = "") { fillGroupForm(name = "") {
cy.getId(this.nameInput).clear().type(name); cy.findByTestId(this.nameInput).clear().type(name);
return this; return this;
} }
clickCreate() { clickCreate() {
cy.getId(this.createButton).click(); cy.findByTestId(this.createButton).click();
return this; return this;
} }
clickRename() { clickRename() {
cy.getId(this.renameButton).click(); cy.findByTestId(this.renameButton).click();
return this; return this;
} }
} }

View file

@ -3,7 +3,7 @@ export default class MoveGroupModal {
private title = ".pf-c-modal-box__title"; private title = ".pf-c-modal-box__title";
clickRow(groupName: string) { clickRow(groupName: string) {
cy.getId(groupName).click(); cy.findByTestId(groupName).click();
return this; return this;
} }
@ -18,7 +18,7 @@ export default class MoveGroupModal {
} }
clickMove() { clickMove() {
cy.getId(this.moveButton).click(); cy.findByTestId(this.moveButton).click();
return this; return this;
} }
} }

View file

@ -3,12 +3,12 @@ export class SearchGroupPage {
private searchButton = "search-button"; private searchButton = "search-button";
searchGroup(search: string) { searchGroup(search: string) {
cy.getId(this.searchField).type(search); cy.findByTestId(this.searchField).type(search);
return this; return this;
} }
clickSearchButton() { clickSearchButton() {
cy.getId(this.searchButton).click(); cy.findByTestId(this.searchButton).click();
return this; return this;
} }

View file

@ -18,12 +18,12 @@ export default class AddMapperPage {
private addAssociatedRolesModalButton = "add-associated-roles-button"; private addAssociatedRolesModalButton = "add-associated-roles-button";
goToMappersTab() { goToMappersTab() {
cy.getId(this.mappersTab).click(); cy.findByTestId(this.mappersTab).click();
return this; return this;
} }
clickAdd() { clickAdd() {
cy.getId(this.noMappersAddMapperButton).click(); cy.findByTestId(this.noMappersAddMapperButton).click();
return this; return this;
} }
@ -33,12 +33,12 @@ export default class AddMapperPage {
} }
saveNewMapper() { saveNewMapper() {
cy.getId(this.newMapperSaveButton).click(); cy.findByTestId(this.newMapperSaveButton).click();
return this; return this;
} }
toggleSwitch(switchName: string) { toggleSwitch(switchName: string) {
cy.getId(switchName).click({ force: true }); cy.findByTestId(switchName).click({ force: true });
return this; return this;
} }
@ -50,17 +50,19 @@ export default class AddMapperPage {
cy.get(this.syncmodeSelectToggle).click(); cy.get(this.syncmodeSelectToggle).click();
cy.getId("legacy").click(); cy.findByTestId("legacy").click();
cy.get(this.idpMapperSelectToggle).click(); cy.get(this.idpMapperSelectToggle).click();
cy.getId(this.idpMapperSelect).contains("Attribute Importer").click(); cy.findByTestId(this.idpMapperSelect)
.contains("Attribute Importer")
.click();
cy.getId(this.userSessionAttribute).clear(); cy.findByTestId(this.userSessionAttribute).clear();
cy.getId(this.userSessionAttribute).type("user session attribute"); cy.findByTestId(this.userSessionAttribute).type("user session attribute");
cy.getId(this.userSessionAttributeValue).clear(); cy.findByTestId(this.userSessionAttributeValue).clear();
cy.getId(this.userSessionAttributeValue).type( cy.findByTestId(this.userSessionAttributeValue).type(
"user session attribute value" "user session attribute value"
); );
@ -73,9 +75,9 @@ export default class AddMapperPage {
cy.get(this.radio).eq(0).check(); cy.get(this.radio).eq(0).check();
cy.getId(this.addAssociatedRolesModalButton).contains("Add").click(); cy.findByTestId(this.addAssociatedRolesModalButton).contains("Add").click();
cy.getId(this.mapperRoleInput).should("have.value", "admin"); cy.findByTestId(this.mapperRoleInput).should("have.value", "admin");
return this; return this;
} }
@ -87,11 +89,11 @@ export default class AddMapperPage {
cy.get(this.syncmodeSelectToggle).click(); cy.get(this.syncmodeSelectToggle).click();
cy.getId("inherit").click(); cy.findByTestId("inherit").click();
cy.get(this.idpMapperSelectToggle).click(); cy.get(this.idpMapperSelectToggle).click();
cy.getId(this.idpMapperSelect) cy.findByTestId(this.idpMapperSelect)
.contains("Hardcoded User Session Attribute") .contains("Hardcoded User Session Attribute")
.click(); .click();
@ -103,7 +105,7 @@ export default class AddMapperPage {
this.toggleSwitch(this.regexAttributeValuesSwitch); this.toggleSwitch(this.regexAttributeValuesSwitch);
cy.getId(this.selectRoleButton).click(); cy.findByTestId(this.selectRoleButton).click();
this.addRoleToMapperForm(); this.addRoleToMapperForm();

View file

@ -11,12 +11,12 @@ export default class CreateProviderPage {
private ssoServiceUrl = "sso-service-url"; private ssoServiceUrl = "sso-service-url";
checkVisible(name: string) { checkVisible(name: string) {
cy.getId(`${name}-card`).should("exist"); cy.findByTestId(`${name}-card`).should("exist");
return this; return this;
} }
clickCard(name: string) { clickCard(name: string) {
cy.getId(`${name}-card`).click(); cy.findByTestId(`${name}-card`).click();
return this; return this;
} }
@ -37,12 +37,14 @@ export default class CreateProviderPage {
} }
checkAddButtonDisabled(disabled = true) { checkAddButtonDisabled(disabled = true) {
cy.getId(this.addButton).should(!disabled ? "not." : "" + "be.disabled"); cy.findByTestId(this.addButton).should(
!disabled ? "not." : "" + "be.disabled"
);
return this; return this;
} }
clickAdd() { clickAdd() {
cy.getId(this.addButton).click(); cy.findByTestId(this.addButton).click();
return this; return this;
} }
@ -52,48 +54,51 @@ export default class CreateProviderPage {
} }
clickItem(item: string) { clickItem(item: string) {
cy.getId(item).click(); cy.findByTestId(item).click();
return this; return this;
} }
fill(id: string, secret = "") { fill(id: string, secret = "") {
cy.getId(this.clientIdField).clear(); cy.findByTestId(this.clientIdField).clear();
if (id) { if (id) {
cy.getId(this.clientIdField).type(id); cy.findByTestId(this.clientIdField).type(id);
} }
if (secret) { if (secret) {
cy.getId(this.clientSecretField).type(secret); cy.findByTestId(this.clientSecretField).type(secret);
} }
return this; return this;
} }
fillDiscoveryUrl(value: string) { fillDiscoveryUrl(value: string) {
cy.getId(this.discoveryEndpoint).type("x"); cy.findByTestId(this.discoveryEndpoint).type("x");
cy.getId(this.discoveryEndpoint).clear().type(value).blur(); cy.findByTestId(this.discoveryEndpoint).clear().type(value).blur();
return this; return this;
} }
fillSsoServiceUrl(value: string) { fillSsoServiceUrl(value: string) {
cy.getId(this.ssoServiceUrl).type("x"); cy.findByTestId(this.ssoServiceUrl).type("x");
cy.getId(this.ssoServiceUrl).clear().type(value).blur(); cy.findByTestId(this.ssoServiceUrl).clear().type(value).blur();
return this; return this;
} }
shouldBeSuccessful() { shouldBeSuccessful() {
cy.getId(this.discoveryEndpoint).should("have.class", "pf-m-success"); cy.findByTestId(this.discoveryEndpoint).should(
"have.class",
"pf-m-success"
);
return this; return this;
} }
shouldHaveAuthorizationUrl(value: string) { shouldHaveAuthorizationUrl(value: string) {
cy.getId(this.authorizationUrl).should("have.value", value); cy.findByTestId(this.authorizationUrl).should("have.value", value);
return this; return this;
} }
toggleEntityDescriptor() { toggleEntityDescriptor() {
cy.getId(this.useEntityDescriptorSwitch).click({ force: true }); cy.findByTestId(this.useEntityDescriptorSwitch).click({ force: true });
return this; return this;
} }
} }

View file

@ -5,14 +5,14 @@ export default class OrderDialog {
private list = "manageOrderDataList"; private list = "manageOrderDataList";
openDialog() { openDialog() {
cy.getId(this.manageDisplayOrder).click({ force: true }); cy.findByTestId(this.manageDisplayOrder).click({ force: true });
return this; return this;
} }
moveRowTo(from: string, to: string) { moveRowTo(from: string, to: string) {
cy.getId(from).trigger("dragstart").trigger("dragleave"); cy.findByTestId(from).trigger("dragstart").trigger("dragleave");
cy.getId(to) cy.findByTestId(to)
.trigger("dragenter") .trigger("dragenter")
.trigger("dragover") .trigger("dragover")
.trigger("drop") .trigger("drop")

View file

@ -269,7 +269,7 @@ export default class ProviderPage {
.within(() => { .within(() => {
cy.get('input[name="radioGroup"]').click(); cy.get('input[name="radioGroup"]').click();
}); });
cy.getId(this.assign).click(); cy.findByTestId(this.assign).click();
break; break;
default: default:
console.log("Invalid mapper type."); console.log("Invalid mapper type.");

View file

@ -10,21 +10,24 @@ export default class AssociatedRolesPage {
private usersPage = "users-page"; private usersPage = "users-page";
addAssociatedRealmRole() { addAssociatedRealmRole() {
cy.getId(this.actionDropdown).last().click(); cy.findByTestId(this.actionDropdown).last().click();
const load = "/auth/admin/realms/master/clients"; const load = "/auth/admin/realms/master/clients";
cy.intercept(load).as("load"); cy.intercept(load).as("load");
cy.getId(this.addRolesDropdownItem).click(); cy.findByTestId(this.addRolesDropdownItem).click();
cy.wait(["@load"]); cy.wait(["@load"]);
cy.get(this.checkbox).eq(2).check(); cy.get(this.checkbox).eq(2).check();
cy.getId(this.addAssociatedRolesModalButton).contains("Add").click(); cy.findByTestId(this.addAssociatedRolesModalButton).contains("Add").click();
cy.url().should("include", "/AssociatedRoles"); cy.url().should("include", "/AssociatedRoles");
cy.getId(this.compositeRoleBadge).should("contain.text", "Composite"); cy.findByTestId(this.compositeRoleBadge).should(
"contain.text",
"Composite"
);
cy.wait(["@load"]); cy.wait(["@load"]);
@ -32,13 +35,13 @@ export default class AssociatedRolesPage {
} }
addAssociatedClientRole() { addAssociatedClientRole() {
cy.getId(this.addRoleToolbarButton).click(); cy.findByTestId(this.addRoleToolbarButton).click();
cy.getId(this.filterTypeDropdown).click(); cy.findByTestId(this.filterTypeDropdown).click();
cy.getId(this.filterTypeDropdownItem).click(); cy.findByTestId(this.filterTypeDropdownItem).click();
cy.getId(".pf-c-spinner__tail-ball").should("not.exist"); cy.findByTestId(".pf-c-spinner__tail-ball").should("not.exist");
cy.get('[data-testid="addAssociatedRole"] td[data-label="Role name"]') cy.get('[data-testid="addAssociatedRole"] td[data-label="Role name"]')
.contains("manage-account") .contains("manage-account")
@ -47,8 +50,9 @@ export default class AssociatedRolesPage {
cy.get("input").click(); cy.get("input").click();
}); });
cy.getId(this.addAssociatedRolesModalButton).contains("Add").click(); cy.findByTestId(this.addAssociatedRolesModalButton).contains("Add").click();
cy.contains("Users in role").click().getId(this.usersPage).should("exist"); cy.contains("Users in role").click();
cy.findByTestId(this.usersPage).should("exist");
} }
} }

View file

@ -37,7 +37,7 @@ export default class CreateRealmRolePage {
//#endregion //#endregion
save() { save() {
cy.getId(this.saveBtn).click(); cy.findByTestId(this.saveBtn).click();
return this; return this;
} }

View file

@ -169,7 +169,7 @@ export default class RealmSettingsPage {
} }
fillEmailField(email: string) { fillEmailField(email: string) {
cy.getId(this.emailAddressInput).type(email); cy.findByTestId(this.emailAddressInput).type(email);
return this; return this;
} }
@ -185,22 +185,22 @@ export default class RealmSettingsPage {
} }
saveGeneral() { saveGeneral() {
cy.getId(this.generalSaveBtn).click(); cy.findByTestId(this.generalSaveBtn).click();
return this; return this;
} }
saveThemes() { saveThemes() {
cy.getId(this.themesSaveBtn).click(); cy.findByTestId(this.themesSaveBtn).click();
return this; return this;
} }
addSenderEmail(senderEmail: string) { addSenderEmail(senderEmail: string) {
cy.getId(this.fromInput).clear(); cy.findByTestId(this.fromInput).clear();
if (senderEmail) { if (senderEmail) {
cy.getId(this.fromInput).type(senderEmail); cy.findByTestId(this.fromInput).type(senderEmail);
} }
return this; return this;
@ -208,19 +208,19 @@ export default class RealmSettingsPage {
testSelectFilter() { testSelectFilter() {
cy.get(this.filterSelectMenu).first().click(); cy.get(this.filterSelectMenu).first().click();
cy.getId(this.passiveKeysOption).click(); cy.findByTestId(this.passiveKeysOption).click();
cy.get(this.filterSelectMenu).first().click(); cy.get(this.filterSelectMenu).first().click();
cy.getId(this.disabledKeysOption).click(); cy.findByTestId(this.disabledKeysOption).click();
} }
toggleSwitch(switchName: string) { toggleSwitch(switchName: string) {
cy.getId(switchName).click({ force: true }); cy.findByTestId(switchName).click({ force: true });
return this; return this;
} }
toggleCheck(switchName: string) { toggleCheck(switchName: string) {
cy.getId(switchName).click(); cy.findByTestId(switchName).click();
return this; return this;
} }
@ -228,57 +228,57 @@ export default class RealmSettingsPage {
toggleAddProviderDropdown() { toggleAddProviderDropdown() {
const keysUrl = "/auth/admin/realms/master/keys"; const keysUrl = "/auth/admin/realms/master/keys";
cy.intercept(keysUrl).as("keysFetch"); cy.intercept(keysUrl).as("keysFetch");
cy.getId(this.addProviderDropdown).click(); cy.findByTestId(this.addProviderDropdown).click();
return this; return this;
} }
addProvider() { addProvider() {
cy.getId(this.addProviderButton).click(); cy.findByTestId(this.addProviderButton).click();
return this; return this;
} }
addKeyValuePair(key: string, value: string) { addKeyValuePair(key: string, value: string) {
cy.getId(this.addBundleButton).click(); cy.findByTestId(this.addBundleButton).click();
cy.getId(this.keyInput).type(key); cy.findByTestId(this.keyInput).type(key);
cy.getId(this.valueInput).type(value); cy.findByTestId(this.valueInput).type(value);
cy.getId(this.confirmAddBundle).click(); cy.findByTestId(this.confirmAddBundle).click();
return this; return this;
} }
deleteProvider(providerName: string) { deleteProvider(providerName: string) {
cy.getId("provider-name-link") cy.findAllByTestId("provider-name-link")
.contains(providerName) .contains(providerName)
.parent() .parent()
.siblings(".pf-c-data-list__item-action") .siblings(".pf-c-data-list__item-action")
.click() .click()
.getId(this.deleteAction) .findByTestId(this.deleteAction)
.click(); .click();
cy.wait(500).getId(this.modalConfirm).click(); cy.wait(500).findByTestId(this.modalConfirm).click();
} }
enterConsoleDisplayName(name: string) { enterConsoleDisplayName(name: string) {
cy.getId(this.displayName).clear().type(name); cy.findByTestId(this.displayName).clear().type(name);
} }
save(saveBtn: string) { save(saveBtn: string) {
cy.getId(saveBtn).click(); cy.findByTestId(saveBtn).click();
return this; return this;
} }
clearEvents(type: "admin" | "user") { clearEvents(type: "admin" | "user") {
cy.getId(`clear-${type}-events`).click(); cy.findByTestId(`clear-${type}-events`).click();
return this; return this;
} }
addUserEvents(events: string[]) { addUserEvents(events: string[]) {
cy.getId("addTypes").click(); cy.findByTestId("addTypes").click();
for (const event of events) { for (const event of events) {
cy.get(this.eventTypeColumn) cy.get(this.eventTypeColumn)
.contains(event) .contains(event)
@ -314,54 +314,54 @@ export default class RealmSettingsPage {
} }
populateSessionsPage() { populateSessionsPage() {
cy.getId(this.ssoSessionIdleInput).clear().type("1"); cy.findByTestId(this.ssoSessionIdleInput).clear().type("1");
this.changeTimeUnit( this.changeTimeUnit(
"Minutes", "Minutes",
this.ssoSessionIdleSelectMenu, this.ssoSessionIdleSelectMenu,
this.ssoSessionIdleSelectMenuList this.ssoSessionIdleSelectMenuList
); );
cy.getId(this.ssoSessionMaxInput).clear().type("2"); cy.findByTestId(this.ssoSessionMaxInput).clear().type("2");
this.changeTimeUnit( this.changeTimeUnit(
"Hours", "Hours",
this.ssoSessionMaxSelectMenu, this.ssoSessionMaxSelectMenu,
this.ssoSessionMaxSelectMenuList this.ssoSessionMaxSelectMenuList
); );
cy.getId(this.ssoSessionIdleRememberMeInput).clear().type("3"); cy.findByTestId(this.ssoSessionIdleRememberMeInput).clear().type("3");
this.changeTimeUnit( this.changeTimeUnit(
"Days", "Days",
this.ssoSessionIdleRememberMeSelectMenu, this.ssoSessionIdleRememberMeSelectMenu,
this.ssoSessionIdleRememberMeSelectMenuList this.ssoSessionIdleRememberMeSelectMenuList
); );
cy.getId(this.ssoSessionMaxRememberMeInput).clear().type("4"); cy.findByTestId(this.ssoSessionMaxRememberMeInput).clear().type("4");
this.changeTimeUnit( this.changeTimeUnit(
"Minutes", "Minutes",
this.ssoSessionMaxRememberMeSelectMenu, this.ssoSessionMaxRememberMeSelectMenu,
this.ssoSessionMaxRememberMeSelectMenuList this.ssoSessionMaxRememberMeSelectMenuList
); );
cy.getId(this.clientSessionIdleInput).clear().type("5"); cy.findByTestId(this.clientSessionIdleInput).clear().type("5");
this.changeTimeUnit( this.changeTimeUnit(
"Hours", "Hours",
this.clientSessionIdleSelectMenu, this.clientSessionIdleSelectMenu,
this.clientSessionIdleSelectMenuList this.clientSessionIdleSelectMenuList
); );
cy.getId(this.clientSessionMaxInput).clear().type("6"); cy.findByTestId(this.clientSessionMaxInput).clear().type("6");
this.changeTimeUnit( this.changeTimeUnit(
"Days", "Days",
this.clientSessionMaxSelectMenu, this.clientSessionMaxSelectMenu,
this.clientSessionMaxSelectMenuList this.clientSessionMaxSelectMenuList
); );
cy.getId(this.offlineSessionIdleInput).clear().type("7"); cy.findByTestId(this.offlineSessionIdleInput).clear().type("7");
this.toggleSwitch(this.offlineSessionMaxSwitch); this.toggleSwitch(this.offlineSessionMaxSwitch);
cy.getId(this.loginTimeoutInput).clear().type("9"); cy.findByTestId(this.loginTimeoutInput).clear().type("9");
this.changeTimeUnit( this.changeTimeUnit(
"Minutes", "Minutes",
this.loginTimeoutSelectMenu, this.loginTimeoutSelectMenu,
this.loginTimeoutSelectMenuList this.loginTimeoutSelectMenuList
); );
cy.getId(this.loginActionTimeoutInput).clear().type("10"); cy.findByTestId(this.loginActionTimeoutInput).clear().type("10");
this.changeTimeUnit( this.changeTimeUnit(
"Days", "Days",
this.loginActionTimeoutSelectMenu, this.loginActionTimeoutSelectMenu,
@ -372,66 +372,64 @@ export default class RealmSettingsPage {
populateTokensPage() { populateTokensPage() {
this.toggleSwitch(this.revokeRefreshTokenSwitch); this.toggleSwitch(this.revokeRefreshTokenSwitch);
cy.getId(this.accessTokenLifespanInput) cy.findByTestId(this.accessTokenLifespanInput)
.focus() .focus()
.clear({ force: true }) .clear({ force: true });
.getId(this.accessTokenLifespanInput) cy.findByTestId(this.accessTokenLifespanInput).clear().type("1");
.clear()
.type("1");
this.changeTimeUnit( this.changeTimeUnit(
"Days", "Days",
this.accessTokenLifespanSelectMenu, this.accessTokenLifespanSelectMenu,
this.accessTokenLifespanSelectMenuList this.accessTokenLifespanSelectMenuList
); );
cy.getId(this.accessTokenLifespanImplicitInput).clear().type("2"); cy.findByTestId(this.accessTokenLifespanImplicitInput).clear().type("2");
this.changeTimeUnit( this.changeTimeUnit(
"Minutes", "Minutes",
this.accessTokenLifespanImplicitSelectMenu, this.accessTokenLifespanImplicitSelectMenu,
this.accessTokenLifespanImplicitSelectMenuList this.accessTokenLifespanImplicitSelectMenuList
); );
cy.getId(this.clientLoginTimeoutInput).clear().type("3"); cy.findByTestId(this.clientLoginTimeoutInput).clear().type("3");
this.changeTimeUnit( this.changeTimeUnit(
"Hours", "Hours",
this.clientLoginTimeoutSelectMenu, this.clientLoginTimeoutSelectMenu,
this.clientLoginTimeoutSelectMenuList this.clientLoginTimeoutSelectMenuList
); );
cy.getId(this.userInitiatedActionLifespanInput).clear().type("4"); cy.findByTestId(this.userInitiatedActionLifespanInput).clear().type("4");
this.changeTimeUnit( this.changeTimeUnit(
"Minutes", "Minutes",
this.userInitiatedActionLifespanSelectMenu, this.userInitiatedActionLifespanSelectMenu,
this.userInitiatedActionLifespanSelectMenuList this.userInitiatedActionLifespanSelectMenuList
); );
cy.getId(this.defaultAdminInitatedInput).clear().type("5"); cy.findByTestId(this.defaultAdminInitatedInput).clear().type("5");
this.changeTimeUnit( this.changeTimeUnit(
"Days", "Days",
this.defaultAdminInitatedInputSelectMenu, this.defaultAdminInitatedInputSelectMenu,
this.defaultAdminInitatedInputSelectMenuList this.defaultAdminInitatedInputSelectMenuList
); );
cy.getId(this.emailVerificationInput).clear().type("6"); cy.findByTestId(this.emailVerificationInput).clear().type("6");
this.changeTimeUnit( this.changeTimeUnit(
"Days", "Days",
this.emailVerificationSelectMenu, this.emailVerificationSelectMenu,
this.emailVerificationSelectMenuList this.emailVerificationSelectMenuList
); );
cy.getId(this.idpEmailVerificationInput).clear().type("7"); cy.findByTestId(this.idpEmailVerificationInput).clear().type("7");
this.changeTimeUnit( this.changeTimeUnit(
"Days", "Days",
this.idpEmailVerificationSelectMenu, this.idpEmailVerificationSelectMenu,
this.idpEmailVerificationSelectMenuList this.idpEmailVerificationSelectMenuList
); );
cy.getId(this.forgotPasswordInput).clear().type("8"); cy.findByTestId(this.forgotPasswordInput).clear().type("8");
this.changeTimeUnit( this.changeTimeUnit(
"Days", "Days",
this.forgotPasswordSelectMenu, this.forgotPasswordSelectMenu,
this.forgotPasswordSelectMenuList this.forgotPasswordSelectMenuList
); );
cy.getId(this.executeActionsInput).clear().type("9"); cy.findByTestId(this.executeActionsInput).clear().type("9");
this.changeTimeUnit( this.changeTimeUnit(
"Days", "Days",
this.executeActionsSelectMenu, this.executeActionsSelectMenu,
@ -449,7 +447,7 @@ export default class RealmSettingsPage {
} }
clickAdd() { clickAdd() {
cy.getId("addEventTypeConfirm").click(); cy.findByTestId("addEventTypeConfirm").click();
return this; return this;
} }
} }

View file

@ -28,61 +28,61 @@ export default class SessionsPage {
selectAllSessionsType() { selectAllSessionsType() {
cy.get(this.sessionTypeDrpDwn).click(); cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.allSessionTypesOption).click(); cy.findByTestId(this.allSessionTypesOption).click();
cy.get(this.selectedType).should("have.text", "All session types"); cy.get(this.selectedType).should("have.text", "All session types");
} }
selectRegularSSO() { selectRegularSSO() {
cy.get(this.sessionTypeDrpDwn).click(); cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.regularSSOOption).click(); cy.findByTestId(this.regularSSOOption).click();
cy.get(this.selectedType).should("have.text", "Regular SSO"); cy.get(this.selectedType).should("have.text", "Regular SSO");
} }
selectOffline() { selectOffline() {
cy.get(this.sessionTypeDrpDwn).click(); cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.offlineOption).click(); cy.findByTestId(this.offlineOption).click();
cy.get(this.selectedType).should("have.text", "Offline"); cy.get(this.selectedType).should("have.text", "Offline");
} }
selectDirectGrant() { selectDirectGrant() {
cy.get(this.sessionTypeDrpDwn).click(); cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.directGrantOption).click(); cy.findByTestId(this.directGrantOption).click();
cy.get(this.selectedType).should("have.text", "Direct grant"); cy.get(this.selectedType).should("have.text", "Direct grant");
} }
selectServiceAccount() { selectServiceAccount() {
cy.get(this.sessionTypeDrpDwn).click(); cy.get(this.sessionTypeDrpDwn).click();
cy.getId(this.serviceAccountOption).click(); cy.findByTestId(this.serviceAccountOption).click();
cy.get(this.selectedType).should("have.text", "Service account"); cy.get(this.selectedType).should("have.text", "Service account");
} }
setToNow() { setToNow() {
cy.getId(this.actionDropdown).click(); cy.findByTestId(this.actionDropdown).click();
cy.getId(this.revocationActionItem).click(); cy.findByTestId(this.revocationActionItem).click();
cy.getId(this.setToNowButton).click(); cy.findByTestId(this.setToNowButton).click();
} }
checkNotBeforeValueExists() { checkNotBeforeValueExists() {
cy.getId(this.actionDropdown).click(); cy.findByTestId(this.actionDropdown).click();
cy.getId(this.revocationActionItem).click(); cy.findByTestId(this.revocationActionItem).click();
cy.getId(this.notBeforeInput).should("not.have.value", "None"); cy.findByTestId(this.notBeforeInput).should("not.have.value", "None");
} }
clearNotBefore() { clearNotBefore() {
cy.getId(this.actionDropdown).click(); cy.findByTestId(this.actionDropdown).click();
cy.getId(this.revocationActionItem).click(); cy.findByTestId(this.revocationActionItem).click();
cy.getId(this.clearNotBeforeButton).click(); cy.findByTestId(this.clearNotBeforeButton).click();
} }
checkNotBeforeCleared() { checkNotBeforeCleared() {
cy.getId(this.actionDropdown).click(); cy.findByTestId(this.actionDropdown).click();
cy.getId(this.revocationActionItem).click(); cy.findByTestId(this.revocationActionItem).click();
cy.getId(this.notBeforeInput).should("have.value", "None"); cy.findByTestId(this.notBeforeInput).should("have.value", "None");
} }
logoutAllSessions() { logoutAllSessions() {
cy.getId(this.actionDropdown).click(); cy.findByTestId(this.actionDropdown).click();
cy.getId(this.logoutAll).click(); cy.findByTestId(this.logoutAll).click();
cy.getId(this.logoutAllConfirm).click(); cy.findByTestId(this.logoutAllConfirm).click();
} }
} }

View file

@ -37,11 +37,11 @@ export default class CreateUserPage {
cy.wait(100); cy.wait(100);
cy.get("body").then((body) => { cy.get("body").then((body) => {
if (body.find("[data-testid=empty-state]").length > 0) { if (body.find("[data-testid=empty-state]").length > 0) {
cy.getId(this.emptyStateCreateUserBtn).click(); cy.findByTestId(this.emptyStateCreateUserBtn).click();
} else if (body.find("[data-testid=search-users-title]").length > 0) { } else if (body.find("[data-testid=search-users-title]").length > 0) {
cy.getId(this.searchPgCreateUserBtn).click(); cy.findByTestId(this.searchPgCreateUserBtn).click();
} else { } else {
cy.getId(this.addUserBtn).click(); cy.findByTestId(this.addUserBtn).click();
} }
}); });
@ -49,25 +49,25 @@ export default class CreateUserPage {
} }
toggleAddGroupModal() { toggleAddGroupModal() {
cy.getId(this.joinGroupsBtn).click(); cy.findByTestId(this.joinGroupsBtn).click();
return this; return this;
} }
joinGroups() { joinGroups() {
cy.getId(this.joinBtn).click(); cy.findByTestId(this.joinBtn).click();
return this; return this;
} }
save() { save() {
cy.getId(this.saveBtn).click(); cy.findByTestId(this.saveBtn).click();
return this; return this;
} }
cancel() { cancel() {
cy.getId(this.cancelBtn).click(); cy.findByTestId(this.cancelBtn).click();
return this; return this;
} }

View file

@ -32,22 +32,22 @@ export default class UserDetailsPage {
} }
fillUserData() { fillUserData() {
cy.getId(this.emailInput).type(this.emailValue); cy.findByTestId(this.emailInput).type(this.emailValue);
cy.getId(this.firstNameInput).type(this.firstNameValue); cy.findByTestId(this.firstNameInput).type(this.firstNameValue);
cy.getId(this.lastNameInput).type(this.lastNameValue); cy.findByTestId(this.lastNameInput).type(this.lastNameValue);
cy.getId(this.enabledSwitch).check({ force: true }); cy.findByTestId(this.enabledSwitch).check({ force: true });
return this; return this;
} }
save() { save() {
cy.getId(this.saveBtn).click(); cy.findByTestId(this.saveBtn).click();
return this; return this;
} }
cancel() { cancel() {
cy.getId(this.cancelBtn).click(); cy.findByTestId(this.cancelBtn).click();
return this; return this;
} }

View file

@ -10,19 +10,19 @@ export default class UserGroupsPage {
} }
goToGroupsTab() { goToGroupsTab() {
cy.getId(this.userGroupsTab).click(); cy.findByTestId(this.userGroupsTab).click();
return this; return this;
} }
toggleAddGroupModal() { toggleAddGroupModal() {
cy.getId(this.addGroupButton).click(); cy.findByTestId(this.addGroupButton).click();
return this; return this;
} }
joinGroups() { joinGroups() {
cy.getId(this.joinGroupButton).click(); cy.findByTestId(this.joinGroupButton).click();
return this; return this;
} }

View file

@ -1,6 +1,8 @@
{ {
"extends": "../tsconfig.json", "extends": "../tsconfig.json",
"include": ["**/*"],
"compilerOptions": { "compilerOptions": {
"types": ["cypress", "@testing-library/cypress"],
"module": "ES2015", "module": "ES2015",
"target": "ES2015", "target": "ES2015",
} }

28
package-lock.json generated
View file

@ -35,6 +35,7 @@
"@snowpack/plugin-postcss": "^1.4.3", "@snowpack/plugin-postcss": "^1.4.3",
"@snowpack/plugin-react-refresh": "^2.5.0", "@snowpack/plugin-react-refresh": "^2.5.0",
"@snowpack/plugin-typescript": "^1.2.1", "@snowpack/plugin-typescript": "^1.2.1",
"@testing-library/cypress": "^8.0.1",
"@testing-library/jest-dom": "^5.14.1", "@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.1.0", "@testing-library/react": "^12.1.0",
"@types/dagre": "^0.7.45", "@types/dagre": "^0.7.45",
@ -3043,6 +3044,23 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/@testing-library/cypress": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/@testing-library/cypress/-/cypress-8.0.1.tgz",
"integrity": "sha512-JCGy8u4ia+OQQJxVqKqjqpb0i4kmHQhu5jKFVBp+v/YSICnf52fil2MWIJqO+tH9ZQXtp3aF7uKHsVipWaI0BQ==",
"dev": true,
"dependencies": {
"@babel/runtime": "^7.14.6",
"@testing-library/dom": "^8.1.0"
},
"engines": {
"node": ">=12",
"npm": ">=6"
},
"peerDependencies": {
"cypress": "^2.1.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/@testing-library/dom": { "node_modules/@testing-library/dom": {
"version": "8.1.0", "version": "8.1.0",
"integrity": "sha512-kmW9alndr19qd6DABzQ978zKQ+J65gU2Rzkl8hriIetPnwpesRaK4//jEQyYh8fEALmGhomD/LBQqt+o+DL95Q==", "integrity": "sha512-kmW9alndr19qd6DABzQ978zKQ+J65gU2Rzkl8hriIetPnwpesRaK4//jEQyYh8fEALmGhomD/LBQqt+o+DL95Q==",
@ -19069,6 +19087,16 @@
"defer-to-connect": "^2.0.0" "defer-to-connect": "^2.0.0"
} }
}, },
"@testing-library/cypress": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/@testing-library/cypress/-/cypress-8.0.1.tgz",
"integrity": "sha512-JCGy8u4ia+OQQJxVqKqjqpb0i4kmHQhu5jKFVBp+v/YSICnf52fil2MWIJqO+tH9ZQXtp3aF7uKHsVipWaI0BQ==",
"dev": true,
"requires": {
"@babel/runtime": "^7.14.6",
"@testing-library/dom": "^8.1.0"
}
},
"@testing-library/dom": { "@testing-library/dom": {
"version": "8.1.0", "version": "8.1.0",
"integrity": "sha512-kmW9alndr19qd6DABzQ978zKQ+J65gU2Rzkl8hriIetPnwpesRaK4//jEQyYh8fEALmGhomD/LBQqt+o+DL95Q==", "integrity": "sha512-kmW9alndr19qd6DABzQ978zKQ+J65gU2Rzkl8hriIetPnwpesRaK4//jEQyYh8fEALmGhomD/LBQqt+o+DL95Q==",

View file

@ -50,6 +50,7 @@
"@snowpack/plugin-postcss": "^1.4.3", "@snowpack/plugin-postcss": "^1.4.3",
"@snowpack/plugin-react-refresh": "^2.5.0", "@snowpack/plugin-react-refresh": "^2.5.0",
"@snowpack/plugin-typescript": "^1.2.1", "@snowpack/plugin-typescript": "^1.2.1",
"@testing-library/cypress": "^8.0.1",
"@testing-library/jest-dom": "^5.14.1", "@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.1.0", "@testing-library/react": "^12.1.0",
"@types/dagre": "^0.7.45", "@types/dagre": "^0.7.45",

View file

@ -1,6 +1,9 @@
{ {
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
// overwrite exclude so test files are included.
"exclude": [],
"compilerOptions": { "compilerOptions": {
"types": ["jest"],
"jsx": "react" "jsx": "react"
} }
} }

View file

@ -1,7 +1,12 @@
{ {
"include": ["src"],
"exclude": [
"**/*.test.ts",
"**/*.test.tsx"
],
"extends": "@snowpack/app-scripts-react/tsconfig.base.json", "extends": "@snowpack/app-scripts-react/tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"types": ["jest", "cypress", "snowpack-env"], "types": ["snowpack-env"],
"esModuleInterop": true "esModuleInterop": true
} }
} }

11
types/import.d.ts vendored
View file

@ -1,11 +0,0 @@
declare namespace Cypress {
interface Chainable {
/**
* Get one or more DOM elements by `data-testid`.
*
* @example
* cy.getId('searchButton') // Gets the <button data-testid="searchButton">Search</button>
*/
getId(selector: string, ...args): Chainable<any>;
}
}