Add PENPOT-251 test. CO-36 Copy and Paste Board

This commit is contained in:
Daniel Herrero García 2024-05-24 16:45:36 +02:00
parent c06647cfea
commit 249ca50bed
4 changed files with 46 additions and 6 deletions

View File

@ -95,12 +95,8 @@ exports.BasePage = class BasePage {
this.duplicateOption = page.locator(
'ul[class*="workspace_context_menu"] span:has-text("Duplicate")',
);
this.copyOption = page.locator(
'ul[class*="workspace_context_menu"] span:has-text("Copy")',
);
this.pasteOption = page.locator(
'ul[class*="workspace_context_menu"] span:has-text("Paste")',
);
this.copyOption = page.getByRole('listitem').filter({ hasText: 'Copy'});
this.pasteOption = page.getByRole('listitem').filter({ hasText: 'Paste'});
this.groupOption = page.locator(
'ul[class*="workspace_context_menu"] span:has-text("Group")',
);

View File

@ -10,6 +10,9 @@ exports.LayersPanelPage = class LayersPanelPage extends BasePage {
this.layersTab = page.locator('div[data-id="layers"]');
this.layersSidebar = page.locator('#layers');
this.sidebarLayerItem = page.locator(
'div[class*="workspace_sidebar_layer_item__layer-row"]',
);
this.createdLayerOnLayersPanelNameInput = page.locator(
'div[class*="element-list-body"] input[class*="element-name"]',
);
@ -261,4 +264,15 @@ exports.LayersPanelPage = class LayersPanelPage extends BasePage {
await this.copyComponentLayer.click({ button: 'right', force: true });
await this.detachInstanceOption.click();
}
async copyLayerViaRightClick(layerName) {
const layerSel = this.page.locator('#layers').getByText(layerName);
await layerSel.last().click({
button: 'right',
force: true,
});
await this.copyOption.click();
}
};

View File

@ -72,6 +72,10 @@ const config = {
launchOptions: {
ignoreDefaultArgs: ['--hide-scrollbars'],
},
contextOptions: {
// chromium-specific permissions
permissions: ['clipboard-read', 'clipboard-write'],
},
},
},
{
@ -88,6 +92,16 @@ const config = {
width: 1920,
},
},
launchOptions: {
firefoxUserPrefs: {
'dom.events.asyncClipboard.readText': true,
'dom.events.testing.asyncClipboard': true,
},
},
contextOptions: {
// chromium-specific permissions
permissions: ['clipboard-read', 'clipboard-write'],
},
},
{
name: 'webkit',

View File

@ -450,6 +450,22 @@ test.describe(() => {
},
);
mainTest(
qase(251,'CO-36 Copy and Paste Board'),
async ({ page }) => {
const mainPage = new MainPage(page);
const layersPanelPage = new LayersPanelPage(page);
const board1 = 'Board #1';
await mainPage.copyLayerViaRightClick();
await mainPage.pasteLayerViaRightClick();
await layersPanelPage.copyLayerViaRightClick(board1);
await mainPage.pasteLayerViaRightClick();
await mainPage.pressCopyShortcut();
await mainPage.pressPasteShortcut();
await expect(layersPanelPage.sidebarLayerItem).toHaveCount(5);
},
);
mainTest(
qase(268,"CO-53 Click 'Focus on' board from right click"),
async ({ page }) => {