diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 93ea907dfa..85eee5b1df 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -55,24 +55,27 @@ - + +
+ +
+ - + +
+ + {{ctx.Locale.Tr "signed_in_as"}} {{.SignedUser.Name}} + +
+ +
+ {{else}} {{if .ShowRegistrationButton}} diff --git a/tests/e2e/dropdown.test.e2e.ts b/tests/e2e/dropdown.test.e2e.ts index 1cca75e75d..c4098e102a 100644 --- a/tests/e2e/dropdown.test.e2e.ts +++ b/tests/e2e/dropdown.test.e2e.ts @@ -19,9 +19,10 @@ test('JS enhanced interaction', async ({page}) => { await expect(nojsNotice).toBeHidden(); // Open and close by clicking summary - const dropdown = page.locator('details.dropdown'); - const dropdownSummary = page.locator('details.dropdown > summary'); - const dropdownContent = page.locator('details.dropdown > .content'); + const selectorPrefix = '#profile-avatar-card details.dropdown'; + const dropdown = page.locator(selectorPrefix); + const dropdownSummary = page.locator(`${selectorPrefix} > summary`); + const dropdownContent = page.locator(`${selectorPrefix} > .content`); await expect(dropdownContent).toBeHidden(); await dropdownSummary.click(); await expect(dropdownContent).toBeVisible(); @@ -116,8 +117,9 @@ test('No JS interaction', async ({browser}) => { await expect(nojsPage.locator('body')).toContainClass('no-js'); // Open and close by clicking summary - const dropdownSummary = nojsPage.locator('details.dropdown > summary'); - const dropdownContent = nojsPage.locator('details.dropdown > .content'); + const selectorPrefix = '#profile-avatar-card details.dropdown'; + const dropdownSummary = nojsPage.locator(`${selectorPrefix} > summary`); + const dropdownContent = nojsPage.locator(`${selectorPrefix} > .content`); await expect(dropdownContent).toBeHidden(); await dropdownSummary.click(); await expect(dropdownContent).toBeVisible(); @@ -151,23 +153,7 @@ test('No JS interaction', async ({browser}) => { await expect(dropdownContent).toBeVisible(); }); -test('Visual properties', async ({browser, isMobile}) => { - const context = await browser.newContext({javaScriptEnabled: false}); - const page = await context.newPage(); - - // User profile has dropdown used as an ellipsis menu - await page.goto('/user1'); - - // Has `.border` and pretty small default `inline-padding:` - const summary = page.locator('details.dropdown > summary'); - expect(await summary.evaluate((el) => getComputedStyle(el).border)).toBe('1px solid rgba(0, 0, 0, 0.114)'); - expect(await summary.evaluate((el) => getComputedStyle(el).paddingInline)).toBe('7px'); - - // Background - expect(await summary.evaluate((el) => getComputedStyle(el).backgroundColor)).toBe('rgba(0, 0, 0, 0)'); - await summary.click(); - expect(await summary.evaluate((el) => getComputedStyle(el).backgroundColor)).toBe('rgb(226, 226, 229)'); - +test.describe(`Visual properties`, () => { async function evaluateDropdownItems(page, selector, direction, height) { const computedStyles = await page.locator(selector).evaluateAll((items) => items.map((item) => { @@ -184,36 +170,60 @@ test('Visual properties', async ({browser, isMobile}) => { } } - // Direction and item height - const content = page.locator('details.dropdown > .content'); - const itemsSel = 'details.dropdown > .content > ul > li'; - if (isMobile) { + test('User profile', async ({browser, isMobile}) => { + const context = await browser.newContext({javaScriptEnabled: false}); + const page = await context.newPage(); + + // User profile has dropdown used as an ellipsis menu + await page.goto('/user1'); + const selectorPrefix = '#profile-avatar-card details.dropdown'; + const summary = page.locator(`${selectorPrefix} > summary`); + + // Has `.border` and pretty small default `inline-padding:` + expect(await summary.evaluate((el) => getComputedStyle(el).border)).toBe('1px solid rgba(0, 0, 0, 0.114)'); + expect(await summary.evaluate((el) => getComputedStyle(el).paddingInline)).toBe('7px'); + + // Background + expect(await summary.evaluate((el) => getComputedStyle(el).backgroundColor)).toBe('rgba(0, 0, 0, 0)'); + await summary.click(); + expect(await summary.evaluate((el) => getComputedStyle(el).backgroundColor)).toBe('rgb(226, 226, 229)'); + + // Direction and item height + if (isMobile) { + // `