Update tests by removing try catch block (#5671)

Signed-off-by: Jasmin <jasmin@hardcoreeng.com>
This commit is contained in:
JasminMus 2024-05-27 18:19:28 +02:00 committed by GitHub
parent 6b48cc17a1
commit 99c5387f19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 290 additions and 295 deletions

View File

@ -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()
})
})

View File

@ -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<void> => {
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<void> => {
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<void> => {
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()
})
})

View File

@ -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()
})
})

View File

@ -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()}`,

View File

@ -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()
})
})