From 2d4db7ba3c6a2f1677f80555f464deda5bffb923 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 31 May 2024 10:55:18 -0400 Subject: [PATCH 1/5] Provide ability to view password Signed-off-by: Derek Ho --- public/apps/account/password-reset-panel.tsx | 3 +++ .../apps/configuration/utils/password-edit-panel.tsx | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/public/apps/account/password-reset-panel.tsx b/public/apps/account/password-reset-panel.tsx index 703d617e9..3a79bdf68 100644 --- a/public/apps/account/password-reset-panel.tsx +++ b/public/apps/account/password-reset-panel.tsx @@ -123,6 +123,7 @@ export function PasswordResetPanel(props: PasswordResetPanelProps) { setIsCurrentPasswordInvalid(false); }} isInvalid={isCurrentPasswordInvalid} + type="dual" /> @@ -141,6 +142,7 @@ export function PasswordResetPanel(props: PasswordResetPanelProps) { setIsNewPasswordInvalid(false); setIsRepeatNewPasswordInvalid(repeatNewPassword !== newPassword); }} + type="dual" isInvalid={isNewPasswordInvalid} /> @@ -162,6 +164,7 @@ export function PasswordResetPanel(props: PasswordResetPanelProps) { setRepeatNewPassword(value); setIsRepeatNewPasswordInvalid(value !== newPassword); }} + type="dual" /> diff --git a/public/apps/configuration/utils/password-edit-panel.tsx b/public/apps/configuration/utils/password-edit-panel.tsx index 918d0e000..1fdd7322d 100644 --- a/public/apps/configuration/utils/password-edit-panel.tsx +++ b/public/apps/configuration/utils/password-edit-panel.tsx @@ -15,7 +15,7 @@ import React from 'react'; import { CoreStart } from 'opensearch-dashboards/public'; -import { EuiFieldText, EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiIcon } from '@elastic/eui'; +import { EuiFieldPassword, EuiFlexGroup, EuiFlexItem, EuiFormRow } from '@elastic/eui'; import { FormRow } from './form-row'; import { PASSWORD_INSTRUCTION } from '../../apps-constants'; import { getDashboardsInfo } from '../../../utils/dashboards-info-utils'; @@ -65,10 +65,9 @@ export function PasswordEditPanel(props: { - } - type="password" + type="dual" onChange={passwordChangeHandler} /> @@ -82,10 +81,9 @@ export function PasswordEditPanel(props: { headerText="Re-enter password" helpText="The password must be identical to what you entered above." > - } - type="password" + type="dual" isInvalid={isRepeatPasswordInvalid} onChange={repeatPasswordChangeHandler} /> From a54f262e7c8d44d89e1191d68bccf31c4ce8e6d5 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 31 May 2024 10:58:48 -0400 Subject: [PATCH 2/5] Add snapshot to verify it is a FieldPassword Signed-off-by: Derek Ho --- .../password-edit-panel.test.tsx.snap | 53 +++++++++++++++++++ .../utils/test/password-edit-panel.test.tsx | 1 + 2 files changed, 54 insertions(+) create mode 100644 public/apps/configuration/utils/test/__snapshots__/password-edit-panel.test.tsx.snap diff --git a/public/apps/configuration/utils/test/__snapshots__/password-edit-panel.test.tsx.snap b/public/apps/configuration/utils/test/__snapshots__/password-edit-panel.test.tsx.snap new file mode 100644 index 000000000..d6e879b84 --- /dev/null +++ b/public/apps/configuration/utils/test/__snapshots__/password-edit-panel.test.tsx.snap @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Password edit panel repeat password field update 1`] = ` + + + + + + + + + + + + + + + +`; diff --git a/public/apps/configuration/utils/test/password-edit-panel.test.tsx b/public/apps/configuration/utils/test/password-edit-panel.test.tsx index 247a88d0b..9b8b0e007 100644 --- a/public/apps/configuration/utils/test/password-edit-panel.test.tsx +++ b/public/apps/configuration/utils/test/password-edit-panel.test.tsx @@ -90,6 +90,7 @@ describe('Password edit panel', () => { updateIsInvalid={updateIsInvalid} /> ); + expect(component).toMatchSnapshot(); const event = { target: { value: 'dummy' }, } as React.ChangeEvent; From d486bdc646d401e51aa57e037a08a073017090a2 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 31 May 2024 12:45:18 -0400 Subject: [PATCH 3/5] Stop running macos unit tests and change login screen Signed-off-by: Derek Ho --- .github/workflows/unit-test.yml | 2 +- public/apps/login/login-page.tsx | 6 +- .../__snapshots__/login-page.test.tsx.snap | 96 ++++++++----------- 3 files changed, 44 insertions(+), 60 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 7fd07c6cb..e1d744266 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest , windows-latest, macos-latest ] + os: [ ubuntu-latest , windows-latest ] runs-on: ${{ matrix.os }} steps: diff --git a/public/apps/login/login-page.tsx b/public/apps/login/login-page.tsx index abebf304b..f8bf6e5f4 100644 --- a/public/apps/login/login-page.tsx +++ b/public/apps/login/login-page.tsx @@ -25,6 +25,7 @@ import { EuiForm, EuiFormRow, EuiHorizontalRule, + EuiFieldPassword, } from '@elastic/eui'; import { CoreStart } from '../../../../../src/core/public'; import { ClientConfigType } from '../../types'; @@ -202,12 +203,11 @@ export function LoginPage(props: LoginPageDeps) { ); formBody.push( - } - type="password" + type="dual" onChange={(e) => setPassword(e.target.value)} value={password} isInvalid={usernameValidationFailed} diff --git a/public/apps/login/test/__snapshots__/login-page.test.tsx.snap b/public/apps/login/test/__snapshots__/login-page.test.tsx.snap index f04a02a1d..0fb0cb0a8 100644 --- a/public/apps/login/test/__snapshots__/login-page.test.tsx.snap +++ b/public/apps/login/test/__snapshots__/login-page.test.tsx.snap @@ -64,18 +64,16 @@ exports[`Login page renders renders with config value for multiauth 1`] = ` isInvalid={false} labelType="label" > - - } - type="password" + type="dual" value="" /> @@ -217,18 +215,16 @@ exports[`Login page renders renders with config value for multiauth with anonymo isInvalid={false} labelType="label" > - - } - type="password" + type="dual" value="" /> @@ -388,18 +384,16 @@ exports[`Login page renders renders with config value with anonymous auth enable isInvalid={false} labelType="label" > - - } - type="password" + type="dual" value="" /> @@ -509,18 +503,16 @@ exports[`Login page renders renders with config value with anonymous auth enable isInvalid={false} labelType="label" > - - } - type="password" + type="dual" value="" /> @@ -630,18 +622,16 @@ exports[`Login page renders renders with config value: string 1`] = ` isInvalid={false} labelType="label" > - - } - type="password" + type="dual" value="" /> @@ -733,18 +723,16 @@ exports[`Login page renders renders with config value: string array 1`] = ` isInvalid={false} labelType="label" > - - } - type="password" + type="dual" value="" /> @@ -836,18 +824,16 @@ exports[`Login page renders renders with default value: string 1`] = ` isInvalid={false} labelType="label" > - - } - type="password" + type="dual" value="" /> @@ -939,18 +925,16 @@ exports[`Login page renders renders with default value: string array 1`] = ` isInvalid={false} labelType="label" > - - } - type="password" + type="dual" value="" /> From a8f2fa3ae6b7f1c58ee46f761c56e66ff677b7d9 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 31 May 2024 15:26:41 -0400 Subject: [PATCH 4/5] Try to fix the flakiness of oidc with basepath test Signed-off-by: Derek Ho --- public/apps/configuration/panels/get-started.tsx | 2 +- test/cypress/e2e/oidc/oidc_auth_test.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/apps/configuration/panels/get-started.tsx b/public/apps/configuration/panels/get-started.tsx index 5903f88f6..44a5fa631 100644 --- a/public/apps/configuration/panels/get-started.tsx +++ b/public/apps/configuration/panels/get-started.tsx @@ -183,7 +183,7 @@ export function GetStarted(props: AppDependencies) { selectedDataSource={dataSource} /> - +

Get started

diff --git a/test/cypress/e2e/oidc/oidc_auth_test.spec.js b/test/cypress/e2e/oidc/oidc_auth_test.spec.js index 2228d2fbf..4b31ecdb1 100644 --- a/test/cypress/e2e/oidc/oidc_auth_test.spec.js +++ b/test/cypress/e2e/oidc/oidc_auth_test.spec.js @@ -88,7 +88,7 @@ describe('Log in via OIDC', () => { localStorage.setItem('opendistro::security::tenant::saved', '""'); localStorage.setItem('home:newThemeModal:show', 'false'); - cy.get('h1.euiTitle--large').contains('Get started'); + cy.get('[data-test-subj="get-started"]').should('exist'); }); it('Tenancy persisted after logout in OIDC', () => { From dd9cde3f83da9bd0176dbadd3e8cb4a4c73216b9 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Mon, 3 Jun 2024 12:22:46 -0400 Subject: [PATCH 5/5] Revert data test subj changes Signed-off-by: Derek Ho --- public/apps/configuration/panels/get-started.tsx | 2 +- test/cypress/e2e/oidc/oidc_auth_test.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/apps/configuration/panels/get-started.tsx b/public/apps/configuration/panels/get-started.tsx index 44a5fa631..5903f88f6 100644 --- a/public/apps/configuration/panels/get-started.tsx +++ b/public/apps/configuration/panels/get-started.tsx @@ -183,7 +183,7 @@ export function GetStarted(props: AppDependencies) { selectedDataSource={dataSource} /> - +

Get started

diff --git a/test/cypress/e2e/oidc/oidc_auth_test.spec.js b/test/cypress/e2e/oidc/oidc_auth_test.spec.js index 4b31ecdb1..2228d2fbf 100644 --- a/test/cypress/e2e/oidc/oidc_auth_test.spec.js +++ b/test/cypress/e2e/oidc/oidc_auth_test.spec.js @@ -88,7 +88,7 @@ describe('Log in via OIDC', () => { localStorage.setItem('opendistro::security::tenant::saved', '""'); localStorage.setItem('home:newThemeModal:show', 'false'); - cy.get('[data-test-subj="get-started"]').should('exist'); + cy.get('h1.euiTitle--large').contains('Get started'); }); it('Tenancy persisted after logout in OIDC', () => {