-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨(frontend) sync user and frontend language
On Language change in the frontend, the user language is updated via API. If user language is available, it will be preferred and set in the frontend.
- Loading branch information
Showing
17 changed files
with
225 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,12 @@ | |
} | ||
|
||
DEV_USERS = [ | ||
{"username": "impress", "email": "[email protected]", "language": "en-us"}, | ||
{"username": "user-e2e-webkit", "email": "[email protected]", "language": "en-us"}, | ||
{"username": "user-e2e-firefox", "email": "[email protected]", "language": "en-us"}, | ||
{ | ||
"username": "impress", | ||
"email": "[email protected]", | ||
"username": "user-e2e-chromium", | ||
"email": "[email protected]", | ||
"language": "en-us", | ||
}, | ||
{ | ||
"username": "user-e2e-webkit", | ||
"email": "[email protected]", | ||
}, | ||
{ | ||
"username": "user-e2e-firefox", | ||
"email": "[email protected]", | ||
}, | ||
{"username": "user-e2e-chromium", "email": "[email protected]"}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,19 +111,13 @@ test.describe('Document create member', () => { | |
await expect(page.getByText(`Invitation sent to ${email}`)).toBeVisible(); | ||
const responseCreateInvitation = await responsePromiseCreateInvitation; | ||
expect(responseCreateInvitation.ok()).toBeTruthy(); | ||
expect( | ||
responseCreateInvitation.request().headers()['content-language'], | ||
).toBe('en-us'); | ||
|
||
// Check user added | ||
await expect( | ||
page.getByText(`User ${user.email} added to the document.`), | ||
).toBeVisible(); | ||
const responseAddUser = await responsePromiseAddUser; | ||
expect(responseAddUser.ok()).toBeTruthy(); | ||
expect(responseAddUser.request().headers()['content-language']).toBe( | ||
'en-us', | ||
); | ||
|
||
const listInvitation = page.getByLabel('List invitation card'); | ||
await expect(listInvitation.locator('li').getByText(email)).toBeVisible(); | ||
|
@@ -225,46 +219,6 @@ test.describe('Document create member', () => { | |
expect(responseCreateInvitationFail.ok()).toBeFalsy(); | ||
}); | ||
|
||
test('The invitation endpoint get the language of the website', async ({ | ||
page, | ||
browserName, | ||
}) => { | ||
await createDoc(page, 'user-invitation', browserName, 1); | ||
|
||
const header = page.locator('header').first(); | ||
await header.getByRole('combobox').getByText('EN').click(); | ||
await header.getByRole('option', { name: 'FR' }).click(); | ||
|
||
await page.getByRole('button', { name: 'Partager' }).click(); | ||
|
||
const inputSearch = page.getByLabel( | ||
/Trouver un membre à ajouter au document/, | ||
); | ||
|
||
const email = randomName('[email protected]', browserName, 1)[0]; | ||
await inputSearch.fill(email); | ||
await page.getByRole('option', { name: email }).click(); | ||
|
||
// Choose a role | ||
await page.getByRole('combobox', { name: /Choisissez un rôle/ }).click(); | ||
await page.getByRole('option', { name: 'Administrateur' }).click(); | ||
|
||
const responsePromiseCreateInvitation = page.waitForResponse( | ||
(response) => | ||
response.url().includes('/invitations/') && response.status() === 201, | ||
); | ||
|
||
await page.getByRole('button', { name: 'Valider' }).click(); | ||
|
||
// Check invitation sent | ||
await expect(page.getByText(`Invitation envoyée à ${email}`)).toBeVisible(); | ||
const responseCreateInvitation = await responsePromiseCreateInvitation; | ||
expect(responseCreateInvitation.ok()).toBeTruthy(); | ||
expect( | ||
responseCreateInvitation.request().headers()['content-language'], | ||
).toBe('fr-fr'); | ||
}); | ||
|
||
test('it manages invitation', async ({ page, browserName }) => { | ||
await createDoc(page, 'user-invitation', browserName, 1); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.