mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-24 04:17:50 +00:00
TSK-891: Fix UI Tests instability (#2780)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
b5a74cdbc9
commit
340b0c3198
@ -28,7 +28,7 @@
|
||||
let avatarEditor: EditableAvatar
|
||||
|
||||
const account = getCurrentAccount() as EmployeeAccount
|
||||
const employee = $employeeByIdStore.get(account.employee)
|
||||
$: employee = $employeeByIdStore.get(account.employee)
|
||||
let firstName: string = employee ? getFirstName(employee.name) : ''
|
||||
let lastName: string = employee ? getLastName(employee.name) : ''
|
||||
let displayName = employee?.displayName ?? ''
|
||||
|
@ -270,11 +270,14 @@ export class SpaceSecurityMiddleware extends BaseMiddleware implements Middlewar
|
||||
query: ObjQueryType<T['space']>
|
||||
): Promise<ObjQueryType<T['space']>> {
|
||||
const spaces = await this.getAllAllowedSpaces(account)
|
||||
if (query == null) {
|
||||
return { $in: spaces }
|
||||
}
|
||||
if (typeof query === 'string') {
|
||||
if (!spaces.includes(query)) {
|
||||
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
|
||||
}
|
||||
} else if (query.$in !== undefined) {
|
||||
} else if (query.$in != null) {
|
||||
query.$in = query.$in.filter((p) => spaces.includes(p))
|
||||
} else {
|
||||
query.$in = spaces
|
||||
|
@ -8,7 +8,7 @@ test.use({
|
||||
test.describe('actions tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench/sanity-ws/sanity-ws`)
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/sanity-ws`))?.finished()
|
||||
})
|
||||
test('action-new-candidate', async ({ page }) => {
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
|
@ -9,7 +9,9 @@ test.describe('login test', () => {
|
||||
})
|
||||
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/login/login`)
|
||||
await (
|
||||
await page.goto(`${PlatformURI}/login/login`)
|
||||
)?.finished
|
||||
|
||||
const emaillocator = page.locator('[name=email]')
|
||||
await emaillocator.click()
|
||||
|
@ -88,6 +88,13 @@ test.describe('recruit tests', () => {
|
||||
await page.fill('[placeholder="Search..."]', vacancyId)
|
||||
await page.click(`button:has-text("${vacancyId}")`)
|
||||
|
||||
await page.waitForSelector('space.selector', { state: 'detached' })
|
||||
await expect(
|
||||
await page.locator('[id="recruit:string:CreateApplication"] button:has-text("HR Interview")')
|
||||
).toBeVisible()
|
||||
// We need to be sure state is proper one, no other way to do it.
|
||||
await page.waitForTimeout(100)
|
||||
|
||||
await page.click('button:has-text("Create")')
|
||||
await page.waitForSelector('form.antiCard', { state: 'detached' })
|
||||
|
||||
|
@ -7,11 +7,11 @@ test.use({
|
||||
test.describe('contact tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench/sanity-ws`)
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
})
|
||||
test('update-profile', async ({ page, context }) => {
|
||||
// Go to http://localhost:8083/workbench/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench/sanity-ws`)
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
// Click #profile-button
|
||||
await page.click('#profile-button')
|
||||
await page.click('text=Appleseed John')
|
||||
@ -19,6 +19,7 @@ test.describe('contact tests', () => {
|
||||
// Click text=Edit profile
|
||||
// await page.click('text=Edit profile')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/setting/profile`)
|
||||
|
||||
// Click [placeholder="Location"]
|
||||
await page.click('[placeholder="Location"]')
|
||||
// Fill [placeholder="Location"]
|
||||
@ -37,7 +38,7 @@ test.describe('contact tests', () => {
|
||||
})
|
||||
test('create-template', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench/sanity-ws`)
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
// Click #profile-button
|
||||
await page.click('#profile-button')
|
||||
// Click button:has-text("Settings")
|
||||
@ -70,7 +71,7 @@ test.describe('contact tests', () => {
|
||||
|
||||
test('manage-templates', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench/sanity-ws`)
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
// Click #profile-button
|
||||
await page.click('#profile-button')
|
||||
// await page.click('text=Workspace')
|
||||
|
@ -12,7 +12,7 @@ test.describe('recruit tests', () => {
|
||||
})
|
||||
test('create-skill-candidate-with-skill', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench/sanity-ws`)
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
// Click [id="app-recruit\:string\:RecruitApplication"]
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit`)
|
||||
@ -51,7 +51,7 @@ test.describe('recruit tests', () => {
|
||||
|
||||
test('create-tag-candidate', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench/sanity-ws`)
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
// Click [id="app-recruit\:string\:RecruitApplication"]
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/recruit`)
|
||||
|
@ -45,37 +45,38 @@ export async function setViewOrder (page: Page, orderName: string): Promise<void
|
||||
await page.keyboard.press('Escape')
|
||||
}
|
||||
|
||||
export async function fillIssueForm (page: Page, props: IssueProps): Promise<void> {
|
||||
export async function fillIssueForm (page: Page, props: IssueProps, addForm: boolean): Promise<void> {
|
||||
const { name, description, status, assignee, labels, priority, component, sprint } = props
|
||||
await page.fill('[placeholder="Issue\\ title"]', name)
|
||||
const af = addForm ? 'form ' : ''
|
||||
await page.fill(af + '[placeholder="Issue\\ title"]', name)
|
||||
if (description !== undefined) {
|
||||
await page.fill('.ProseMirror', description)
|
||||
}
|
||||
if (status !== undefined) {
|
||||
await page.click('#status-editor')
|
||||
await page.click(af + '#status-editor')
|
||||
await page.click(`.menu-item:has-text("${status}")`)
|
||||
}
|
||||
if (priority !== undefined) {
|
||||
await page.click('button:has-text("No priority")')
|
||||
await page.click(af + 'button:has-text("No priority")')
|
||||
await page.click(`.selectPopup button:has-text("${priority}")`)
|
||||
}
|
||||
if (labels !== undefined) {
|
||||
await page.click('.button:has-text("Labels")')
|
||||
await page.click(af + '.button:has-text("Labels")')
|
||||
for (const label of labels) {
|
||||
await page.click(`.selectPopup button:has-text("${label}") >> nth=0`)
|
||||
}
|
||||
await page.keyboard.press('Escape')
|
||||
}
|
||||
if (assignee !== undefined) {
|
||||
await page.click('.button:has-text("Assignee")')
|
||||
await page.click(af + '.button:has-text("Assignee")')
|
||||
await page.click(`.selectPopup button:has-text("${assignee}")`)
|
||||
}
|
||||
if (component !== undefined) {
|
||||
await page.click('form button:has-text("Component")')
|
||||
await page.click(af + 'button:has-text("Component")')
|
||||
await page.click(`.selectPopup button:has-text("${component}")`)
|
||||
}
|
||||
if (sprint !== undefined) {
|
||||
await page.click('.button:has-text("No Sprint")')
|
||||
await page.click(af + '.button:has-text("No Sprint")')
|
||||
await page.click(`.selectPopup button:has-text("${sprint}")`)
|
||||
}
|
||||
}
|
||||
@ -83,8 +84,8 @@ export async function fillIssueForm (page: Page, props: IssueProps): Promise<voi
|
||||
export async function createIssue (page: Page, props: IssueProps): Promise<void> {
|
||||
await page.waitForSelector('span:has-text("Default")')
|
||||
await page.click('button:has-text("New issue")')
|
||||
await fillIssueForm(page, props)
|
||||
await page.click('button:has-text("Create issue")')
|
||||
await fillIssueForm(page, props, true)
|
||||
await page.click('form button:has-text("Create issue")')
|
||||
await page.waitForSelector('form.antiCard', { state: 'detached' })
|
||||
}
|
||||
|
||||
@ -110,7 +111,7 @@ export async function createSprint (page: Page, sprintName: string): Promise<voi
|
||||
|
||||
export async function createSubissue (page: Page, props: IssueProps): Promise<void> {
|
||||
await page.click('button:has-text("Add sub-issue")')
|
||||
await fillIssueForm(page, props)
|
||||
await fillIssueForm(page, props, false)
|
||||
await page.click('button:has-text("Save")')
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ test.use({
|
||||
test.describe('workbench tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench/sanity-ws`)
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
})
|
||||
test('navigator', async ({ page }) => {
|
||||
// Click [id="app-recruit\:string\:RecruitApplication"]
|
||||
|
Loading…
Reference in New Issue
Block a user