Skip to content

Commit

Permalink
webkit test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chalapkoStanislav committed Aug 23, 2024
1 parent 147b189 commit 1b37415
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 33 deletions.
4 changes: 4 additions & 0 deletions pages/dashboard/dashboard-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -884,4 +884,8 @@ exports.DashboardPage = class DashboardPage extends BasePage {
async checkPageNumber(number) {
await expect(this.onboardingPaginator).toHaveText(`${number}/5`);
}

async waitForCreateFilePlaceholderVisible() {
await this.createFileButtonPlaceholder.first().waitFor({ state: 'visible' });
}
};
11 changes: 9 additions & 2 deletions pages/dashboard/team-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports.TeamPage = class TeamPage extends BasePage {

// Teams
this.teamCurrentBtn = page.locator('button[class*="current-team"]');
this.teamCurrentBtnWebkit = page.locator('button[class*="current-team"] div span').first();
this.teamList = page.locator('ul[class*="teams-dropdown"]');
this.createNewTeamMenuItem = page.locator('#teams-selector-create-team');
this.teamNameInput = page.locator('#name');
Expand Down Expand Up @@ -111,8 +112,14 @@ exports.TeamPage = class TeamPage extends BasePage {
await this.createNewTeamButton.click();
}

async isTeamSelected(teamName) {
await expect(this.teamCurrentBtn).toHaveText(teamName);
async isTeamSelected(teamName, browserName = 'chrome') {
browserName === 'webkit'
? await expect(this.teamCurrentBtnWebkit).toHaveText(teamName)
: await expect(this.teamCurrentBtn).toHaveText(teamName);
}

async waitForTeamBtn(timeout = 10000) {
await this.teamCurrentBtnWebkit.waitFor({ state: 'visible' , timeout: timeout});
}

async openTeamsListIfClosed() {
Expand Down
10 changes: 10 additions & 0 deletions pages/workspace/main-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,16 @@ exports.MainPage = class MainPage extends BasePage {
await expect(this.viewport).toBeVisible();
}

async isMainPageVisible() {
try {
await this.viewport.waitFor({ state: 'visible' , timeout: 8000});
return true;
} catch (error) {
console.log(error);
return false;
}
}

async isProjectAndFileNameExistInFile(projectName, fileName) {
await expect(this.projectNameSpan).toContainText(projectName);
await expect(this.fileNameSpan.last()).toHaveText(fileName);
Expand Down
4 changes: 4 additions & 0 deletions pages/workspace/view-mode-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ exports.ViewModePage = class ViewModePage extends BasePage {
: await expect(this.viewerLoyautSection).not.toBeVisible();
}

async waitForViewerSection(timeout = 10000) {
await this.viewerLoyautSection.waitFor({ state: 'visible' , timeout: timeout});
}

async clickDestroyLincButton() {
await this.destroyLincButton.click();
await this.destroyLincButton.click();
Expand Down
7 changes: 5 additions & 2 deletions tests/assets/assets-colors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ const { qase } = require('playwright-qase-reporter/dist/playwright');

const teamName = random().concat('autotest');

test.beforeEach(async ({ page }) => {
test.beforeEach(async ({ page, browserName }) => {
const teamPage = new TeamPage(page);
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
browserName === 'webkit' && !( await mainPage.isMainPageVisible())
? await dashboardPage.createFileViaPlaceholder()
: null;
await mainPage.isMainPageLoaded();
});

Expand Down Expand Up @@ -48,7 +51,7 @@ mainTest.describe(() => {
await colorPalettePopUp.clickSaveColorStyleButton();
await mainPage.clickViewportTwice();
await mainPage.waitForChangeIsSaved();
});
});

mainTest(qase(933,'AS-23 File library colors - add'), async ({ page }) => {
const assetsPanelPage = new AssetsPanelPage(page);
Expand Down
5 changes: 4 additions & 1 deletion tests/assets/assets-shortcuts-panel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ const { qase } = require('playwright-qase-reporter/dist/playwright');

const teamName = random().concat('autotest');

test.beforeEach(async ({ page }) => {
test.beforeEach(async ({ page, browserName }) => {
const teamPage = new TeamPage(page);
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
browserName === 'webkit' && !( await mainPage.isMainPageVisible())
? await dashboardPage.createFileViaPlaceholder()
: null;
await mainPage.isMainPageLoaded();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ const { qase } = require('playwright-qase-reporter/dist/playwright');

const teamName = random().concat('autotest');

test.beforeEach(async ({ page }) => {
test.beforeEach(async ({ page, browserName }) => {
const dashboardPage = new DashboardPage(page);
const teamPage = new TeamPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.createFileViaPlaceholder();
browserName === 'webkit' && !( await mainPage.isMainPageVisible())
? await dashboardPage.createFileViaPlaceholder()
: null;
await mainPage.isMainPageLoaded();
});

Expand Down
Loading

0 comments on commit 1b37415

Please sign in to comment.