Skip to content

Commit e958f29

Browse files
committed
chore: copy path
1 parent e5d80e2 commit e958f29

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

tests/suites/tenant/summary/objectSummary.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {expect, test} from '@playwright/test';
22

33
import {wait} from '../../../../src/utils';
4+
import {getClipboardContent} from '../../../utils/clipboard';
45
import {
56
backend,
67
dsStoragePoolsTableName,
@@ -161,7 +162,7 @@ test.describe('Object Summary', async () => {
161162
expect(vslotsColumns).not.toEqual(storagePoolsColumns);
162163
});
163164

164-
test.only('ACL tab shows correct access rights', async ({page}) => {
165+
test('ACL tab shows correct access rights', async ({page}) => {
165166
const pageQueryParams = {
166167
schema: '/local/.sys_health',
167168
database: '/local',
@@ -199,4 +200,22 @@ test.describe('Object Summary', async () => {
199200
{group: 'DATABASE-ADMINS', permissions: ['Manage']},
200201
]);
201202
});
203+
204+
test('Copy path copies correct path to clipboard', async ({page}) => {
205+
const pageQueryParams = {
206+
schema: dsVslotsSchema,
207+
database: tenantName,
208+
general: 'query',
209+
};
210+
const tenantPage = new TenantPage(page);
211+
await tenantPage.goto(pageQueryParams);
212+
213+
const objectSummary = new ObjectSummary(page);
214+
await objectSummary.clickActionMenuItem(dsVslotsTableName, RowTableAction.CopyPath);
215+
216+
await page.waitForTimeout(100);
217+
218+
const clipboardContent = await getClipboardContent(page);
219+
expect(clipboardContent).toBe('.sys/ds_vslots');
220+
});
202221
});

tests/utils/clipboard.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type {Page} from '@playwright/test';
2+
3+
export const getClipboardContent = async (page: Page): Promise<string> => {
4+
await page.context().grantPermissions(['clipboard-read']);
5+
6+
return page.evaluate(async () => {
7+
try {
8+
const text = await navigator.clipboard.readText();
9+
return text;
10+
} catch (error) {
11+
console.error('Failed to read clipboard:', error);
12+
return '';
13+
}
14+
});
15+
};

0 commit comments

Comments
 (0)