platform/tests/sanity/tests/model/tracker/public-link-popup.ts
JasminMus ecf0f9d75a
Refactor pages (#5424)
Signed-off-by: Jasmin <jasmin@hardcoreeng.com>
2024-04-23 12:42:39 +07:00

22 lines
986 B
TypeScript

import { IssuesPage } from './issues-page'
import { type Locator, expect } from '@playwright/test'
export class PublicLinkPopup extends IssuesPage {
textPublicLink = (): Locator => this.page.locator('form[id="guest:string:PublicLink"] div.link')
buttonRevoke = (): Locator => this.page.locator('form[id="guest:string:PublicLink"] button', { hasText: 'Revoke' })
buttonCopy = (): Locator => this.page.locator('form[id="guest:string:PublicLink"] button', { hasText: 'Copy' })
buttonClose = (): Locator => this.page.locator('form[id="guest:string:PublicLink"] button', { hasText: 'Close' })
buttonOk = (): Locator => this.page.locator('div.popup button[type="submit"]', { hasText: 'Ok' })
async getPublicLink (): Promise<string> {
const link = await this.textPublicLink().textContent()
expect(link).toContain('http')
return link ?? ''
}
async revokePublicLink (): Promise<void> {
await this.buttonRevoke().click()
await this.buttonOk().click()
}
}