Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chalapkoStanislav committed Aug 27, 2024
1 parent e8c181f commit bb714e2
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 92 deletions.
1 change: 0 additions & 1 deletion pages/workspace/layers-panel-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ exports.LayersPanelPage = class LayersPanelPage extends BasePage {
'span[class*="element-name"] >> nth=1',
);
this.layoutIcon = page.locator('svg.icon-flex-vertical');
// this.focusModeDiv = page.locator('div.focus-mode:text-is("Focus mode")');
this.layerItemToggleExpand = page.locator(
'div[class*="layers__element-list"] button[class*="sidebar_layer_item__inverse"]',
);
Expand Down
13 changes: 5 additions & 8 deletions pages/workspace/main-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,10 @@ exports.MainPage = class MainPage extends BasePage {
await expect(this.firstPageListItem).toHaveText(name);
}

async isSecondPageAddedToAssetsPanel() {
await expect(this.secondPageListItem).toBeVisible();
async isSecondPageAddedToAssetsPanel(added = true) {
added
? await expect(this.secondPageListItem).toBeVisible()
: await expect(this.secondPageListItem).not.toBeVisible();
}

async isSecondPageNameDisplayed(name) {
Expand Down Expand Up @@ -826,9 +828,7 @@ exports.MainPage = class MainPage extends BasePage {
await this.clickViewportByCoordinates(1200, 700);
await this.clickViewportByCoordinates(1000, 400);
await this.clickViewportByCoordinates(500, 200);
await this.clickOnDesignTab(); // todo: need to remove after issue fix
// await this.clickOnMainToolBar(); //todo bug 6171 > need to uncomment after fix these 2 rows
// await this.clickMoveButton();
await this.clickOnDesignTab();
await this.waitForChangeIsSaved();
}

Expand All @@ -839,9 +839,6 @@ exports.MainPage = class MainPage extends BasePage {
await this.clickViewportByCoordinates(1000, 400);
await this.clickMoveNodesButtonOnNodePanel();
await this.clickDrawNodesButtonOnNodePanel();
// await this.clickOnDesignTab(); // todo: need to remove after issue fix
// await this.clickOnMainToolBar(); //todo bug 6171 > need to uncomment after fix these 2 rows
// await this.clickMoveButton();
await this.waitForChangeIsSaved();
}

Expand Down
83 changes: 37 additions & 46 deletions tests/assets/shared-libraries.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { qase } = require('playwright-qase-reporter/dist/playwright');
const teamName = random().concat('autotest');

let dashboardPage, teamPage, mainPage, assetsPanelPage, designPanelPage, layersPanelPage, colorPalettePage;
test.beforeEach(async ({ page }) => {
mainTest.beforeEach(async ({ page }) => {
dashboardPage = new DashboardPage(page);
teamPage = new TeamPage(page);
mainPage = new MainPage(page);
Expand All @@ -27,7 +27,7 @@ test.beforeEach(async ({ page }) => {
await mainPage.isMainPageLoaded();
});

test.afterEach(async ({}, testInfo) => {
mainTest.afterEach(async ({}, testInfo) => {
await teamPage.deleteTeam(teamName);
await updateTestResults(testInfo.status, testInfo.retry)
});
Expand Down Expand Up @@ -465,8 +465,8 @@ mainTest.describe(() => {
});
});

test.describe(() => {
test.beforeEach(async ({ page }, testInfo) => {
mainTest.describe(() => {
mainTest.beforeEach(async ({ page }, testInfo) => {
await testInfo.setTimeout(testInfo.timeout + 30000);
await mainPage.createDefaultRectangleByCoordinates(200, 200);
await mainPage.createComponentViaRightClick();
Expand Down Expand Up @@ -521,48 +521,39 @@ test.describe(() => {
await dashboardPage.checkNumberOfFiles('3 files');
});

// mainTest(
// qase(1092,'PENPOT-1092 Delete library which is used by a few files ( 1 library in a few files)'),
// async () => {
// await dashboardPage.deleteFileWithNameViaRightClick('New File 1');
// await expect(dashboardPage.deleteFileModalWindow).toHaveScreenshot(
// 'library-delete-warning.png',
// );
// await dashboardPage.clickDeleteFileButton();
//
// await dashboardPage.openFileWithName('New File 2');
// await mainPage.isSecondPageNameDisplayed('Main components');
// await mainPage.clickOnPageOnLayersPanel(false);
// await expect(layersPanelPage.layersSidebar).toHaveScreenshot(
// 'library-backup-layers.png',
// );
// await expect(mainPage.viewport).toHaveScreenshot(
// 'library-backup-viewport.png',
// );
// await assetsPanelPage.clickAssetsTab();
// await expect(assetsPanelPage.assetsPanel).toHaveScreenshot(
// 'library-backup-assets.png',
// );
// await mainPage.clickPencilBoxButton();
// await dashboardPage.isHeaderDisplayed('Projects');
//
// await dashboardPage.openFileWithName('New File 3');
// await mainPage.isSecondPageNameDisplayed('Main components');
// await mainPage.clickOnPageOnLayersPanel(false);
// await expect(layersPanelPage.layersSidebar).toHaveScreenshot(
// 'library-backup-layers.png',
// );
// await expect(mainPage.viewport).toHaveScreenshot(
// 'library-backup-viewport.png',
// );
// await assetsPanelPage.clickAssetsTab();
// await expect(assetsPanelPage.assetsPanel).toHaveScreenshot(
// 'library-backup-assets.png',
// );
// },
// );

test.afterEach(async () => {
mainTest(
qase(1092,'PENPOT-1092 Delete library which is used by a few files ( 1 library in a few files)'),
async () => {
await dashboardPage.deleteFileWithNameViaRightClick('New File 1');
await expect(dashboardPage.deleteFileModalWindow).toHaveScreenshot(
'library-delete-warning.png',
);
await dashboardPage.clickDeleteFileButton();

await dashboardPage.openFileWithName('New File 2');
await mainPage.isSecondPageAddedToAssetsPanel(false);
await expect(layersPanelPage.layersSidebar).toHaveScreenshot(
'library-without-library-layers.png',
);
await expect(mainPage.viewport).toHaveScreenshot(
'library-without-library-viewport.png',
);

await mainPage.clickPencilBoxButton();
await dashboardPage.isHeaderDisplayed('Projects');

await dashboardPage.openFileWithName('New File 3');
await mainPage.isSecondPageAddedToAssetsPanel(false);
await expect(layersPanelPage.layersSidebar).toHaveScreenshot(
'library-without-library-layers.png',
);
await expect(mainPage.viewport).toHaveScreenshot(
'library-without-library-viewport.png',
);
},
);

mainTest.afterEach(async () => {
await mainPage.backToDashboardFromFileEditor();
});
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 0 additions & 11 deletions tests/composition/composition-grid-layout.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,17 +548,6 @@ mainTest.describe(() => {
});
});

// mainTest.only('PENPOT-1738 Move element inside grid board', async ({ page }) => {
// await mainPage.createDefaultRectangleByCoordinates(200, 200, true);
// await layersPanelPage.dragAndDropComponentToBoard('Rectangle');
// await mainPage.waitForChangeIsSaved();
// await mainPage.dragAndDropComponentToAnotherFraction(2, page);
// await mainPage.waitForChangeIsSaved();
// await expect(mainPage.viewport).toHaveScreenshot('board-with-grid-move-element.png', {
// mask: [mainPage.guides],
// });
// });

mainTest(qase([1739,1742],'PENPOT-1739,1742 Duplicate vertical and horizontal direction, undo element duplication'), async ({ browserName }) => {
await mainPage.createDefaultRectangleByCoordinates(410, 410, true);
await mainPage.waitForChangeIsSaved();
Expand Down
3 changes: 1 addition & 2 deletions tests/panels-features/panels-features-main-menu.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ mainTest(qase(820,'PF-102 Hide/show board names'), async ({ page }) => {
await expect(mainPage.viewport).toHaveScreenshot('board-show-name.png');
});

mainTest.skip(qase(821,'PF-103-1 Hide/show pixel grid via main menu'), async ({ page }) => {
// todo bug 6365 > need to check after fix
mainTest(qase(821,'PF-103-1 Hide/show pixel grid via main menu'), async ({ page }) => {
const mainPage = new MainPage(page);
await mainPage.clickViewportTwice();
await mainPage.increaseZoom(10);
Expand Down
42 changes: 21 additions & 21 deletions tests/panels-features/panels-features-pages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,27 +106,27 @@ mainTest(qase(837,'PF-119 Delete page'), async ({ page }) => {
await mainPage.isFirstPageNameDisplayed('Page 1');
await expect(mainPage.pagesBlock).toHaveScreenshot('page-1.png');
});
//todo
// mainTest.only('PENPOT-1519 Copy and paste components from Page 1 to Page 2, on Page 2 right-click component and select "Show main component"',
// async ({ page, browserName }) => {
// const mainPage = new MainPage(page);
// const basePage = new BasePage(page);
// const layersPanelPage = new LayersPanelPage(page);
// await mainPage.createDefaultRectangleByCoordinates(300, 300);
// await mainPage.createComponentViaRightClick();
// await mainPage.waitForChangeIsSaved();
// await mainPage.pressCopyShortcut(browserName);
// await mainPage.clickAddPageButton();
// await mainPage.waitForChangeIsSaved();
// await mainPage.clickOnPageOnLayersPanel(false);
// await mainPage.pressPasteShortcut(browserName);
// await layersPanelPage.clickCopyComponentOnLayersTab();
// await basePage.showMainComponentViaRightClick();
// await mainPage.waitForChangeIsSaved();
// await expect(mainPage.viewport).toHaveScreenshot(
// 'page-copies-component-show-main.png',
// );
// });

mainTest('PENPOT-1519 Copy and paste components from Page 1 to Page 2, on Page 2 right-click component and select "Show main component"',
async ({ page, browserName }) => {
const mainPage = new MainPage(page);
const basePage = new BasePage(page);
const layersPanelPage = new LayersPanelPage(page);
await mainPage.createDefaultRectangleByCoordinates(300, 300);
await mainPage.createComponentViaRightClick();
await mainPage.waitForChangeIsSaved();
await mainPage.pressCopyShortcut(browserName);
await mainPage.clickAddPageButton();
await mainPage.waitForChangeIsSaved();
await mainPage.clickOnPageOnLayersPanel(false);
await mainPage.pressPasteShortcut(browserName);
await layersPanelPage.clickCopyComponentOnLayersTab();
await basePage.showMainComponentViaRightClick();
await mainPage.waitForChangeIsSaved();
await expect(mainPage.viewport).toHaveScreenshot(
'page-copies-component-show-main.png',
);
});

mainTest(qase(1526,'PENPOT-1526 Add a component from local library to Page 1 and Page 2, edit component on Page 2 and click "Reset overrides"'),
async ({ page }) => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions tests/view-mode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,9 @@ mainTest.describe(() => {
browserName === 'webkit' ? await viewModePage.waitForViewerSection(45000) : null;
layersPanelPage = new LayersPanelPage(newPage);

await viewModePage.clickEditButton();
await newPage.waitForTimeout(1000);
await viewModePage.isPageSwitched(newPage);
await viewModePage.clickEditButton();
await newPage.waitForTimeout(1000);
await viewModePage.isPageSwitched(newPage);

await page.close();
await viewModePage.clickEditButton();
Expand Down

0 comments on commit bb714e2

Please sign in to comment.