mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-10-31 22:38:58 +00:00
8099238618
I think it's better if the primary actions have primary color instead of green which fits better into the overall single-color UI design. This PR currently replaces every green button with primary: <img width="141" alt="Screenshot 2023-09-16 at 14 07 59" src="https://github.com/go-gitea/gitea/assets/115237/843c1e50-4fb2-4ec6-84ba-0efb9472dcbe"> <img width="161" alt="Screenshot 2023-09-16 at 14 07 51" src="https://github.com/go-gitea/gitea/assets/115237/9442195a-a3b2-4a42-b262-8377d6f5c0d1"> Modal actions now use uncolored/primary instead of previous green/red colors. I also removed the box-shadow on all basic buttons: <img width="259" alt="Screenshot 2023-09-16 at 14 16 39" src="https://github.com/go-gitea/gitea/assets/115237/5beea529-127a-44b0-8d4c-afa7b034a490"> <img width="261" alt="Screenshot 2023-09-16 at 14 17 42" src="https://github.com/go-gitea/gitea/assets/115237/4757f7b2-4d46-49bc-a797-38bb28437b88"> The change currently includes the "Merge PR" button, for which we might want to make an exception to match the icon color there: <img width="442" alt="Screenshot 2023-09-16 at 14 33 53" src="https://github.com/go-gitea/gitea/assets/115237/993ac1a5-c94d-4895-b76c-0d872181a70b">
60 lines
2.1 KiB
JavaScript
60 lines
2.1 KiB
JavaScript
import {expect} from '@playwright/test';
|
|
|
|
const ARTIFACTS_PATH = `tests/e2e/test-artifacts`;
|
|
const LOGIN_PASSWORD = 'password';
|
|
|
|
// log in user and store session info. This should generally be
|
|
// run in test.beforeAll(), then the session can be loaded in tests.
|
|
export async function login_user(browser, workerInfo, user) {
|
|
// Set up a new context
|
|
const context = await browser.newContext();
|
|
const page = await context.newPage();
|
|
|
|
// Route to login page
|
|
// Note: this could probably be done more quickly with a POST
|
|
const response = await page.goto('/user/login');
|
|
await expect(response?.status()).toBe(200); // Status OK
|
|
|
|
// Fill out form
|
|
await page.type('input[name=user_name]', user);
|
|
await page.type('input[name=password]', LOGIN_PASSWORD);
|
|
await page.click('form button.ui.primary.button:visible');
|
|
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await expect(page.url(), {message: `Failed to login user ${user}`}).toBe(`${workerInfo.project.use.baseURL}/`);
|
|
|
|
// Save state
|
|
await context.storageState({path: `${ARTIFACTS_PATH}/state-${user}-${workerInfo.workerIndex}.json`});
|
|
|
|
return context;
|
|
}
|
|
|
|
export async function load_logged_in_context(browser, workerInfo, user) {
|
|
let context;
|
|
try {
|
|
context = await browser.newContext({storageState: `${ARTIFACTS_PATH}/state-${user}-${workerInfo.workerIndex}.json`});
|
|
} catch (err) {
|
|
if (err.code === 'ENOENT') {
|
|
throw new Error(`Could not find state for '${user}'. Did you call login_user(browser, workerInfo, '${user}') in test.beforeAll()?`);
|
|
}
|
|
}
|
|
return context;
|
|
}
|
|
|
|
export async function save_visual(page) {
|
|
// Optionally include visual testing
|
|
if (process.env.VISUAL_TEST) {
|
|
await page.waitForLoadState('networkidle');
|
|
// Mock page/version string
|
|
await page.locator('footer div.ui.left').evaluate((node) => node.innerHTML = 'MOCK');
|
|
await expect(page).toHaveScreenshot({
|
|
fullPage: true,
|
|
timeout: 20000,
|
|
mask: [
|
|
page.locator('.dashboard-navbar span>img.ui.avatar'),
|
|
page.locator('.ui.dropdown.jump.item span>img.ui.avatar'),
|
|
],
|
|
});
|
|
}
|
|
}
|