Skip to content

Commit

Permalink
fix(tests): fix for chrome and firefox, update snapshots (win32, chro…
Browse files Browse the repository at this point in the history
…me/firefox) (#114)

fix(tests): fix for chrome and firefox, update snapshots (win32, chrome/firefox)
  • Loading branch information
chalapkoStanislav authored Nov 7, 2024
1 parent dc973b6 commit cee7d47
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 21 deletions.
6 changes: 4 additions & 2 deletions pages/base-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,14 @@ exports.BasePage = class BasePage {
await this.hideLayerMenuItem.click();
}

async focusBoardViaRightClickOnCanvas(title) {
async focusBoardViaRightClickOnCanvas(title, browserName = 'chrome') {
const boardSel = this.page.locator(
`span[class*="workspace_sidebar_layer_name"]:has-text("${title}")`,
);
await boardSel.click({ button: 'right', force: true });
await this.focusOnLayerMenuItem.click();
browserName === 'chrome'
? await this.focusOnLayerMenuItem.click()
: await this.focusOnLayerMenuItem.locator('span').first().click();
}

async focusLayerViaRightClickOnCanvas() {
Expand Down
7 changes: 7 additions & 0 deletions pages/profile-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ exports.ProfilePage = class ProfilePage extends BasePage {
}

async uploadProfileImage(filePath) {
const profileImage = await this.profileImageInput.locator('../img');
const oldSrc = await profileImage.getAttribute('src');
await this.profileImageInput.setInputFiles(filePath);
await expect(this.profileImageInput.locator(`../img[src="${oldSrc}"]`)).toBeHidden();
await this.page.waitForResponse(response =>
response.url() === `${process.env.BASE_URL}api/rpc/command/push-audit-events` &&
response.status() === 200
);
}

async backToDashboardFromAccount() {
Expand Down
12 changes: 8 additions & 4 deletions pages/workspace/layers-panel-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ exports.LayersPanelPage = class LayersPanelPage extends BasePage {
await this.layersTab.click();
}

async createComponentViaRightClickLayers() {
async createComponentViaRightClickLayers(browserName = 'chrome') {
await this.createdLayerOnLayersPanelSpan.click({
button: 'right',
force: true,
});
await this.createComponentMenuItem.click();
browserName === 'chrome'
? await this.createComponentMenuItem.click()
: await this.createComponentMenuItem.locator('span').first().click();
}

async clickCopyComponentOnLayersTab() {
Expand Down Expand Up @@ -259,13 +261,15 @@ exports.LayersPanelPage = class LayersPanelPage extends BasePage {
await this.detachInstanceOption.click();
}

async copyLayerViaRightClick(layerName) {
async copyLayerViaRightClick(layerName, browserName = 'chrome') {
const layerSel = this.page.locator('#layers').getByText(layerName);
await layerSel.last().click({
button: 'right',
force: true,
});
await this.copyOption.click();
browserName === 'chrome'
? await this.copyOption.click()
: await this.copyOption.locator('span').first().click();
}

async selectLayerByName(layerName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ mainTest(

mainTest(
qase(1437, 'Create component from curve by right-click'),
async ({ page }) => {
async ({ page, browserName }) => {
const mainPage = new MainPage(page);
const layersPanelPage = new LayersPanelPage(page);
const assetsPanelPage = new AssetsPanelPage(page);
await mainPage.createDefaultCurveLayer();
await layersPanelPage.createComponentViaRightClickLayers();
await layersPanelPage.createComponentViaRightClickLayers(browserName);
await mainPage.waitForChangeIsSaved();
await expect(mainPage.viewport).toHaveScreenshot(
'curve-main-component-canvas.png',
Expand Down
10 changes: 5 additions & 5 deletions tests/composition/composition-board.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ mainTest.describe(() => {

mainTest(
qase(271, "CO-56 Click 'Focus off' board from shortcut F"),
async ({ page }) => {
async ({ page, browserName }) => {
const mainPage = new MainPage(page);
const layersPanelPage = new LayersPanelPage(page);
await mainPage.focusBoardViaRightClickOnCanvas('Board');
await mainPage.focusBoardViaRightClickOnCanvas('Board', browserName);
await mainPage.waitForChangeIsSaved();
await layersPanelPage.isLayerPresentOnLayersTab('Board', true);
await layersPanelPage.isFocusModeOn();
Expand Down Expand Up @@ -485,7 +485,7 @@ mainTest.describe(() => {
const board1 = 'Board #1';
await mainPage.copyLayerViaRightClick();
await mainPage.pasteLayerViaRightClick();
await layersPanelPage.copyLayerViaRightClick(board1);
await layersPanelPage.copyLayerViaRightClick(board1, browserName);
await mainPage.pasteLayerViaRightClick();
await mainPage.pressCopyShortcut();
await mainPage.pressPasteShortcut();
Expand All @@ -497,12 +497,12 @@ mainTest.describe(() => {

mainTest(
qase(268, "CO-53 Click 'Focus on' board from right click"),
async ({ page }) => {
async ({ page, browserName }) => {
const mainPage = new MainPage(page);
const layersPanelPage = new LayersPanelPage(page);
const board1 = 'Board #1';
const board2 = 'Board #2';
await mainPage.focusBoardViaRightClickOnCanvas(board2);
await mainPage.focusBoardViaRightClickOnCanvas(board2, browserName);
await mainPage.waitForChangeIsSaved();
await layersPanelPage.isLayerPresentOnLayersTab(board1, false);
await layersPanelPage.isLayerPresentOnLayersTab(board2, true);
Expand Down
12 changes: 6 additions & 6 deletions tests/dashboard/dashboard-teams.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1997,7 +1997,7 @@ test.describe(() => {
teamPage = new TeamPage(page);
mainPage = new MainPage(page);
viewModePage = new ViewModePage(page);

await page.context().clearCookies();
await loginPage.goto();
await loginPage.acceptCookie();
await loginPage.clickOnCreateAccount();
Expand Down Expand Up @@ -2038,7 +2038,7 @@ test.describe(() => {

await page.goto(currentURL);
await expect(teamPage.accessDialog).toHaveScreenshot(
'request-access-dialog-image.png',
'request-file-access-dialog-image.png',
);
await teamPage.clickOnRequestAccessButton();
await teamPage.isRequestAccessButtonVisible(false);
Expand Down Expand Up @@ -2095,7 +2095,7 @@ test.describe(() => {

await page.goto(currentURL);
await expect(teamPage.accessDialog).toHaveScreenshot(
'request-access-dialog-image.png',
'request-project-access-dialog-image.png',
);
await teamPage.clickOnRequestAccessButton();
await teamPage.isRequestAccessButtonVisible(false);
Expand Down Expand Up @@ -2145,7 +2145,7 @@ test.describe(() => {

await page.goto(currentURL);
await expect(teamPage.accessDialog).toHaveScreenshot(
'request-access-dialog-image.png',
'request-file-access-dialog-image.png',
);
await teamPage.clickOnRequestAccessButton();
await teamPage.isRequestAccessButtonVisible(false);
Expand Down Expand Up @@ -2199,7 +2199,7 @@ test.describe(() => {

await page.goto(currentURL);
await expect(teamPage.accessDialog).toHaveScreenshot(
'request-access-dialog-image.png',
'request-file-access-dialog-image.png',
);
await teamPage.clickOnRequestAccessButton();
await teamPage.isRequestAccessButtonVisible(false);
Expand Down Expand Up @@ -2259,7 +2259,7 @@ test.describe(() => {

await page.goto(currentURL);
await expect(teamPage.accessDialog).toHaveScreenshot(
'request-access-dialog-image.png',
'request-file-access-dialog-image.png',
);
await teamPage.clickOnRequestAccessButton();
await teamPage.isRequestAccessButtonVisible(false);
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.
2 changes: 2 additions & 0 deletions tests/forgot-password.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ test.describe(() => {
const loginPage = new LoginPage(page);
const registerPage = new RegisterPage(page);
const dashboardPage = new DashboardPage(page);
await page.context().clearCookies();

await loginPage.goto();
await loginPage.acceptCookie();
await loginPage.clickOnCreateAccount();
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.
2 changes: 0 additions & 2 deletions tests/view-mode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ mainTest.describe(() => {
await designPanelPage.changeHeightAndWidthForLayer('200', '200');
await mainPage.waitForChangeIsSaved();
await mainPage.createDefaultRectangleByCoordinates(320, 320);
await mainPage.waitForChangeIsUnsaved();
await mainPage.waitForChangeIsSaved();
await layersPanelPage.dragAndDropComponentToBoard('Rectangle');
await mainPage.waitForChangeIsUnsaved();
Expand Down Expand Up @@ -602,7 +601,6 @@ mainTest.describe(() => {
await mainPage.waitForChangeIsUnsaved();
await mainPage.waitForChangeIsSaved();
await mainPage.createSmallClosedPathByCoordinates(330, 330);
await mainPage.waitForChangeIsUnsaved();
await mainPage.waitForChangeIsSaved();
await layersPanelPage.dragAndDropComponentToBoard('Path');
await mainPage.waitForChangeIsUnsaved();
Expand Down

0 comments on commit cee7d47

Please sign in to comment.