2024-09-11 22:34:33 +02:00
|
|
|
// @watch start
|
|
|
|
// templates/org/**
|
|
|
|
// templates/repo/**
|
|
|
|
// web_src/js/webcomponents/overflow-menu.js
|
|
|
|
// @watch end
|
|
|
|
|
2024-08-14 23:34:36 +02:00
|
|
|
import {expect} from '@playwright/test';
|
2025-01-05 06:17:04 +01:00
|
|
|
import {test} from './utils_e2e.ts';
|
2024-04-25 22:19:24 +02:00
|
|
|
|
2025-01-05 06:17:04 +01:00
|
|
|
test.describe('desktop viewport as user 2', () => {
|
|
|
|
test.use({user: 'user2', viewport: {width: 1920, height: 300}});
|
2024-04-25 22:19:24 +02:00
|
|
|
|
2025-01-05 06:17:04 +01:00
|
|
|
test('Settings button on right of repo header', async ({page}) => {
|
2024-04-25 22:19:24 +02:00
|
|
|
await page.goto('/user2/repo1');
|
|
|
|
|
|
|
|
const settingsBtn = page.locator('.overflow-menu-items>#settings-btn');
|
|
|
|
await expect(settingsBtn).toBeVisible();
|
|
|
|
await expect(settingsBtn).toHaveClass(/right/);
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-button')).toHaveCount(0);
|
|
|
|
});
|
|
|
|
|
2025-01-05 06:17:04 +01:00
|
|
|
test('Settings button on right of org header', async ({page}) => {
|
|
|
|
await page.goto('/org3');
|
2024-04-28 22:40:51 +02:00
|
|
|
|
|
|
|
const settingsBtn = page.locator('.overflow-menu-items>#settings-btn');
|
|
|
|
await expect(settingsBtn).toBeVisible();
|
|
|
|
await expect(settingsBtn).toHaveClass(/right/);
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-button')).toHaveCount(0);
|
|
|
|
});
|
2025-01-05 06:17:04 +01:00
|
|
|
});
|
2024-04-28 22:40:51 +02:00
|
|
|
|
2025-01-05 06:17:04 +01:00
|
|
|
test.describe('desktop viewport as user12', () => {
|
|
|
|
test.use({user: 'user12', viewport: {width: 1920, height: 300}});
|
2024-04-25 22:19:24 +02:00
|
|
|
|
2025-01-05 06:17:04 +01:00
|
|
|
test('Settings button on right of repo header also when add more button is shown', async ({page}) => {
|
|
|
|
await page.goto('/user12/repo10');
|
2024-04-25 22:19:24 +02:00
|
|
|
|
|
|
|
const settingsBtn = page.locator('.overflow-menu-items>#settings-btn');
|
|
|
|
await expect(settingsBtn).toBeVisible();
|
|
|
|
await expect(settingsBtn).toHaveClass(/right/);
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-button')).toHaveCount(0);
|
|
|
|
});
|
2025-01-05 06:17:04 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test.describe('desktop viewport, unauthenticated', () => {
|
|
|
|
test.use({viewport: {width: 1920, height: 300}});
|
2024-04-25 22:19:24 +02:00
|
|
|
|
|
|
|
test('User overview overflow menu should not be influenced', async ({page}) => {
|
|
|
|
await page.goto('/user2');
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-items>#settings-btn')).toHaveCount(0);
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-button')).toHaveCount(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test.describe('small viewport', () => {
|
2025-01-05 06:17:04 +01:00
|
|
|
test.use({user: 'user2', viewport: {width: 800, height: 300}});
|
2024-04-25 22:19:24 +02:00
|
|
|
|
2025-01-05 06:17:04 +01:00
|
|
|
test('Settings button in overflow menu of repo header', async ({page}) => {
|
2024-04-25 22:19:24 +02:00
|
|
|
await page.goto('/user2/repo1');
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-items>#settings-btn')).toHaveCount(0);
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-button')).toBeVisible();
|
|
|
|
|
|
|
|
await page.click('.overflow-menu-button');
|
|
|
|
await expect(page.locator('.tippy-target>#settings-btn')).toBeVisible();
|
|
|
|
|
|
|
|
// Verify that we have no duplicated items
|
|
|
|
const shownItems = await page.locator('.overflow-menu-items>a').all();
|
|
|
|
expect(shownItems).not.toHaveLength(0);
|
|
|
|
const overflowItems = await page.locator('.tippy-target>a').all();
|
|
|
|
expect(overflowItems).not.toHaveLength(0);
|
|
|
|
|
|
|
|
const items = shownItems.concat(overflowItems);
|
|
|
|
expect(Array.from(new Set(items))).toHaveLength(items.length);
|
|
|
|
});
|
|
|
|
|
2025-01-05 06:17:04 +01:00
|
|
|
test('Settings button in overflow menu of org header', async ({page}) => {
|
2024-04-25 22:19:24 +02:00
|
|
|
await page.goto('/org3');
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-items>#settings-btn')).toHaveCount(0);
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-button')).toBeVisible();
|
|
|
|
|
|
|
|
await page.click('.overflow-menu-button');
|
|
|
|
await expect(page.locator('.tippy-target>#settings-btn')).toBeVisible();
|
|
|
|
|
|
|
|
// Verify that we have no duplicated items
|
|
|
|
const shownItems = await page.locator('.overflow-menu-items>a').all();
|
|
|
|
expect(shownItems).not.toHaveLength(0);
|
|
|
|
const overflowItems = await page.locator('.tippy-target>a').all();
|
|
|
|
expect(overflowItems).not.toHaveLength(0);
|
|
|
|
|
|
|
|
const items = shownItems.concat(overflowItems);
|
|
|
|
expect(Array.from(new Set(items))).toHaveLength(items.length);
|
|
|
|
});
|
2025-01-05 06:17:04 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test.describe('small viewport, unauthenticated', () => {
|
|
|
|
test.use({viewport: {width: 800, height: 300}});
|
2024-04-25 22:19:24 +02:00
|
|
|
|
|
|
|
test('User overview overflow menu should not be influenced', async ({page}) => {
|
|
|
|
await page.goto('/user2');
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-items>#settings-btn')).toHaveCount(0);
|
|
|
|
|
|
|
|
await expect(page.locator('.overflow-menu-button')).toBeVisible();
|
|
|
|
await page.click('.overflow-menu-button');
|
|
|
|
await expect(page.locator('.tippy-target>#settings-btn')).toHaveCount(0);
|
|
|
|
|
|
|
|
// Verify that we have no duplicated items
|
|
|
|
const shownItems = await page.locator('.overflow-menu-items>a').all();
|
|
|
|
expect(shownItems).not.toHaveLength(0);
|
|
|
|
const overflowItems = await page.locator('.tippy-target>a').all();
|
|
|
|
expect(overflowItems).not.toHaveLength(0);
|
|
|
|
|
|
|
|
const items = shownItems.concat(overflowItems);
|
|
|
|
expect(Array.from(new Set(items))).toHaveLength(items.length);
|
|
|
|
});
|
|
|
|
});
|