TESTS-217: feat(test): done Public link Revoke test (#4926)

Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
Alex Velichko 2024-03-13 08:45:45 +03:00 committed by GitHub
parent dc81ccfdb0
commit 45475bb2dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 55 additions and 0 deletions

View File

@ -7,6 +7,7 @@ export class PublicLinkPopup extends IssuesPage {
readonly buttonRevoke: Locator
readonly buttonCopy: Locator
readonly buttonClose: Locator
readonly buttonOk: Locator
constructor (page: Page) {
super(page)
@ -15,6 +16,7 @@ export class PublicLinkPopup extends IssuesPage {
this.buttonRevoke = page.locator('form[id="guest:string:PublicLink"] button', { hasText: 'Revoke' })
this.buttonCopy = page.locator('form[id="guest:string:PublicLink"] button', { hasText: 'Copy' })
this.buttonClose = page.locator('form[id="guest:string:PublicLink"] button', { hasText: 'Close' })
this.buttonOk = page.locator('div.popup button[type="submit"]', { hasText: 'Ok' })
}
async getPublicLink (): Promise<string> {
@ -22,4 +24,9 @@ export class PublicLinkPopup extends IssuesPage {
expect(link).toContain('http')
return link ?? ''
}
async revokePublicLink (): Promise<void> {
await this.buttonRevoke.click()
await this.buttonOk.click()
}
}

View File

@ -47,4 +47,52 @@ test.describe('Tracker public link issues tests', () => {
expect(clearPage.url()).toContain('guest')
})
})
test('Public link Revoke', async ({ browser }) => {
const publicLinkIssue: NewIssue = {
title: `Public link Revoke issue-${generateId()}`,
description: 'Public link Revoke issue'
}
const newContext = await browser.newContext({ storageState: PlatformSetting })
const page = await newContext.newPage()
let link: string
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.buttonTracker.click()
await prepareNewIssueWithOpenStep(page, publicLinkIssue)
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')
})
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')
})
})
})