Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TESTS-221: feat(tests): done Document public link revoke test #4940

Merged
merged 6 commits into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions tests/sanity/tests/documents/documents-link.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { expect, test } from '@playwright/test'
import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { NewDocument } from '../model/documents/types'
import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { DocumentsPage } from '../model/documents/documents-page'
import { DocumentContentPage } from '../model/documents/document-content-page'
import { PublicLinkPopup } from '../model/tracker/public-link-popup'

test.describe('Documents link tests', () => {
test('Document public link revoke', async ({ browser }) => {
const publicLinkDocument: NewDocument = {
title: `Document Public link revoke-${generateId()}`,
space: 'Default'
}

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.buttonDocuments.click()

const documentsPage = new DocumentsPage(page)
await documentsPage.buttonCreateDocument.click()

await documentsPage.createDocument(publicLinkDocument)
await documentsPage.openDocument(publicLinkDocument.title)

const documentContentPage = new DocumentContentPage(page)
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)
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')
})
})
})