Correction in EditIdentify for correct e2e test failed (issue #1771)

This commit is contained in:
Laurent GAY
2025-06-17 20:08:15 +02:00
parent 52ef7fb9af
commit efc950ad91
2 changed files with 24 additions and 17 deletions

View File

@@ -663,6 +663,13 @@ const handleError = (err: any) => {
} }
if (err.graphQLErrors !== undefined) { if (err.graphQLErrors !== undefined) {
err.graphQLErrors.forEach((error: any) => {
if (Array.isArray(error.message)) {
errors.value.push(error.message[0]);
} else {
errors.value.push(error.message);
}
});
err.graphQLErrors.forEach( err.graphQLErrors.forEach(
({ message: errorMessage }: { message: string }) => { ({ message: errorMessage }: { message: string }) => {
notifier?.error(errorMessage); notifier?.error(errorMessage);

View File

@@ -108,37 +108,37 @@ test("Tries to login with valid credentials, confirmed account but no profile",
await page.locator("#password").fill("some password"); await page.locator("#password").fill("some password");
await page.keyboard.press("Enter"); await page.keyboard.press("Enter");
await page.waitForURL("/register/profile/confirmed@email.com/true"); await page.waitForURL("/identity/create");
expect(page.url()).toContain("/register/profile/confirmed@email.com/true"); expect(page.url()).toContain("/identity/create");
await expect(page.locator("p.prose").first()).toHaveText( await expect(page.locator("div.flex-1").first()).toContainText(
"Now, create your first profile:" "Now, create your first profile:"
); );
const displayNameField = page.locator("form > .field").first(); const fieldList = page.locator("div.flex-1 > div > div > .field");
await expect(displayNameField.locator("label")).toHaveText(
"Displayed nickname" const displayNameField = fieldList.nth(1);
); await expect(displayNameField.locator("label")).toHaveText("Display name");
const displayNameInput = displayNameField.locator("input"); const displayNameInput = displayNameField.locator("input");
await displayNameInput.fill("Duplicate"); await displayNameInput.fill("Duplicate");
const usernameField = page.locator("form > .field").nth(1); const usernameField = fieldList.nth(2);
await expect(usernameField.locator("label")).toHaveText("Username"); await expect(usernameField.locator("label")).toHaveText("Username");
const usernameFieldInput = usernameField.locator("input"); const usernameFieldInput = usernameField.locator("input");
await usernameFieldInput.fill("test_user"); await usernameFieldInput.fill("test_user");
const descriptionField = page.locator("form > .field").nth(2); const descriptionField = fieldList.nth(3);
await expect(descriptionField.locator("label")).toHaveText("Short bio"); await expect(descriptionField.locator("label")).toHaveText("Description");
await descriptionField await descriptionField
.locator("textarea") .locator("textarea")
.fill("This shouln't work because it's using a dupublicated username"); .fill("This shouln't work because it's using a dupublicated username");
const submitButton = page.locator('button[type="submit"]', { const submitButton = page.locator('button[type="button"]', {
hasText: "Create my profile", hasText: "Create my profile",
}); });
await submitButton.click(); await submitButton.click();
await expect(page.locator("p.field-message-danger")).toHaveText( await expect(page.locator("article.o-notification")).toHaveText(
"This username is already taken." "This username is already taken."
); );
@@ -160,12 +160,12 @@ test("Tries to login with valid credentials, confirmed account but no profile",
// "mdi-account-circle" // "mdi-account-circle"
// ); // );
await page.waitForURL("/"); await page.waitForURL("/identity/create");
expect(page.url()).toContain("/"); await page.waitForURL("/identity/update/test_user_2");
await page.goto("/");
expect(page.url()).toBe("http://localhost:4000/");
await expect(page.locator(".notification-info")).toHaveText(
"Welcome to Mobilizon, Not!"
);
await expect( await expect(
page.locator("button#user-menu-button span:not(.sr-only)") page.locator("button#user-menu-button span:not(.sr-only)")
).toHaveClass("material-design-icon account-circle-icon"); ).toHaveClass("material-design-icon account-circle-icon");