From 99c5387f197e67a6f125168d2555e42a982d01ea Mon Sep 17 00:00:00 2001 From: JasminMus <167111741+JasminMus@users.noreply.github.com> Date: Mon, 27 May 2024 18:19:28 +0200 Subject: [PATCH] Update tests by removing try catch block (#5671) Signed-off-by: Jasmin --- .../tests/collaborative/applications.spec.ts | 119 +++++----- .../sanity/tests/collaborative/issues.spec.ts | 208 +++++++++--------- .../tests/documents/documents-link.spec.ts | 81 ++++--- .../sanity/tests/documents/documents.spec.ts | 50 ++--- .../sanity/tests/tracker/public-link.spec.ts | 127 +++++------ 5 files changed, 290 insertions(+), 295 deletions(-) diff --git a/tests/sanity/tests/collaborative/applications.spec.ts b/tests/sanity/tests/collaborative/applications.spec.ts index 9dc092ede2..d51e02fc8c 100644 --- a/tests/sanity/tests/collaborative/applications.spec.ts +++ b/tests/sanity/tests/collaborative/applications.spec.ts @@ -5,92 +5,89 @@ import { ApplicationsPage } from '../model/recruiting/applications-page' import { ApplicationsDetailsPage } from '../model/recruiting/applications-details-page' import { TalentName } from '../model/recruiting/types' import { LeftSideMenuPage } from '../model/left-side-menu-page' -// ADDED NEW + test.use({ storageState: PlatformSetting }) test.describe('Collaborative tests for Application', () => { test.beforeEach(async ({ page }) => { - await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() + await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`) }) test.skip('Add comment from several users', async ({ page, browser }) => { const vacancyName = 'Software Engineer' let talentName: TalentName - // open second page const { page: userSecondPage, context } = await getSecondPage(browser) - try { - await test.step('User1. Add collaborators and comment from user1', async () => { - const navigationMenuPage = new NavigationMenuPage(page) - await navigationMenuPage.clickButtonApplications() + await test.step('User1. Add collaborators and comment from user1', async () => { + const navigationMenuPage = new NavigationMenuPage(page) + await navigationMenuPage.clickButtonApplications() - const applicationsPage = new ApplicationsPage(page) - talentName = await applicationsPage.createNewApplicationWithNewTalent({ - vacancy: vacancyName, - recruiterName: 'first' - }) - await applicationsPage.openApplicationByTalentName(talentName) - - const applicationsDetailsPage = new ApplicationsDetailsPage(page) - await applicationsDetailsPage.addCollaborators('Dirak Kainin') - await applicationsDetailsPage.addComment('Test Comment from user1') - await applicationsDetailsPage.checkCommentExist('Test Comment from user1') + const applicationsPage = new ApplicationsPage(page) + talentName = await applicationsPage.createNewApplicationWithNewTalent({ + vacancy: vacancyName, + recruiterName: 'first' }) + await applicationsPage.openApplicationByTalentName(talentName) - await test.step('User2. Check notification and add comment from user2', async () => { - await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() + const applicationsDetailsPage = new ApplicationsDetailsPage(page) + await applicationsDetailsPage.addCollaborators('Dirak Kainin') + await applicationsDetailsPage.addComment('Test Comment from user1') + await applicationsDetailsPage.checkCommentExist('Test Comment from user1') + }) - const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage) - await leftSideMenuPageSecond.checkExistNewNotification() - await leftSideMenuPageSecond.clickNotification() + await test.step('User2. Check notification and add comment from user2', async () => { + await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/recruit`) - // TODO: rewrite checkNotificationCollaborators and uncomment - // const notificationPageSecond = new NotificationPage(userSecondPage) - // await notificationPageSecond.checkNotificationCollaborators( - // `${talentName.lastName} ${talentName.firstName}`, - // 'You have been added to collaborators' - // ) + const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage) + await leftSideMenuPageSecond.checkExistNewNotification() + await leftSideMenuPageSecond.clickNotification() - await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() - const navigationMenuPageSecond = new NavigationMenuPage(userSecondPage) - await navigationMenuPageSecond.clickButtonApplications() + // TODO: rewrite checkNotificationCollaborators and uncomment + // const notificationPageSecond = new NotificationPage(userSecondPage) + // await notificationPageSecond.checkNotificationCollaborators( + // `${talentName.lastName} ${talentName.firstName}`, + // 'You have been added to collaborators' + // ) - const applicationsPageSecond = new ApplicationsPage(userSecondPage) - await applicationsPageSecond.openApplicationByTalentName(talentName) + await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/recruit`) + const navigationMenuPageSecond = new NavigationMenuPage(userSecondPage) + await navigationMenuPageSecond.clickButtonApplications() - const applicationsDetailsPageSecond = new ApplicationsDetailsPage(userSecondPage) - await applicationsDetailsPageSecond.checkCommentExist('Test Comment from user1') - await applicationsDetailsPageSecond.addComment('Test Comment from user2') - await applicationsDetailsPageSecond.checkCommentExist('Test Comment from user2') - }) + const applicationsPageSecond = new ApplicationsPage(userSecondPage) + await applicationsPageSecond.openApplicationByTalentName(talentName) - await test.step('User1. Check notification and check comment from user1', async () => { - const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.checkExistNewNotification() - await leftSideMenuPage.clickNotification() + const applicationsDetailsPageSecond = new ApplicationsDetailsPage(userSecondPage) + await applicationsDetailsPageSecond.checkCommentExist('Test Comment from user1') + await applicationsDetailsPageSecond.addComment('Test Comment from user2') + await applicationsDetailsPageSecond.checkCommentExist('Test Comment from user2') + }) - // TODO: rewrite checkNotificationCollaborators and uncomment - // const notificationPage = new NotificationPage(page) - // await notificationPage.checkNotificationCollaborators( - // `${talentName.lastName} ${talentName.firstName}`, - // 'left a comment' - // ) + await test.step('User1. Check notification and check comment from user1', async () => { + const leftSideMenuPage = new LeftSideMenuPage(page) + await leftSideMenuPage.checkExistNewNotification() + await leftSideMenuPage.clickNotification() - await (await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`))?.finished() - const navigationMenuPage = new NavigationMenuPage(page) - await navigationMenuPage.clickButtonApplications() + // TODO: rewrite checkNotificationCollaborators and uncomment + // const notificationPage = new NotificationPage(page) + // await notificationPage.checkNotificationCollaborators( + // `${talentName.lastName} ${talentName.firstName}`, + // 'left a comment' + // ) - const applicationsPage = new ApplicationsPage(page) - await applicationsPage.openApplicationByTalentName(talentName) + await page.goto(`${PlatformURI}/workbench/sanity-ws/recruit`) + const navigationMenuPage = new NavigationMenuPage(page) + await navigationMenuPage.clickButtonApplications() - const applicationsDetailsPage = new ApplicationsDetailsPage(page) - await applicationsDetailsPage.checkCommentExist('Test Comment from user2') - }) - } finally { - await userSecondPage.close() - await context.close() - } + const applicationsPage = new ApplicationsPage(page) + await applicationsPage.openApplicationByTalentName(talentName) + + const applicationsDetailsPage = new ApplicationsDetailsPage(page) + await applicationsDetailsPage.checkCommentExist('Test Comment from user2') + }) + + await userSecondPage.close() + await context.close() }) }) diff --git a/tests/sanity/tests/collaborative/issues.spec.ts b/tests/sanity/tests/collaborative/issues.spec.ts index 79a05be609..8ed4cb8897 100644 --- a/tests/sanity/tests/collaborative/issues.spec.ts +++ b/tests/sanity/tests/collaborative/issues.spec.ts @@ -8,7 +8,7 @@ import { generateId, getSecondPage, PlatformSetting, PlatformURI } from '../util test.use({ storageState: PlatformSetting }) -// ADDED NEW + test.describe('Collaborative test for issue', () => { let leftSideMenuPage: LeftSideMenuPage let issuesPage: IssuesPage @@ -40,39 +40,42 @@ test.describe('Collaborative test for issue', () => { // open second page const { page: userSecondPage, context } = await getSecondPage(browser) - try { - await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() - // create a new issue by first user - await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() - await leftSideMenuPage.clickTracker() - - await issuesPage.createNewIssue(newIssue) - await issuesPage.clickLinkSidebarAll() - await issuesPage.clickModelSelectorAll() - await issuesPage.searchIssueByName(newIssue.title) - await issuesPage.openIssueByName(newIssue.title) - - // check created issued by second user - const issuesPageSecond = new IssuesPage(userSecondPage) - await userSecondPage.evaluate(() => { - localStorage.setItem('platform.activity.threshold', '0') - }) - await issuesPageSecond.clickLinkSidebarAll() - await issuesPageSecond.clickModelSelectorAll() - await issuesPageSecond.searchIssueByName(newIssue.title) - await issuesPageSecond.openIssueByName(newIssue.title) - - const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage) - await issuesDetailsPageSecond.checkIssue({ - ...newIssue, - milestone: 'Milestone', - estimation: '2h' - }) - } finally { + const closePages = async (): Promise => { await userSecondPage.close() await context.close() } + + await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() + + // create a new issue by first user + await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() + await leftSideMenuPage.clickTracker() + + await issuesPage.createNewIssue(newIssue) + await issuesPage.clickLinkSidebarAll() + await issuesPage.clickModelSelectorAll() + await issuesPage.searchIssueByName(newIssue.title) + await issuesPage.openIssueByName(newIssue.title) + + // check created issued by second user + const issuesPageSecond = new IssuesPage(userSecondPage) + await userSecondPage.evaluate(() => { + localStorage.setItem('platform.activity.threshold', '0') + }) + await issuesPageSecond.clickLinkSidebarAll() + await issuesPageSecond.clickModelSelectorAll() + await issuesPageSecond.searchIssueByName(newIssue.title) + await issuesPageSecond.openIssueByName(newIssue.title) + + const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage) + await issuesDetailsPageSecond.checkIssue({ + ...newIssue, + milestone: 'Milestone', + estimation: '2h' + }) + + await closePages() }) test('Issues status can be changed by another users', async ({ page, browser }) => { @@ -84,43 +87,45 @@ test.describe('Collaborative test for issue', () => { // open second page const { page: userSecondPage, context } = await getSecondPage(browser) - try { - if (userSecondPage.url() !== `${PlatformURI}/workbench/sanity-ws/tracker/`) { - await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() - } - - const issuesPageSecond = new IssuesPage(userSecondPage) - await issuesPageSecond.clickLinkSidebarAll() - await issuesPageSecond.clickModelSelectorAll() - - // change status - await issuesPage.clickLinkSidebarAll() - await issuesPage.clickMdelSelectorBacklog() - await issuesPage.searchIssueByName(issue.title) - await issuesPage.openIssueByName(issue.title) - await issuesDetailsPage.editIssue({ status: 'In Progress' }) - - // check by another user - await issuesPageSecond.clickMdelSelectorBacklog() - // not active for another user - await issuesPageSecond.checkIssueNotExist(issue.title) - - await issuesPageSecond.clickModalSelectorActive() - await issuesPageSecond.searchIssueByName(issue.title) - await issuesPageSecond.openIssueByName(issue.title) - - const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage) - await userSecondPage.evaluate(() => { - localStorage.setItem('platform.activity.threshold', '0') - }) - await issuesDetailsPageSecond.checkIssue({ - ...issue, - status: 'In Progress' - }) - } finally { + const closePages = async (): Promise => { await userSecondPage.close() await context.close() } + + if (userSecondPage.url() !== `${PlatformURI}/workbench/sanity-ws/tracker/`) { + await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() + } + + const issuesPageSecond = new IssuesPage(userSecondPage) + await issuesPageSecond.clickLinkSidebarAll() + await issuesPageSecond.clickModelSelectorAll() + + // change status + await issuesPage.clickLinkSidebarAll() + await issuesPage.clickMdelSelectorBacklog() + await issuesPage.searchIssueByName(issue.title) + await issuesPage.openIssueByName(issue.title) + await issuesDetailsPage.editIssue({ status: 'In Progress' }) + + // check by another user + await issuesPageSecond.clickMdelSelectorBacklog() + // not active for another user + await issuesPageSecond.checkIssueNotExist(issue.title) + + await issuesPageSecond.clickModalSelectorActive() + await issuesPageSecond.searchIssueByName(issue.title) + await issuesPageSecond.openIssueByName(issue.title) + + const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage) + await userSecondPage.evaluate(() => { + localStorage.setItem('platform.activity.threshold', '0') + }) + await issuesDetailsPageSecond.checkIssue({ + ...issue, + status: 'In Progress' + }) + + await closePages() }) test('First user change assignee, second user should see assigned issue', async ({ page, browser }) => { @@ -132,45 +137,48 @@ test.describe('Collaborative test for issue', () => { // open second page const { page: userSecondPage, context } = await getSecondPage(browser) - try { - await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() - await test.step(`user1. change assignee to ${newAssignee}`, async () => { - await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() - await issuesPage.clickLinkSidebarAll() - await issuesPage.clickMdelSelectorBacklog() - await issuesPage.searchIssueByName(issue.title) - await issuesPage.openIssueByName(issue.title) - - await issuesDetailsPage.editIssue({ assignee: newAssignee }) - }) - - // TODO: rewrite checkNotificationIssue and uncomment - // await test.step('user2. check notification', async () => { - // const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage) - // await leftSideMenuPageSecond.checkExistNewNotification(userSecondPage) - // await leftSideMenuPageSecond.buttonNotification.click() - // - // const notificationPageSecond = new NotificationPage(userSecondPage) - // await notificationPageSecond.checkNotificationIssue(issue.title, newAssignee) - // - // await leftSideMenuPageSecond.clickTracker() - // }) - - await test.step('user2. check issue assignee', async () => { - const issuesPageSecond = new IssuesPage(userSecondPage) - await issuesPageSecond.clickLinkSidebarMyIssue() - await issuesPageSecond.clickMdelSelectorBacklog() - - await issuesPageSecond.searchIssueByName(issue.title) - await issuesPageSecond.openIssueByName(issue.title) - - const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage) - await issuesDetailsPageSecond.checkIssue({ ...issue }) - }) - } finally { + const closePages = async (): Promise => { await userSecondPage.close() await context.close() } + + await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() + + await test.step(`user1. change assignee to ${newAssignee}`, async () => { + await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished() + await issuesPage.clickLinkSidebarAll() + await issuesPage.clickMdelSelectorBacklog() + await issuesPage.searchIssueByName(issue.title) + await issuesPage.openIssueByName(issue.title) + + await issuesDetailsPage.editIssue({ assignee: newAssignee }) + }) + + // TODO: rewrite checkNotificationIssue and uncomment + // await test.step('user2. check notification', async () => { + // const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage) + // await leftSideMenuPageSecond.checkExistNewNotification(userSecondPage) + // await leftSideMenuPageSecond.buttonNotification.click() + // + // const notificationPageSecond = new NotificationPage(userSecondPage) + // await notificationPageSecond.checkNotificationIssue(issue.title, newAssignee) + // + // await leftSideMenuPageSecond.clickTracker() + // }) + + await test.step('user2. check issue assignee', async () => { + const issuesPageSecond = new IssuesPage(userSecondPage) + await issuesPageSecond.clickLinkSidebarMyIssue() + await issuesPageSecond.clickMdelSelectorBacklog() + + await issuesPageSecond.searchIssueByName(issue.title) + await issuesPageSecond.openIssueByName(issue.title) + + const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage) + await issuesDetailsPageSecond.checkIssue({ ...issue }) + }) + + await closePages() }) }) diff --git a/tests/sanity/tests/documents/documents-link.spec.ts b/tests/sanity/tests/documents/documents-link.spec.ts index 40c06b8835..a9622fedc4 100644 --- a/tests/sanity/tests/documents/documents-link.spec.ts +++ b/tests/sanity/tests/documents/documents-link.spec.ts @@ -12,59 +12,54 @@ test.describe('Documents link tests', () => { title: `Document Public link revoke-${generateId()}`, space: 'Default' } - // ADDED NEW + const newContext = await browser.newContext({ storageState: PlatformSetting }) const page = await newContext.newPage() - try { - await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() - const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.clickDocuments() + await page.goto(`${PlatformURI}/workbench/sanity-ws`) - const documentsPage = new DocumentsPage(page) - await documentsPage.clickOnButtonCreateDocument() + const leftSideMenuPage = new LeftSideMenuPage(page) + await leftSideMenuPage.clickDocuments() - await documentsPage.createDocument(publicLinkDocument) - await documentsPage.openDocument(publicLinkDocument.title) + const documentsPage = new DocumentsPage(page) + await documentsPage.clickOnButtonCreateDocument() + await documentsPage.createDocument(publicLinkDocument) + await documentsPage.openDocument(publicLinkDocument.title) - const documentContentPage = new DocumentContentPage(page) - await documentContentPage.executeMoreAction('Public link') + const documentContentPage = new DocumentContentPage(page) + await documentContentPage.executeMoreAction('Public link') - // remove after UBERF-5994 fixed - await documentContentPage.closePopup() - await page.reload({ waitUntil: 'commit' }) - await documentContentPage.executeMoreAction('Public link') + // remove after UBERF-5994 fixed + await documentContentPage.closePopup() + await page.reload({ waitUntil: 'commit' }) + await documentContentPage.executeMoreAction('Public link') + const publicLinkPopup = new PublicLinkPopup(page) + const link = await publicLinkPopup.getPublicLink() + + const clearSession = await browser.newContext() + const clearPage = await clearSession.newPage() + + await test.step('Check guest access to the document', async () => { + await clearPage.goto(link) + const documentContentClearPage = new DocumentContentPage(clearPage) + await documentContentClearPage.checkDocumentTitle(publicLinkDocument.title) + expect(clearPage.url()).toContain('guest') + }) + + await test.step('Revoke guest access to the document', async () => { const publicLinkPopup = new PublicLinkPopup(page) - const link = await publicLinkPopup.getPublicLink() + await publicLinkPopup.revokePublicLink() + }) - const clearSession = await browser.newContext() - const clearPage = await clearSession.newPage() - try { - await test.step('Check guest access to the document', async () => { - await clearPage.goto(link) + await test.step('Check guest access to the document after the revoke', async () => { + await clearPage.goto(link) + await expect(clearPage.locator('div.antiPopup > h1')).toHaveText('Public link was revoked') + }) - const documentContentClearPage = new DocumentContentPage(clearPage) - await documentContentClearPage.checkDocumentTitle(publicLinkDocument.title) - expect(clearPage.url()).toContain('guest') - }) - - await test.step('Revoke guest access to the document', async () => { - const publicLinkPopup = new PublicLinkPopup(page) - await publicLinkPopup.revokePublicLink() - }) - - await test.step('Check guest access to the document after the revoke', async () => { - await clearPage.goto(link) - await expect(clearPage.locator('div.antiPopup > h1')).toHaveText('Public link was revoked') - }) - } finally { - await clearPage.close() - await clearSession.close() - } - } finally { - await page.close() - await newContext.close() - } + await clearPage.close() + await clearSession.close() + await page.close() + await newContext.close() }) }) diff --git a/tests/sanity/tests/documents/documents.spec.ts b/tests/sanity/tests/documents/documents.spec.ts index 71d930d673..c2b2099575 100644 --- a/tests/sanity/tests/documents/documents.spec.ts +++ b/tests/sanity/tests/documents/documents.spec.ts @@ -8,7 +8,7 @@ import { DocumentContentPage } from '../model/documents/document-content-page' test.use({ storageState: PlatformSetting }) -// ADDED NEW + test.describe('Documents tests', () => { let leftSideMenuPage: LeftSideMenuPage let documentsPage: DocumentsPage @@ -19,7 +19,7 @@ test.describe('Documents tests', () => { documentsPage = new DocumentsPage(page) documentContentPage = new DocumentContentPage(page) - await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() + await page.goto(`${PlatformURI}/workbench/sanity-ws`) }) test('Create a document', async () => { @@ -35,7 +35,7 @@ test.describe('Documents tests', () => { await documentContentPage.checkDocumentTitle(newDocument.title) }) - test('Edit document', async ({ page }) => { + test('Edit document', async () => { const contentOne = ' * Text first line' const contentTwo = ' * Text second line' const newDocumentTitle = `Edit Updated Document Title-${generateId()}` @@ -43,11 +43,13 @@ test.describe('Documents tests', () => { title: `Edit Document Title-${generateId()}`, space: 'Default' } + await leftSideMenuPage.clickDocuments() await documentsPage.clickOnButtonCreateDocument() await documentsPage.createDocument(editDocument) await documentsPage.openDocument(editDocument.title) await documentContentPage.checkDocumentTitle(editDocument.title) + let content = await documentContentPage.addContentToTheNewLine(contentOne) await documentContentPage.checkContent(content) content = await documentContentPage.addContentToTheNewLine(contentTwo) @@ -56,7 +58,7 @@ test.describe('Documents tests', () => { await documentContentPage.checkDocumentTitle(newDocumentTitle) }) - test('Move document', async ({ page }) => { + test('Move document', async () => { const contentFirst = 'Text first line' const moveDocument: NewDocument = { title: `Move Document Title-${generateId()}`, @@ -85,12 +87,12 @@ test.describe('Documents tests', () => { await documentContentPage.checkDocumentTitle(moveDocument.title) }) - test('Collarabotive edit document content', async ({ page, browser }) => { + test('Collaborative edit document content', async ({ page, browser }) => { let content = '' - const contentFirstUser = 'First first!!! This string come from from the first user' - const contentSecondUser = 'Second second!!! This string come from from the second user' + const contentFirstUser = 'First first!!! This string comes from the first user' + const contentSecondUser = 'Second second!!! This string comes from the second user' const colDocument: NewDocument = { - title: `Collarabotive edit Title-${generateId()}`, + title: `Collaborative edit Title-${generateId()}`, space: 'Default' } @@ -107,23 +109,21 @@ test.describe('Documents tests', () => { await test.step('User2. Add content second user', async () => { const { page: userSecondPage, context } = await getSecondPage(browser) - try { - await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() - const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage) - await leftSideMenuPageSecond.clickDocuments() - const documentsPageSecond = new DocumentsPage(userSecondPage) - await documentsPageSecond.openTeamspace(colDocument.space) - await documentsPageSecond.openDocument(colDocument.title) - const documentContentPageSecond = new DocumentContentPage(page) - await documentContentPageSecond.checkDocumentTitle(colDocument.title) - await documentContentPageSecond.checkContent(content) - content = await documentContentPageSecond.addContentToTheNewLine(contentSecondUser) - await documentContentPageSecond.checkContent(content) - } finally { - await userSecondPage.close() - await context.close() - } + await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws`) + const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage) + await leftSideMenuPageSecond.clickDocuments() + const documentsPageSecond = new DocumentsPage(userSecondPage) + await documentsPageSecond.openTeamspace(colDocument.space) + await documentsPageSecond.openDocument(colDocument.title) + const documentContentPageSecond = new DocumentContentPage(userSecondPage) + await documentContentPageSecond.checkDocumentTitle(colDocument.title) + await documentContentPageSecond.checkContent(content) + content = await documentContentPageSecond.addContentToTheNewLine(contentSecondUser) + await documentContentPageSecond.checkContent(content) + + await userSecondPage.close() + await context.close() }) await test.step('User1. Check final content', async () => { @@ -132,7 +132,7 @@ test.describe('Documents tests', () => { }) }) - test('Add Link to the Document', async ({ page }) => { + test('Add Link to the Document', async () => { const contentLink = 'Lineforthelink' const linkDocument: NewDocument = { title: `Links Document Title-${generateId()}`, diff --git a/tests/sanity/tests/tracker/public-link.spec.ts b/tests/sanity/tests/tracker/public-link.spec.ts index 2dde2c86fd..6bf76399a4 100644 --- a/tests/sanity/tests/tracker/public-link.spec.ts +++ b/tests/sanity/tests/tracker/public-link.spec.ts @@ -17,22 +17,21 @@ test.describe('Tracker public link issues tests', () => { await test.step('Get public link from popup', async () => { const newContext = await browser.newContext({ storageState: PlatformSetting }) const page = await newContext.newPage() - try { - await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() - const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.clickTracker() - await prepareNewIssueWithOpenStep(page, publicLinkIssue) + await page.goto(`${PlatformURI}/workbench/sanity-ws`) - const issuesDetailsPage = new IssuesDetailsPage(page) - await issuesDetailsPage.moreActionOnIssue('Public link') + const leftSideMenuPage = new LeftSideMenuPage(page) + await leftSideMenuPage.clickTracker() + await prepareNewIssueWithOpenStep(page, publicLinkIssue) - const publicLinkPopup = new PublicLinkPopup(page) - link = await publicLinkPopup.getPublicLink() - } finally { - await page.close() - await newContext.close() - } + const issuesDetailsPage = new IssuesDetailsPage(page) + await issuesDetailsPage.moreActionOnIssue('Public link') + + const publicLinkPopup = new PublicLinkPopup(page) + link = await publicLinkPopup.getPublicLink() + + await page.close() + await newContext.close() }) await test.step('Check guest access to the issue', async () => { @@ -41,20 +40,19 @@ test.describe('Tracker public link issues tests', () => { await clearSession.clearPermissions() const clearPage = await clearSession.newPage() - try { - await clearPage.goto(link) - const clearIssuesDetailsPage = new IssuesDetailsPage(clearPage) - await clearIssuesDetailsPage.waitDetailsOpened(publicLinkIssue.title) - await clearIssuesDetailsPage.checkIssue({ - ...publicLinkIssue, - status: 'Backlog' - }) - expect(clearPage.url()).toContain('guest') - } finally { - await clearPage.close() - await clearSession.close() - } + await clearPage.goto(link) + + const clearIssuesDetailsPage = new IssuesDetailsPage(clearPage) + await clearIssuesDetailsPage.waitDetailsOpened(publicLinkIssue.title) + await clearIssuesDetailsPage.checkIssue({ + ...publicLinkIssue, + status: 'Backlog' + }) + expect(clearPage.url()).toContain('guest') + + await clearPage.close() + await clearSession.close() }) }) @@ -67,52 +65,49 @@ test.describe('Tracker public link issues tests', () => { const newContext = await browser.newContext({ storageState: PlatformSetting }) const page = await newContext.newPage() let link: string - try { - await test.step('Get public link from popup', async () => { - await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished() - const leftSideMenuPage = new LeftSideMenuPage(page) - await leftSideMenuPage.clickTracker() - await prepareNewIssueWithOpenStep(page, publicLinkIssue) + await test.step('Get public link from popup', async () => { + await page.goto(`${PlatformURI}/workbench/sanity-ws`) - const issuesDetailsPage = new IssuesDetailsPage(page) - await issuesDetailsPage.moreActionOnIssue('Public link') + const leftSideMenuPage = new LeftSideMenuPage(page) + await leftSideMenuPage.clickTracker() + await prepareNewIssueWithOpenStep(page, publicLinkIssue) - const publicLinkPopup = new PublicLinkPopup(page) - link = await publicLinkPopup.getPublicLink() + const issuesDetailsPage = new IssuesDetailsPage(page) + await issuesDetailsPage.moreActionOnIssue('Public link') + + const publicLinkPopup = new PublicLinkPopup(page) + link = await publicLinkPopup.getPublicLink() + }) + + const clearSession = await browser.newContext() + const clearPage = await clearSession.newPage() + + await test.step('Check guest access to the issue', async () => { + await clearPage.goto(link) + + const clearIssuesDetailsPage = new IssuesDetailsPage(clearPage) + await clearIssuesDetailsPage.waitDetailsOpened(publicLinkIssue.title) + await clearIssuesDetailsPage.checkIssue({ + ...publicLinkIssue, + status: 'Backlog' }) + expect(clearPage.url()).toContain('guest') + }) - const clearSession = await browser.newContext() - const clearPage = await clearSession.newPage() - try { - await test.step('Check guest access to the issue', async () => { - await clearPage.goto(link) + await test.step('Revoke guest access to the issue', async () => { + const publicLinkPopup = new PublicLinkPopup(page) + await publicLinkPopup.revokePublicLink() + }) - const clearIssuesDetailsPage = new IssuesDetailsPage(clearPage) - await clearIssuesDetailsPage.waitDetailsOpened(publicLinkIssue.title) - await clearIssuesDetailsPage.checkIssue({ - ...publicLinkIssue, - status: 'Backlog' - }) - expect(clearPage.url()).toContain('guest') - }) + await test.step('Check guest access to the issue after the revoke', async () => { + await clearPage.goto(link) + await expect(clearPage.locator('div.antiPopup > h1')).toHaveText('Public link was revoked') + }) - await test.step('Revoke guest access to the issue', async () => { - const publicLinkPopup = new PublicLinkPopup(page) - await publicLinkPopup.revokePublicLink() - }) - - await test.step('Check guest access to the issue after the revoke', async () => { - await clearPage.goto(link) - await expect(clearPage.locator('div.antiPopup > h1')).toHaveText('Public link was revoked') - }) - } finally { - await clearPage.close() - await clearSession.close() - } - } finally { - await page.close() - await newContext.close() - } + await clearPage.close() + await clearSession.close() + await page.close() + await newContext.close() }) })