2024-12-09 19:32:16 +00:00
|
|
|
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
|
|
// @watch start
|
|
|
|
|
// templates/repo/home.tmpl
|
|
|
|
|
// templates/repo/diff/box.tmpl
|
|
|
|
|
// web_src/js/features/clipboard.js
|
|
|
|
|
// @watch end
|
|
|
|
|
|
|
|
|
|
import {expect} from '@playwright/test';
|
2025-10-03 13:45:08 +02:00
|
|
|
import {test} from './utils_e2e.ts';
|
|
|
|
|
import {screenshot} from './shared/screenshots.ts';
|
2024-12-09 19:32:16 +00:00
|
|
|
|
2025-11-13 17:23:08 +01:00
|
|
|
test('copy src file path to clipboard', async ({page}) => {
|
2024-12-09 19:32:16 +00:00
|
|
|
const response = await page.goto('/user2/repo1/src/branch/master/README.md');
|
|
|
|
|
expect(response?.status()).toBe(200);
|
|
|
|
|
|
|
|
|
|
await page.click('[data-clipboard-text]');
|
|
|
|
|
const clipboardText = await page.evaluate(() => navigator.clipboard.readText());
|
|
|
|
|
expect(clipboardText).toContain('README.md');
|
2025-02-07 09:24:53 +00:00
|
|
|
await expect(page.getByText('Copied')).toBeVisible();
|
2025-10-03 13:45:08 +02:00
|
|
|
await screenshot(page, page.getByText('Copied'), 50);
|
2024-12-09 19:32:16 +00:00
|
|
|
});
|
|
|
|
|
|
2025-11-13 17:23:08 +01:00
|
|
|
test('copy diff file path to clipboard', async ({page}) => {
|
2024-12-09 19:32:16 +00:00
|
|
|
const response = await page.goto('/user2/repo1/src/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d/README.md');
|
|
|
|
|
expect(response?.status()).toBe(200);
|
|
|
|
|
|
|
|
|
|
await page.click('[data-clipboard-text]');
|
|
|
|
|
const clipboardText = await page.evaluate(() => navigator.clipboard.readText());
|
|
|
|
|
expect(clipboardText).toContain('README.md');
|
2025-01-14 22:13:31 +01:00
|
|
|
await expect(page.getByText('Copied')).toBeVisible();
|
2025-10-03 13:45:08 +02:00
|
|
|
await screenshot(page, page.getByText('Copied'), 50);
|
2024-12-09 19:32:16 +00:00
|
|
|
});
|