jojo/tests/e2e/repo-home.test.e2e.ts
0ko 2f6ca55a1c fix(ui): replace obsolete gt- helpers (#9964)
Resolved a few obsolete (no longer functional) `gt-` helpers that were not converted into other classes at some point.

`gt-interact-bg` was replaced by `interact-bg`. The remaining one was on action view page in a gear icon, which lacked proper background change on hover.

`gt-font-18` & `gt-font-normal` were remaining in the repo name on repo page. I left out the `*-font-18` one out and kept fixed the font-weight, but also made the `/` use normal font-weight instead of semibold, which looks better.

Preview
Before: https://codeberg.org/attachments/e52d5ebc-7fa8-4057-8e4b-05d219525092
Gitea: https://codeberg.org/attachments/a9a50928-6e0e-483c-82fe-73b6c244f4d5
After: https://codeberg.org/attachments/fd04d5b1-1965-478f-9d45-97c5d994c780

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9964
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2025-11-08 18:21:05 +01:00

57 lines
2.3 KiB
TypeScript

// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
// @watch start
// web_src/js/components/RepoBranchTagSelector.vue
// web_src/js/features/common-global.js
// web_src/css/repo.css
// web_src/css/modules/stats-bar.css
// @watch end
import {expect} from '@playwright/test';
import {test} from './utils_e2e.ts';
import {screenshot} from './shared/screenshots.ts';
test('Language stats bar', async ({browser}) => {
// This test doesn't need JS and runs a little faster without it
const context = await browser.newContext({javaScriptEnabled: false});
const page = await context.newPage();
const response = await page.goto('/user2/language-stats-test');
expect(response?.status()).toBe(200);
await expect(page.locator('#language-stats ul')).toBeHidden();
await page.click('#language-stats summary');
await expect(page.locator('#language-stats ul')).toBeVisible();
await screenshot(page);
await page.click('#language-stats summary');
await expect(page.locator('#language-stats ul')).toBeHidden();
await screenshot(page);
});
test('Repo title', async ({browser}) => {
const context = await browser.newContext({javaScriptEnabled: false});
const page = await context.newPage();
const response = await page.goto('/user2/repo1');
expect(response?.status()).toBe(200);
const repoHeader = page.locator('.repo-header');
expect(await repoHeader.locator('.flex-item-title').evaluate((el) => getComputedStyle(el).fontWeight)).toBe('400');
expect(await repoHeader.locator('.flex-item-title a[href="/user2"]').evaluate((el) => getComputedStyle(el).fontWeight)).toBe('400');
expect(await repoHeader.locator('.flex-item-title a[href="/user2/repo1"]').evaluate((el) => getComputedStyle(el).fontWeight)).toBe('600');
});
test('Branch selector commit icon', async ({page}) => {
const response = await page.goto('/user2/repo1');
expect(response?.status()).toBe(200);
await expect(page.locator('.branch-dropdown-button svg.octicon-git-branch')).toBeVisible();
await expect(page.locator('.branch-dropdown-button')).toHaveText('master');
await page.goto('/user2/repo1/src/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d');
await expect(page.locator('.branch-dropdown-button svg.octicon-git-commit')).toBeVisible();
await expect(page.locator('.branch-dropdown-button')).toHaveText('65f1bf27bc');
});