Skip to content

Commit 8459e7d

Browse files
Fix QMS login tests (#10210)
Signed-off-by: Artem Savchenko <armisav@gmail.com>
1 parent 43098b3 commit 8459e7d

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

plugins/login-resources/src/components/Form.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@
4545
export let withProviders: boolean = false
4646
export let subtitle: string | undefined = undefined
4747
export let signUpDisabled = false
48+
export let isLoading: boolean = false
4849
4950
const validate = makeSequential(async function validateAsync (language: string): Promise<boolean> {
50-
if (ignoreInitialValidation) return true
51+
if (ignoreInitialValidation || isLoading) return true
5152
5253
for (const field of fields) {
5354
const v = object[field.name]

plugins/login-resources/src/components/LoginPasswordForm.svelte

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,30 @@
4848
}
4949
5050
let status = OK
51+
let isLoading = false
5152
5253
const action = {
5354
i18n: login.string.LogIn,
5455
func: async () => {
55-
status = new Status(Severity.INFO, login.status.ConnectingToServer, {})
56-
const [loginStatus, result] = await doLogin(object.username, object.password)
57-
status = loginStatus
56+
isLoading = true
57+
try {
58+
status = new Status(Severity.INFO, login.status.ConnectingToServer, {})
59+
const [loginStatus, result] = await doLogin(object.username, object.password)
60+
status = loginStatus
5861
59-
if (onLogin !== undefined) {
60-
void onLogin(result, status)
61-
} else {
62-
await doLoginNavigate(
63-
result,
64-
(st) => {
65-
status = st
66-
},
67-
navigateUrl
68-
)
62+
if (onLogin !== undefined) {
63+
void onLogin(result, status)
64+
} else {
65+
await doLoginNavigate(
66+
result,
67+
(st) => {
68+
status = st
69+
},
70+
navigateUrl
71+
)
72+
}
73+
} finally {
74+
isLoading = false
6975
}
7076
}
7177
}
@@ -79,6 +85,7 @@
7985
{object}
8086
{action}
8187
{signUpDisabled}
88+
{isLoading}
8289
bottomActions={[recoveryAction]}
8390
ignoreInitialValidation
8491
withProviders

qms-tests/sanity/tests/model/login-page.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export class LoginPage {
2626
async login (email: string, password: string): Promise<void> {
2727
await this.inputEmail.fill(email)
2828
await this.inputPassword.fill(password)
29+
30+
// Wait for form validation to complete
31+
await this.page.waitForTimeout(1000)
32+
2933
expect(await this.buttonLogin.isEnabled()).toBe(true)
3034
await this.buttonLogin.click()
3135
}

0 commit comments

Comments
 (0)