From a6c85439c93ad4a58c31d8b963f019530f705ceb Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 29 Jun 2023 13:11:59 +0200 Subject: [PATCH] fix identity test (#21312) * fix identity test * crazy that this fixes it --- .../pages/admin-ui/manage/AttributesTab.ts | 3 ++- .../ProviderBaseGeneralSettingsPage.ts | 4 +-- .../social/ProviderFacebookGeneralSettings.ts | 10 ++++--- .../social/ProviderGithubGeneralSettings.ts | 14 +++++----- .../social/ProviderGoogleGeneralSettings.ts | 26 +++++++++++-------- .../ProviderOpenshiftGeneralSettings.ts | 12 +++++---- .../social/ProviderPaypalGeneralSettings.ts | 8 +++--- .../ProviderStackoverflowGeneralSettings.ts | 8 +++--- 8 files changed, 49 insertions(+), 36 deletions(-) diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/AttributesTab.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/AttributesTab.ts index 97fd9b7aeb..58d37c776f 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/AttributesTab.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/AttributesTab.ts @@ -14,7 +14,7 @@ export default class AttributesTab { } public addAttribute(key: string, value: string) { - cy.findByTestId(this.addAttributeBtn).click(); + this.addAnAttributeButton(); cy.findAllByTestId(this.keyInput) .its("length") @@ -42,6 +42,7 @@ export default class AttributesTab { } public addAnAttributeButton() { + cy.wait(1000); cy.findByTestId(this.addAttributeBtn).click(); return this; } diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/ProviderBaseGeneralSettingsPage.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/ProviderBaseGeneralSettingsPage.ts index 6810cd7e74..d87e37f864 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/ProviderBaseGeneralSettingsPage.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/ProviderBaseGeneralSettingsPage.ts @@ -82,8 +82,8 @@ export default class ProviderBaseGeneralSettingsPage extends PageObject { return this; } - protected assertCommonRequiredFields(requiredFiels: string[]) { - requiredFiels.forEach((elementLocator) => { + protected assertCommonRequiredFields(requiredFields: string[]) { + requiredFields.forEach((elementLocator) => { if (elementLocator.includes("#")) { cy.get(elementLocator) .parent() diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderFacebookGeneralSettings.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderFacebookGeneralSettings.ts index 5c64250e0a..0f6b434c08 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderFacebookGeneralSettings.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderFacebookGeneralSettings.ts @@ -4,15 +4,19 @@ const additionalUsersProfile_input_test_value = "additionalUsersProfile_input_test_value"; export default class ProviderFacebookGeneralSettings extends ProviderBaseGeneralSettingsPage { - private additionalUsersProfileFieldsInput = "#facebookFetchedFields"; + private additionalUsersProfileFieldsInput = "fetchedFields"; public typeAdditionalUsersProfileFieldsInput(value: string) { - cy.get(this.additionalUsersProfileFieldsInput).type(value).blur(); + cy.findByTestId(this.additionalUsersProfileFieldsInput).type(value); + cy.findByTestId(this.additionalUsersProfileFieldsInput).blur(); return this; } public assertAdditionalUsersProfileFieldsInputEqual(value: string) { - cy.get(this.additionalUsersProfileFieldsInput).should("have.value", value); + cy.findByTestId(this.additionalUsersProfileFieldsInput).should( + "have.value", + value + ); return this; } diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderGithubGeneralSettings.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderGithubGeneralSettings.ts index c8439a2a56..d741218371 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderGithubGeneralSettings.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderGithubGeneralSettings.ts @@ -4,26 +4,28 @@ const base_url_input_test_value = "base_url_input_test_value"; const api_url_input_test_value = "api_url_input_test_value"; export default class ProviderGithubGeneralSettings extends ProviderBaseGeneralSettingsPage { - private baseUrlInput = "#baseUrl"; - private apiUrlInput = "#apiUrl"; + private baseUrlInput = "baseUrl"; + private apiUrlInput = "apiUrl"; public typeBaseUrlInput(value: string) { - cy.get(this.baseUrlInput).type(value).blur(); + cy.findByTestId(this.baseUrlInput).type(value); + cy.findByTestId(this.baseUrlInput).blur(); return this; } public typeApiUrlInput(value: string) { - cy.get(this.apiUrlInput).type(value).blur(); + cy.findByTestId(this.apiUrlInput).type(value); + cy.findByTestId(this.apiUrlInput).blur(); return this; } public assertBaseUrlInputInputEqual(value: string) { - cy.get(this.baseUrlInput).should("have.value", value); + cy.findByTestId(this.baseUrlInput).should("have.value", value); return this; } public assertApiUrlInputEqual(value: string) { - cy.get(this.apiUrlInput).should("have.value", value); + cy.findByTestId(this.apiUrlInput).should("have.value", value); return this; } diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderGoogleGeneralSettings.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderGoogleGeneralSettings.ts index 0c70253a68..780bc9be4d 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderGoogleGeneralSettings.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderGoogleGeneralSettings.ts @@ -3,37 +3,41 @@ import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage" const hosted_domain_input_test_value = "hosted_domain_input_test_value"; export default class ProviderGoogleGeneralSettings extends ProviderBaseGeneralSettingsPage { - private hostedDomainInput = "#googleHostedDomain"; - private useUserIpParamSwitch = "#googleUserIp"; - private requestRefreshTokenSwitch = "#googleOfflineAccess"; + private hostedDomainInput = "hostedDomain"; + private useUserIpParamSwitch = "userIp"; + private requestRefreshTokenSwitch = "offlineAccess"; public typeHostedDomainInput(value: string) { - cy.get(this.hostedDomainInput).type(value).blur(); + cy.findByTestId(this.hostedDomainInput).type(value); + cy.findByTestId(this.hostedDomainInput).blur(); return this; } public clickUseUserIpParamSwitch() { - cy.get(this.useUserIpParamSwitch).parent().click(); + cy.findByTestId(this.useUserIpParamSwitch).parent().click(); return this; } public clickRequestRefreshTokenSwitch() { - cy.get(this.requestRefreshTokenSwitch).parent().click(); + cy.findByTestId(this.requestRefreshTokenSwitch).parent().click(); return this; } public assertHostedDomainInputEqual(value: string) { - cy.get(this.hostedDomainInput).should("have.value", value); + cy.findByTestId(this.hostedDomainInput).should("have.value", value); return this; } public assertUseUserIpParamSwitchTurnedOn(isOn: boolean) { - super.assertSwitchStateOn(cy.get(this.useUserIpParamSwitch), isOn); + super.assertSwitchStateOn(cy.findByTestId(this.useUserIpParamSwitch), isOn); return this; } public assertRequestRefreshTokenSwitchTurnedOn(isOn: boolean) { - super.assertSwitchStateOn(cy.get(this.requestRefreshTokenSwitch), isOn); + super.assertSwitchStateOn( + cy.findByTestId(this.requestRefreshTokenSwitch), + isOn + ); return this; } @@ -48,8 +52,8 @@ export default class ProviderGoogleGeneralSettings extends ProviderBaseGeneralSe public assertFilledDataEqual(idpName: string) { this.assertCommonFilledDataEqual(idpName); this.assertHostedDomainInputEqual(hosted_domain_input_test_value); - this.assertSwitchStateOn(cy.get(this.useUserIpParamSwitch)); - this.assertSwitchStateOn(cy.get(this.requestRefreshTokenSwitch)); + this.assertSwitchStateOn(cy.findByTestId(this.useUserIpParamSwitch)); + this.assertSwitchStateOn(cy.findByTestId(this.requestRefreshTokenSwitch)); return this; } } diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderOpenshiftGeneralSettings.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderOpenshiftGeneralSettings.ts index f4dbfbebdc..a394e66817 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderOpenshiftGeneralSettings.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderOpenshiftGeneralSettings.ts @@ -3,20 +3,20 @@ import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage" const base_url_input_test_value = "base_url_input_test_value"; export default class ProviderOpenshiftGeneralSettings extends ProviderBaseGeneralSettingsPage { - private baseUrlInput = "#baseUrl"; + private baseUrlInput = "baseUrl"; constructor() { super(); - this.requiredFields.push(this.baseUrlInput); } public typeBaseUrlInput(value: string) { - cy.get(this.baseUrlInput).type(value).blur(); + cy.findByTestId(this.baseUrlInput).type(value); + cy.findByTestId(this.baseUrlInput).blur(); return this; } public assertbaseUrlInputEqual(value: string) { - cy.get(this.baseUrlInput).should("have.value", value); + cy.findByTestId(this.baseUrlInput).should("have.value", value); return this; } @@ -26,7 +26,9 @@ export default class ProviderOpenshiftGeneralSettings extends ProviderBaseGenera public fillData(idpName: string) { this.fillCommonFields(idpName); - cy.get(this.baseUrlInput).type(idpName + base_url_input_test_value); + cy.findByTestId(this.baseUrlInput).type( + idpName + base_url_input_test_value + ); return this; } diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderPaypalGeneralSettings.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderPaypalGeneralSettings.ts index a9c53b7465..e6af032b4a 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderPaypalGeneralSettings.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderPaypalGeneralSettings.ts @@ -1,15 +1,15 @@ import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage"; export default class ProviderPaypalGeneralSettings extends ProviderBaseGeneralSettingsPage { - private targetSandboxSwitch = "#paypalSandbox"; + private targetSandboxSwitch = "sandbox"; public clickTargetSandboxSwitch() { - cy.get(this.targetSandboxSwitch).parent().click(); + cy.findByTestId(this.targetSandboxSwitch).parent().click(); return this; } public assertTargetSandboxSwitchTurnedOn(isOn: boolean) { - super.assertSwitchStateOn(cy.get(this.targetSandboxSwitch), isOn); + super.assertSwitchStateOn(cy.findByTestId(this.targetSandboxSwitch), isOn); return this; } @@ -21,7 +21,7 @@ export default class ProviderPaypalGeneralSettings extends ProviderBaseGeneralSe public assertFilledDataEqual(idpName: string) { this.assertCommonFilledDataEqual(idpName); - this.assertSwitchStateOn(cy.get(this.targetSandboxSwitch)); + this.assertSwitchStateOn(cy.findByTestId(this.targetSandboxSwitch)); return this; } } diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderStackoverflowGeneralSettings.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderStackoverflowGeneralSettings.ts index 11ab29ff46..b62e1052cf 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderStackoverflowGeneralSettings.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/identity_providers/social/ProviderStackoverflowGeneralSettings.ts @@ -3,20 +3,20 @@ import ProviderBaseGeneralSettingsPage from "../ProviderBaseGeneralSettingsPage" const key_input_test_value = "key_input_test_value"; export default class ProviderStackoverflowGeneralSettings extends ProviderBaseGeneralSettingsPage { - private keyInput = "#stackoverflowKey"; + private keyInput = "key"; constructor() { super(); - this.requiredFields.push(this.keyInput); } public typeKeyInput(value: string) { - cy.get(this.keyInput).type(value).blur(); + cy.findByTestId(this.keyInput).type(value); + cy.findByTestId(this.keyInput).blur(); return this; } public assertKeyInputEqual(value: string) { - cy.get(this.keyInput).should("have.value", value); + cy.findByTestId(this.keyInput).should("have.value", value); return this; }