mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 11:50:56 +00:00
TESTS-216: feat(tests): done Public link generate test (#4915)
Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
parent
2d266bb3fd
commit
e44300c1c5
25
tests/sanity/tests/model/tracker/public-link-popup.ts
Normal file
25
tests/sanity/tests/model/tracker/public-link-popup.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { IssuesPage } from './issues-page'
|
||||
import { type Locator, type Page, expect } from '@playwright/test'
|
||||
|
||||
export class PublicLinkPopup extends IssuesPage {
|
||||
readonly page: Page
|
||||
readonly textPublicLink: Locator
|
||||
readonly buttonRevoke: Locator
|
||||
readonly buttonCopy: Locator
|
||||
readonly buttonClose: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super(page)
|
||||
this.page = page
|
||||
this.textPublicLink = page.locator('form[id="guest:string:PublicLink"] div.link')
|
||||
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' })
|
||||
}
|
||||
|
||||
async getPublicLink (): Promise<string> {
|
||||
const link = await this.textPublicLink.textContent()
|
||||
expect(link).toContain('http')
|
||||
return link ?? ''
|
||||
}
|
||||
}
|
50
tests/sanity/tests/tracker/public-link.spec.ts
Normal file
50
tests/sanity/tests/tracker/public-link.spec.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
import { generateId, PlatformSetting, PlatformURI } from '../utils'
|
||||
import { LeftSideMenuPage } from '../model/left-side-menu-page'
|
||||
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
|
||||
import { NewIssue } from '../model/tracker/types'
|
||||
import { prepareNewIssueWithOpenStep } from './common-steps'
|
||||
import { PublicLinkPopup } from '../model/tracker/public-link-popup'
|
||||
|
||||
test.describe('Tracker public link issues tests', () => {
|
||||
test('Public link generate', async ({ browser }) => {
|
||||
const publicLinkIssue: NewIssue = {
|
||||
title: `Public link generate issue-${generateId()}`,
|
||||
description: 'Public link generate issue'
|
||||
}
|
||||
|
||||
let link: string
|
||||
await test.step('Get public link from popup', async () => {
|
||||
const newContext = await browser.newContext({ storageState: PlatformSetting })
|
||||
const page = await newContext.newPage()
|
||||
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()
|
||||
})
|
||||
|
||||
await test.step('Check guest access to the issue', async () => {
|
||||
const clearSession = await browser.newContext()
|
||||
await clearSession.clearCookies()
|
||||
await clearSession.clearPermissions()
|
||||
|
||||
const clearPage = await clearSession.newPage()
|
||||
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')
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user