diff --git a/plugins/setting-resources/src/components/Profile.svelte b/plugins/setting-resources/src/components/Profile.svelte index eebbd2abc2..b1cbd9646e 100644 --- a/plugins/setting-resources/src/components/Profile.svelte +++ b/plugins/setting-resources/src/components/Profile.svelte @@ -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 ?? '' diff --git a/server/middleware/src/spaceSecurity.ts b/server/middleware/src/spaceSecurity.ts index c2b92b85c5..d70230d9ee 100644 --- a/server/middleware/src/spaceSecurity.ts +++ b/server/middleware/src/spaceSecurity.ts @@ -270,11 +270,14 @@ export class SpaceSecurityMiddleware extends BaseMiddleware implements Middlewar query: ObjQueryType ): Promise> { 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 diff --git a/tests/sanity/tests/actions.spec.ts b/tests/sanity/tests/actions.spec.ts index e58b2d5193..d83595389d 100644 --- a/tests/sanity/tests/actions.spec.ts +++ b/tests/sanity/tests/actions.spec.ts @@ -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"]') diff --git a/tests/sanity/tests/login.spec.ts b/tests/sanity/tests/login.spec.ts index 0e214afdb4..1777fb5fe9 100644 --- a/tests/sanity/tests/login.spec.ts +++ b/tests/sanity/tests/login.spec.ts @@ -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() diff --git a/tests/sanity/tests/recruit.spec.ts b/tests/sanity/tests/recruit.spec.ts index 89432b4e03..373a906fec 100644 --- a/tests/sanity/tests/recruit.spec.ts +++ b/tests/sanity/tests/recruit.spec.ts @@ -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' }) diff --git a/tests/sanity/tests/settings.spec.ts b/tests/sanity/tests/settings.spec.ts index 40b9f04cf0..2f4bfb7aee 100644 --- a/tests/sanity/tests/settings.spec.ts +++ b/tests/sanity/tests/settings.spec.ts @@ -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') diff --git a/tests/sanity/tests/tags.spec.ts b/tests/sanity/tests/tags.spec.ts index dbb8670149..d6c1ccacb6 100644 --- a/tests/sanity/tests/tags.spec.ts +++ b/tests/sanity/tests/tags.spec.ts @@ -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`) diff --git a/tests/sanity/tests/tracker.utils.ts b/tests/sanity/tests/tracker.utils.ts index 03e103c40f..f40629c507 100644 --- a/tests/sanity/tests/tracker.utils.ts +++ b/tests/sanity/tests/tracker.utils.ts @@ -45,37 +45,38 @@ export async function setViewOrder (page: Page, orderName: string): Promise { +export async function fillIssueForm (page: Page, props: IssueProps, addForm: boolean): Promise { 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 { 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 { 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")') } diff --git a/tests/sanity/tests/workbench.spec.ts b/tests/sanity/tests/workbench.spec.ts index 83b5832007..a3faeefcc4 100644 --- a/tests/sanity/tests/workbench.spec.ts +++ b/tests/sanity/tests/workbench.spec.ts @@ -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"]