|
|
@ -1,10 +1,14 @@ |
|
|
|
import { expect, Page } from '@playwright/test'; |
|
|
|
import { expect, Page } from '@playwright/test'; |
|
|
|
import BasePage from '../Base'; |
|
|
|
import BasePage from '../Base'; |
|
|
|
import { DashboardPage } from '../Dashboard'; |
|
|
|
import { DashboardPage } from '../Dashboard'; |
|
|
|
|
|
|
|
import { ChangePasswordPage } from './ChangePassword'; |
|
|
|
|
|
|
|
|
|
|
|
export class ProjectsPage extends BasePage { |
|
|
|
export class ProjectsPage extends BasePage { |
|
|
|
|
|
|
|
readonly changePasswordPage: ChangePasswordPage; |
|
|
|
|
|
|
|
|
|
|
|
constructor(rootPage: Page) { |
|
|
|
constructor(rootPage: Page) { |
|
|
|
super(rootPage); |
|
|
|
super(rootPage); |
|
|
|
|
|
|
|
this.changePasswordPage = new ChangePasswordPage(rootPage); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
prefixTitle(title: string) { |
|
|
|
prefixTitle(title: string) { |
|
|
@ -28,7 +32,7 @@ export class ProjectsPage extends BasePage { |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
if (!withoutPrefix) name = this.prefixTitle(name); |
|
|
|
if (!withoutPrefix) name = this.prefixTitle(name); |
|
|
|
|
|
|
|
|
|
|
|
await this.rootPage.locator('.nc-new-project-menu').click(); |
|
|
|
await this.get().locator('.nc-new-project-menu').click(); |
|
|
|
|
|
|
|
|
|
|
|
const createProjectMenu = await this.rootPage.locator('.nc-dropdown-create-project'); |
|
|
|
const createProjectMenu = await this.rootPage.locator('.nc-dropdown-create-project'); |
|
|
|
|
|
|
|
|
|
|
@ -38,20 +42,15 @@ export class ProjectsPage extends BasePage { |
|
|
|
await createProjectMenu.locator(`.ant-dropdown-menu-title-content`).nth(1).click(); |
|
|
|
await createProjectMenu.locator(`.ant-dropdown-menu-title-content`).nth(1).click(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// todo: Fast page transition breaks the vue router
|
|
|
|
|
|
|
|
await this.rootPage.waitForTimeout(2000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await this.rootPage.locator(`.nc-metadb-project-name`).waitFor(); |
|
|
|
await this.rootPage.locator(`.nc-metadb-project-name`).waitFor(); |
|
|
|
await this.rootPage.locator(`input.nc-metadb-project-name`).fill(name); |
|
|
|
await this.rootPage.locator(`input.nc-metadb-project-name`).fill(name); |
|
|
|
|
|
|
|
|
|
|
|
await this.rootPage.waitForTimeout(2000); |
|
|
|
const createProjectSubmitAction = this.rootPage.locator(`button:has-text("Create")`).click(); |
|
|
|
|
|
|
|
await this.waitForResponse({ |
|
|
|
await this.rootPage.locator(`button:has-text("Create")`).click({ |
|
|
|
uiAction: createProjectSubmitAction, |
|
|
|
delay: 2000, |
|
|
|
httpMethodsToMatch: ['POST'], |
|
|
|
|
|
|
|
requestUrlPathToMatch: '/api/v1/db/meta/projects/', |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// fix me! wait for page to be rendered completely
|
|
|
|
|
|
|
|
await this.rootPage.waitForTimeout(2000); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async checkProjectCreateButton({ exists = true }) { |
|
|
|
async checkProjectCreateButton({ exists = true }) { |
|
|
@ -91,9 +90,6 @@ export class ProjectsPage extends BasePage { |
|
|
|
withoutPrefix?: boolean; |
|
|
|
withoutPrefix?: boolean; |
|
|
|
waitForAuthTab?: boolean; |
|
|
|
waitForAuthTab?: boolean; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
// todo: Fast page transition breaks the vue router
|
|
|
|
|
|
|
|
await this.rootPage.waitForTimeout(2000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!withoutPrefix) title = this.prefixTitle(title); |
|
|
|
if (!withoutPrefix) title = this.prefixTitle(title); |
|
|
|
|
|
|
|
|
|
|
|
let project: any; |
|
|
|
let project: any; |
|
|
@ -138,7 +134,13 @@ export class ProjectsPage extends BasePage { |
|
|
|
if (!withoutPrefix) title = this.prefixTitle(title); |
|
|
|
if (!withoutPrefix) title = this.prefixTitle(title); |
|
|
|
|
|
|
|
|
|
|
|
await this.get().locator(`[data-testid="delete-project-${title}"]`).click(); |
|
|
|
await this.get().locator(`[data-testid="delete-project-${title}"]`).click(); |
|
|
|
await this.rootPage.locator(`button:has-text("Yes")`).click(); |
|
|
|
|
|
|
|
|
|
|
|
const deleteProjectAction = this.rootPage.locator(`button:has-text("Yes")`).click(); |
|
|
|
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
|
|
|
uiAction: deleteProjectAction, |
|
|
|
|
|
|
|
httpMethodsToMatch: ['DELETE'], |
|
|
|
|
|
|
|
requestUrlPathToMatch: '/api/v1/db/meta/projects/', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
await this.get().locator('.ant-table-row', { hasText: title }).waitFor({ state: 'hidden' }); |
|
|
|
await this.get().locator('.ant-table-row', { hasText: title }).waitFor({ state: 'hidden' }); |
|
|
|
} |
|
|
|
} |
|
|
@ -161,9 +163,6 @@ export class ProjectsPage extends BasePage { |
|
|
|
}); |
|
|
|
}); |
|
|
|
await projRow.locator('.nc-action-btn').nth(0).click(); |
|
|
|
await projRow.locator('.nc-action-btn').nth(0).click(); |
|
|
|
|
|
|
|
|
|
|
|
// todo: Fast page transition breaks the vue router
|
|
|
|
|
|
|
|
await this.rootPage.waitForTimeout(2000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await project.locator('input.nc-metadb-project-name').fill(newTitle); |
|
|
|
await project.locator('input.nc-metadb-project-name').fill(newTitle); |
|
|
|
// press enter to save
|
|
|
|
// press enter to save
|
|
|
|
const submitAction = project.locator('input.nc-metadb-project-name').press('Enter'); |
|
|
|
const submitAction = project.locator('input.nc-metadb-project-name').press('Enter'); |
|
|
@ -172,9 +171,6 @@ export class ProjectsPage extends BasePage { |
|
|
|
requestUrlPathToMatch: 'api/v1/db/meta/projects/', |
|
|
|
requestUrlPathToMatch: 'api/v1/db/meta/projects/', |
|
|
|
httpMethodsToMatch: ['PATCH'], |
|
|
|
httpMethodsToMatch: ['PATCH'], |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// todo: vue navigation breaks if page changes very quickly
|
|
|
|
|
|
|
|
await this.rootPage.waitForTimeout(1000); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async openLanguageMenu() { |
|
|
|
async openLanguageMenu() { |
|
|
@ -187,10 +183,23 @@ export class ProjectsPage extends BasePage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async verifyLanguage(param: { json: any }) { |
|
|
|
async verifyLanguage(param: { json: any }) { |
|
|
|
const title = await this.rootPage.locator(`.nc-project-page-title`); |
|
|
|
const title = this.rootPage.locator(`.nc-project-page-title`); |
|
|
|
const menu = this.rootPage.locator(`.nc-new-project-menu`); |
|
|
|
const menu = this.rootPage.locator(`.nc-new-project-menu`); |
|
|
|
await expect(title).toHaveText(param.json.title.myProject); |
|
|
|
await expect(title).toHaveText(param.json.title.myProject); |
|
|
|
await expect(menu).toHaveText(param.json.title.newProj); |
|
|
|
await expect(menu).toHaveText(param.json.title.newProj); |
|
|
|
await this.rootPage.locator(`[placeholder="${param.json.activity.searchProject}"]`).waitFor(); |
|
|
|
await this.rootPage.locator(`[placeholder="${param.json.activity.searchProject}"]`).waitFor(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async openPasswordChangeModal() { |
|
|
|
|
|
|
|
// open change password portal
|
|
|
|
|
|
|
|
await this.rootPage.locator('.nc-menu-accounts').click(); |
|
|
|
|
|
|
|
await this.rootPage |
|
|
|
|
|
|
|
.locator('.nc-dropdown-user-accounts-menu') |
|
|
|
|
|
|
|
.getByTestId('nc-menu-accounts__user-settings') |
|
|
|
|
|
|
|
.click(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async waitForRender() { |
|
|
|
|
|
|
|
await this.rootPage.locator('.nc-project-page-title:has-text("My Projects")').waitFor(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|