mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-08 21:27:45 +03:00
feat(tests): added documents tests (#4843)
Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
parent
b684f5c138
commit
94f1b86957
BIN
tests/sanity-ws/000006/_migrations-1709234348850-0.snp.gz
Normal file
BIN
tests/sanity-ws/000006/_migrations-1709234348850-0.snp.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/_migrations-data-1709234348850-1.tar.gz
Normal file
BIN
tests/sanity-ws/000006/_migrations-data-1709234348850-1.tar.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/activity-1709234348850-0.snp.gz
Normal file
BIN
tests/sanity-ws/000006/activity-1709234348850-0.snp.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/activity-data-1709234348850-1.tar.gz
Normal file
BIN
tests/sanity-ws/000006/activity-data-1709234348850-1.tar.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/doc-index-state-1709234348850-0.snp.gz
Normal file
BIN
tests/sanity-ws/000006/doc-index-state-1709234348850-0.snp.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
tests/sanity-ws/000006/fulltext-blob-1709234348850-0.snp.gz
Normal file
BIN
tests/sanity-ws/000006/fulltext-blob-1709234348850-0.snp.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/fulltext-blob-data-1709234348850-1.tar.gz
Normal file
BIN
tests/sanity-ws/000006/fulltext-blob-data-1709234348850-1.tar.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/notification-1709234348850-0.snp.gz
Normal file
BIN
tests/sanity-ws/000006/notification-1709234348850-0.snp.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/notification-data-1709234348850-1.tar.gz
Normal file
BIN
tests/sanity-ws/000006/notification-data-1709234348850-1.tar.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/space-1709234348850-0.snp.gz
Normal file
BIN
tests/sanity-ws/000006/space-1709234348850-0.snp.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/space-data-1709234348850-1.tar.gz
Normal file
BIN
tests/sanity-ws/000006/space-data-1709234348850-1.tar.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/status-1709234348850-0.snp.gz
Normal file
BIN
tests/sanity-ws/000006/status-1709234348850-0.snp.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/status-data-1709234348850-1.tar.gz
Normal file
BIN
tests/sanity-ws/000006/status-data-1709234348850-1.tar.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/task-1709234348850-0.snp.gz
Normal file
BIN
tests/sanity-ws/000006/task-1709234348850-0.snp.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/task-data-1709234348850-1.tar.gz
Normal file
BIN
tests/sanity-ws/000006/task-data-1709234348850-1.tar.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/tx-1709234348850-0.snp.gz
Normal file
BIN
tests/sanity-ws/000006/tx-1709234348850-0.snp.gz
Normal file
Binary file not shown.
BIN
tests/sanity-ws/000006/tx-data-1709234348850-1.tar.gz
Normal file
BIN
tests/sanity-ws/000006/tx-data-1709234348850-1.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
184
tests/sanity/tests/documents/documents.spec.ts
Normal file
184
tests/sanity/tests/documents/documents.spec.ts
Normal file
@ -0,0 +1,184 @@
|
||||
import { test } from '@playwright/test'
|
||||
import { generateId, getSecondPage, PlatformSetting, PlatformURI } from '../utils'
|
||||
import { NewDocument, NewTeamspace } 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'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
})
|
||||
|
||||
test.describe('Documents tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
})
|
||||
|
||||
test('Create a document', async ({ page }) => {
|
||||
const newDocument: NewDocument = {
|
||||
title: `New Document-${generateId()}`,
|
||||
space: 'Default'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonDocuments.click()
|
||||
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
await documentsPage.buttonCreateDocument.click()
|
||||
|
||||
await documentsPage.createDocument(newDocument)
|
||||
await documentsPage.openDocument(newDocument.title)
|
||||
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
await documentContentPage.checkDocumentTitle(newDocument.title)
|
||||
})
|
||||
|
||||
test('Edit document', async ({ page }) => {
|
||||
const contentOne = ' * Text first line'
|
||||
const contentTwo = ' * Text second line'
|
||||
const newDocumentTitle = `Edit Updated Document Title-${generateId()}`
|
||||
const editDocument: NewDocument = {
|
||||
title: `Edit Document Title-${generateId()}`,
|
||||
space: 'Default'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonDocuments.click()
|
||||
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
await documentsPage.buttonCreateDocument.click()
|
||||
|
||||
await documentsPage.createDocument(editDocument)
|
||||
await documentsPage.openDocument(editDocument.title)
|
||||
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
await documentContentPage.checkDocumentTitle(editDocument.title)
|
||||
|
||||
let content = await documentContentPage.addContentToTheNewLine(contentOne)
|
||||
await documentContentPage.checkContent(content)
|
||||
|
||||
content = await documentContentPage.addContentToTheNewLine(contentTwo)
|
||||
await documentContentPage.checkContent(content)
|
||||
|
||||
await documentContentPage.updateDocumentTitle(newDocumentTitle)
|
||||
await documentContentPage.checkDocumentTitle(newDocumentTitle)
|
||||
})
|
||||
|
||||
test('Move document', async ({ page }) => {
|
||||
const contentFirst = 'Text first line'
|
||||
const moveDocument: NewDocument = {
|
||||
title: `Move Document Title-${generateId()}`,
|
||||
space: 'Default'
|
||||
}
|
||||
const moveTeamspace: NewTeamspace = {
|
||||
title: `Move Teamspace-${generateId()}`,
|
||||
description: 'Move Teamspace description',
|
||||
private: false
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonDocuments.click()
|
||||
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
await documentsPage.checkTeamspaceNotExist(moveTeamspace.title)
|
||||
await documentsPage.createNewTeamspace(moveTeamspace)
|
||||
await documentsPage.checkTeamspaceExist(moveTeamspace.title)
|
||||
await documentsPage.buttonCreateDocument.click()
|
||||
|
||||
await documentsPage.createDocument(moveDocument)
|
||||
await documentsPage.openDocument(moveDocument.title)
|
||||
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
await documentContentPage.checkDocumentTitle(moveDocument.title)
|
||||
|
||||
const content = await documentContentPage.addContentToTheNewLine(contentFirst)
|
||||
await documentContentPage.checkContent(content)
|
||||
|
||||
await documentsPage.moreActionsOnDocument(moveDocument.title, 'Move')
|
||||
await documentsPage.fillMoveDocumentForm(moveTeamspace.title)
|
||||
|
||||
await documentsPage.openTeamspace(moveTeamspace.title)
|
||||
await documentsPage.openDocumentForTeamspace(moveTeamspace.title, moveDocument.title)
|
||||
await documentContentPage.checkDocumentTitle(moveDocument.title)
|
||||
})
|
||||
|
||||
test('Collarabotive 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 colDocument: NewDocument = {
|
||||
title: `Collarabotive edit Title-${generateId()}`,
|
||||
space: 'Default'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonDocuments.click()
|
||||
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
await documentsPage.openTeamspace(colDocument.space)
|
||||
await documentsPage.buttonCreateDocument.click()
|
||||
|
||||
await documentsPage.createDocument(colDocument)
|
||||
await documentsPage.openDocument(colDocument.title)
|
||||
|
||||
await test.step('User1. Add content first user', async () => {
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
await documentContentPage.checkDocumentTitle(colDocument.title)
|
||||
|
||||
content = await documentContentPage.addContentToTheNewLine(contentFirstUser)
|
||||
await documentContentPage.checkContent(content)
|
||||
})
|
||||
|
||||
await test.step('User2. Add content second user', async () => {
|
||||
const userSecondPage = await getSecondPage(browser)
|
||||
await (await userSecondPage.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
|
||||
const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage)
|
||||
await leftSideMenuPageSecond.buttonDocuments.click()
|
||||
|
||||
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)
|
||||
})
|
||||
|
||||
await test.step('User1. Check final content', async () => {
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
await documentContentPage.checkDocumentTitle(colDocument.title)
|
||||
await documentContentPage.checkContent(content)
|
||||
})
|
||||
})
|
||||
|
||||
test('Add Link to the Document', async ({ page }) => {
|
||||
const contentLink = 'Lineforthelink'
|
||||
const linkDocument: NewDocument = {
|
||||
title: `Links Document Title-${generateId()}`,
|
||||
space: 'Default'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonDocuments.click()
|
||||
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
await documentsPage.buttonCreateDocument.click()
|
||||
|
||||
await documentsPage.createDocument(linkDocument)
|
||||
await documentsPage.openDocument(linkDocument.title)
|
||||
|
||||
const documentContentPage = new DocumentContentPage(page)
|
||||
await documentContentPage.checkDocumentTitle(linkDocument.title)
|
||||
|
||||
await documentContentPage.addRandomLines(5)
|
||||
await documentContentPage.addContentToTheNewLine(contentLink)
|
||||
await documentContentPage.addRandomLines(5)
|
||||
|
||||
await documentContentPage.addLinkToText(contentLink, 'test/link/123456')
|
||||
await documentContentPage.checkLinkInTheText(contentLink, 'test/link/123456')
|
||||
})
|
||||
})
|
76
tests/sanity/tests/documents/teamspace.spec.ts
Normal file
76
tests/sanity/tests/documents/teamspace.spec.ts
Normal file
@ -0,0 +1,76 @@
|
||||
import { test } from '@playwright/test'
|
||||
import { generateId, PlatformSetting, PlatformURI } from '../utils'
|
||||
import { NewTeamspace } from '../model/documents/types'
|
||||
import { LeftSideMenuPage } from '../model/left-side-menu-page'
|
||||
import { DocumentsPage } from '../model/documents/documents-page'
|
||||
|
||||
test.use({
|
||||
storageState: PlatformSetting
|
||||
})
|
||||
|
||||
test.describe('Teamspace tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
})
|
||||
|
||||
test('Create a teamspace', async ({ page }) => {
|
||||
const newTeamspace: NewTeamspace = {
|
||||
title: `New Teamspace-${generateId()}`,
|
||||
description: 'New Teamspace description',
|
||||
private: false
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonDocuments.click()
|
||||
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
await documentsPage.checkTeamspaceNotExist(newTeamspace.title)
|
||||
await documentsPage.createNewTeamspace(newTeamspace)
|
||||
await documentsPage.checkTeamspaceExist(newTeamspace.title)
|
||||
})
|
||||
|
||||
test('Archive teamspace', async ({ page }) => {
|
||||
const archiveTeamspace: NewTeamspace = {
|
||||
title: 'Teamspace for archive'
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonDocuments.click()
|
||||
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
await documentsPage.checkTeamspaceExist(archiveTeamspace.title)
|
||||
|
||||
await documentsPage.moreActionTeamspace(archiveTeamspace.title, 'Archive')
|
||||
await documentsPage.pressYesForPopup(page)
|
||||
|
||||
await documentsPage.checkTeamspaceNotExist(archiveTeamspace.title)
|
||||
})
|
||||
|
||||
test('Edit teamspace', async ({ page }) => {
|
||||
const editTeamspace: NewTeamspace = {
|
||||
title: `Edit Teamspace-${generateId()}`,
|
||||
description: 'Edit Teamspace description',
|
||||
private: false
|
||||
}
|
||||
const updateEditTeamspace: NewTeamspace = {
|
||||
title: `Edit Updated Teamspace-${generateId()}`,
|
||||
description: 'Edit Updated Teamspace description',
|
||||
private: false
|
||||
}
|
||||
|
||||
const leftSideMenuPage = new LeftSideMenuPage(page)
|
||||
await leftSideMenuPage.buttonDocuments.click()
|
||||
|
||||
const documentsPage = new DocumentsPage(page)
|
||||
await documentsPage.checkTeamspaceNotExist(editTeamspace.title)
|
||||
await documentsPage.createNewTeamspace(editTeamspace)
|
||||
await documentsPage.checkTeamspaceExist(editTeamspace.title)
|
||||
|
||||
await documentsPage.moreActionTeamspace(editTeamspace.title, 'Edit teamspace')
|
||||
|
||||
await documentsPage.editTeamspace(updateEditTeamspace)
|
||||
|
||||
await documentsPage.moreActionTeamspace(updateEditTeamspace.title, 'Edit teamspace')
|
||||
await documentsPage.checkTeamspace(updateEditTeamspace)
|
||||
})
|
||||
})
|
71
tests/sanity/tests/model/documents/document-content-page.ts
Normal file
71
tests/sanity/tests/model/documents/document-content-page.ts
Normal file
@ -0,0 +1,71 @@
|
||||
import { type Locator, type Page, expect } from '@playwright/test'
|
||||
import { CommonPage } from '../common-page'
|
||||
|
||||
export class DocumentContentPage extends CommonPage {
|
||||
readonly page: Page
|
||||
readonly buttonDocumentTitle: Locator
|
||||
readonly inputContent: Locator
|
||||
readonly buttonToolbarLink: Locator
|
||||
readonly inputFormLink: Locator
|
||||
readonly buttonFormLinkSave: Locator
|
||||
readonly buttonMoreActions: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
this.page = page
|
||||
this.buttonDocumentTitle = page.locator('div[class*="main-content"] div.title input')
|
||||
this.inputContent = page.locator('div.textInput div.tiptap')
|
||||
this.buttonToolbarLink = page.locator('div.text-editor-toolbar button:nth-child(10)')
|
||||
this.inputFormLink = page.locator('form[id="text-editor:string:Link"] input')
|
||||
this.buttonFormLinkSave = page.locator('form[id="text-editor:string:Link"] button[type="submit"]')
|
||||
this.buttonMoreActions = page.locator('div.popupPanel-title button:first-child')
|
||||
}
|
||||
|
||||
async checkDocumentTitle (title: string): Promise<void> {
|
||||
await expect(this.buttonDocumentTitle).toHaveValue(title)
|
||||
}
|
||||
|
||||
async addContentToTheNewLine (newContent: string): Promise<string> {
|
||||
await this.inputContent.pressSequentially(`\n${newContent}`)
|
||||
const endContent = await this.inputContent.textContent()
|
||||
if (endContent == null) {
|
||||
return ''
|
||||
} else {
|
||||
return endContent
|
||||
}
|
||||
}
|
||||
|
||||
async checkContent (content: string): Promise<void> {
|
||||
await expect(this.inputContent).toHaveText(content)
|
||||
}
|
||||
|
||||
async updateDocumentTitle (title: string): Promise<void> {
|
||||
await this.buttonDocumentTitle.fill(title)
|
||||
}
|
||||
|
||||
async addRandomLines (count: number, lineLength: number = 36): Promise<void> {
|
||||
for (let i = 0; i < count; i++) {
|
||||
await this.addContentToTheNewLine(Math.random().toString(lineLength).substring(2, lineLength))
|
||||
await this.page.waitForTimeout(100)
|
||||
}
|
||||
}
|
||||
|
||||
async addLinkToText (text: string, link: string): Promise<void> {
|
||||
await expect(this.page.locator('p', { hasText: text })).toBeVisible()
|
||||
await this.page.locator('p', { hasText: text }).click()
|
||||
await this.page.locator('p', { hasText: text }).dblclick()
|
||||
await this.buttonToolbarLink.click()
|
||||
|
||||
await this.inputFormLink.fill(link)
|
||||
await this.buttonFormLinkSave.click()
|
||||
}
|
||||
|
||||
async checkLinkInTheText (text: string, link: string): Promise<void> {
|
||||
await expect(this.page.locator('a', { hasText: text })).toHaveAttribute('href', link)
|
||||
}
|
||||
|
||||
async executeMoreAction (action: string): Promise<void> {
|
||||
await this.buttonMoreActions.click()
|
||||
await this.selectFromDropdown(this.page, action)
|
||||
}
|
||||
}
|
47
tests/sanity/tests/model/documents/document-create-popup.ts
Normal file
47
tests/sanity/tests/model/documents/document-create-popup.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { type Locator, type Page } from '@playwright/test'
|
||||
import { CommonPage } from '../common-page'
|
||||
import { NewDocument } from './types'
|
||||
|
||||
export class DocumentCreatePopup extends CommonPage {
|
||||
readonly page: Page
|
||||
readonly popup: Locator
|
||||
readonly form: Locator
|
||||
readonly buttonSelectSpace: Locator
|
||||
readonly buttonSelectParent: Locator
|
||||
readonly buttonSelectIcon: Locator
|
||||
readonly inputTitle: Locator
|
||||
readonly buttonSubmit: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
this.page = page
|
||||
this.popup = page.locator('div.popup')
|
||||
this.form = this.popup.locator('form[id="document:string:CreateDocument"]')
|
||||
|
||||
this.buttonSelectSpace = this.form.locator('button[id="space.selector"]')
|
||||
this.buttonSelectParent = this.form.locator('div[class*="title"] div > button')
|
||||
this.buttonSelectIcon = this.form.locator('div[class*="horizontalBox"] button.only-icon')
|
||||
this.inputTitle = this.form.locator('input')
|
||||
this.buttonSubmit = this.form.locator('button[type="submit"]')
|
||||
}
|
||||
|
||||
async createDocument (data: NewDocument): Promise<void> {
|
||||
await this.inputTitle.fill(data.title)
|
||||
|
||||
if (data.space != null) {
|
||||
await this.buttonSelectSpace.click()
|
||||
await this.selectMenuItem(this.page, data.space)
|
||||
}
|
||||
|
||||
if (data.parentDocument != null) {
|
||||
await this.buttonSelectParent.click()
|
||||
await this.selectMenuItem(this.page, data.parentDocument)
|
||||
}
|
||||
|
||||
if (data.icon != null) {
|
||||
await this.buttonSelectIcon.click()
|
||||
}
|
||||
|
||||
await this.buttonSubmit.click()
|
||||
}
|
||||
}
|
23
tests/sanity/tests/model/documents/document-move-popup.ts
Normal file
23
tests/sanity/tests/model/documents/document-move-popup.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { type Locator, type Page } from '@playwright/test'
|
||||
import { CommonPage } from '../common-page'
|
||||
|
||||
export class DocumentMovePopup extends CommonPage {
|
||||
readonly page: Page
|
||||
readonly popup: Locator
|
||||
readonly buttonSelectSpace: Locator
|
||||
readonly buttonSubmit: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
this.page = page
|
||||
this.popup = page.locator('div.popup')
|
||||
this.buttonSelectSpace = this.popup.locator('button[id="space.selector"]')
|
||||
this.buttonSubmit = this.popup.locator('button[type="submit"]')
|
||||
}
|
||||
|
||||
async moveToSpace (newSpace: string): Promise<void> {
|
||||
await this.buttonSelectSpace.click()
|
||||
await this.selectMenuItem(this.page, newSpace)
|
||||
await this.buttonSubmit.click()
|
||||
}
|
||||
}
|
137
tests/sanity/tests/model/documents/documents-page.ts
Normal file
137
tests/sanity/tests/model/documents/documents-page.ts
Normal file
@ -0,0 +1,137 @@
|
||||
import { type Locator, type Page, expect } from '@playwright/test'
|
||||
import { NewDocument, NewTeamspace } from './types'
|
||||
import { CommonPage } from '../common-page'
|
||||
import { DocumentCreatePopup } from './document-create-popup'
|
||||
import { DocumentMovePopup } from './document-move-popup'
|
||||
|
||||
export class DocumentsPage extends CommonPage {
|
||||
readonly page: Page
|
||||
readonly buttonCreateDocument: Locator
|
||||
readonly divTeamspacesParent: Locator
|
||||
readonly buttonCreateTeamspace: Locator
|
||||
readonly inputModalNewTeamspaceTitle: Locator
|
||||
readonly inputModalNewTeamspaceDescription: Locator
|
||||
readonly inputModalNewTeamspacePrivate: Locator
|
||||
readonly buttonModalNewTeamspaceCreate: Locator
|
||||
readonly buttonModalEditTeamspaceTitle: Locator
|
||||
readonly buttonModalEditTeamspaceDescription: Locator
|
||||
readonly buttonModalEditTeamspacePrivate: Locator
|
||||
readonly buttonModalEditTeamspaceSave: Locator
|
||||
readonly buttonModalEditTeamspaceClose: Locator
|
||||
readonly popupCreateDocument: DocumentCreatePopup
|
||||
readonly popupMoveDocument: DocumentMovePopup
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
this.page = page
|
||||
this.popupCreateDocument = new DocumentCreatePopup(page)
|
||||
this.popupMoveDocument = new DocumentMovePopup(page)
|
||||
|
||||
this.buttonCreateDocument = page.locator('div[data-float="navigator"] button[type="submit"]')
|
||||
this.divTeamspacesParent = page.locator('div#tree-teamspaces').locator('xpath=..')
|
||||
this.buttonCreateTeamspace = page.locator('div#tree-teamspaces > button')
|
||||
this.inputModalNewTeamspaceTitle = page.locator(
|
||||
'form[id="document:string:NewTeamspace"] input[placeholder="New teamspace"]'
|
||||
)
|
||||
this.inputModalNewTeamspaceDescription = page.locator('form[id="document:string:NewTeamspace"] div.tiptap')
|
||||
this.inputModalNewTeamspacePrivate = page.locator(
|
||||
'form[id="document:string:NewTeamspace"] div.antiGrid label.toggle'
|
||||
)
|
||||
this.buttonModalNewTeamspaceCreate = page.locator('form[id="document:string:NewTeamspace"] button[type="submit"]')
|
||||
this.buttonModalEditTeamspaceTitle = page.locator('form[id="document:string:EditTeamspace"] input[type="text"]')
|
||||
this.buttonModalEditTeamspaceDescription = page.locator('form[id="document:string:EditTeamspace"] div.tiptap')
|
||||
this.buttonModalEditTeamspacePrivate = page.locator(
|
||||
'form[id="document:string:EditTeamspace"] div.antiGrid label.toggle'
|
||||
)
|
||||
this.buttonModalEditTeamspaceSave = page.locator('form[id="document:string:EditTeamspace"] button[type="submit"]')
|
||||
this.buttonModalEditTeamspaceClose = page.locator('form[id="document:string:EditTeamspace"] button#card-close')
|
||||
}
|
||||
|
||||
async createNewTeamspace (data: NewTeamspace): Promise<void> {
|
||||
await this.divTeamspacesParent.hover()
|
||||
await this.buttonCreateTeamspace.click()
|
||||
|
||||
await this.inputModalNewTeamspaceTitle.fill(data.title)
|
||||
if (data.description != null) {
|
||||
await this.inputModalNewTeamspaceDescription.fill(data.description)
|
||||
}
|
||||
if (data.private != null) {
|
||||
await this.inputModalNewTeamspacePrivate.click()
|
||||
}
|
||||
|
||||
await this.buttonModalNewTeamspaceCreate.click()
|
||||
}
|
||||
|
||||
async openTeamspace (name: string): Promise<void> {
|
||||
const classes = await this.page
|
||||
.locator('div.antiNav-element span[class*="label"]', { hasText: name })
|
||||
.locator('xpath=..')
|
||||
.getAttribute('class')
|
||||
if (classes != null && classes.includes('collapsed')) {
|
||||
await this.page.locator('div.antiNav-element span[class*="label"]', { hasText: name }).click()
|
||||
}
|
||||
}
|
||||
|
||||
async checkTeamspaceExist (name: string): Promise<void> {
|
||||
await expect(this.page.locator('div[class*="dropbox"] span[class*="label"]', { hasText: name })).toHaveCount(1)
|
||||
}
|
||||
|
||||
async checkTeamspaceNotExist (name: string): Promise<void> {
|
||||
await expect(this.page.locator('div[class*="dropbox"] span[class*="label"]', { hasText: name })).toHaveCount(0)
|
||||
}
|
||||
|
||||
async moreActionTeamspace (name: string, action: string): Promise<void> {
|
||||
await this.page.locator('div[class*="dropbox"] > div > span[class*="label"]', { hasText: name }).hover()
|
||||
await this.page.locator(`xpath=//span[text()="${name}"]/../div[last()]`).click()
|
||||
await this.selectFromDropdown(this.page, action)
|
||||
}
|
||||
|
||||
async createDocument (data: NewDocument): Promise<void> {
|
||||
await this.popupCreateDocument.createDocument(data)
|
||||
}
|
||||
|
||||
async openDocument (name: string): Promise<void> {
|
||||
await this.page.locator('div.tree > span[class*="label"]', { hasText: name }).click()
|
||||
}
|
||||
|
||||
async openDocumentForTeamspace (spaceName: string, documentName: string): Promise<void> {
|
||||
await this.page
|
||||
.locator('div.parent > span[class*="label"]', { hasText: spaceName })
|
||||
.locator('xpath=../following-sibling::div[1]')
|
||||
.locator('div.tree > span[class*="label"]', { hasText: documentName })
|
||||
.click()
|
||||
}
|
||||
|
||||
async editTeamspace (data: NewTeamspace): Promise<void> {
|
||||
await this.buttonModalEditTeamspaceTitle.fill(data.title)
|
||||
if (data.description != null) {
|
||||
await this.buttonModalEditTeamspaceDescription.fill(data.description)
|
||||
}
|
||||
if (data.private != null) {
|
||||
await this.buttonModalEditTeamspacePrivate.click()
|
||||
}
|
||||
|
||||
await this.buttonModalEditTeamspaceSave.click()
|
||||
}
|
||||
|
||||
async checkTeamspace (data: NewTeamspace): Promise<void> {
|
||||
await expect(this.buttonModalEditTeamspaceTitle).toHaveValue(data.title)
|
||||
if (data.description != null) {
|
||||
await expect(this.buttonModalEditTeamspaceDescription).toHaveText(data.description)
|
||||
}
|
||||
await this.buttonModalEditTeamspaceClose.click()
|
||||
}
|
||||
|
||||
async moreActionsOnDocument (documentName: string, action: string): Promise<void> {
|
||||
await this.page
|
||||
.locator('div.tree > span[class*="label"]', { hasText: documentName })
|
||||
.locator('xpath=..')
|
||||
.locator('div[class*="tool"]:nth-child(6)')
|
||||
.click()
|
||||
await this.selectFromDropdown(this.page, action)
|
||||
}
|
||||
|
||||
async fillMoveDocumentForm (newSpace: string): Promise<void> {
|
||||
await this.popupMoveDocument.moveToSpace(newSpace)
|
||||
}
|
||||
}
|
18
tests/sanity/tests/model/documents/types.ts
Normal file
18
tests/sanity/tests/model/documents/types.ts
Normal file
@ -0,0 +1,18 @@
|
||||
export interface NewTeamspace {
|
||||
title: string
|
||||
description?: string
|
||||
private?: boolean
|
||||
}
|
||||
|
||||
export interface NewDocument {
|
||||
title: string
|
||||
space: string
|
||||
parentDocument?: string
|
||||
icon?: string
|
||||
}
|
||||
|
||||
export interface Date {
|
||||
day: string
|
||||
month: string
|
||||
year: string
|
||||
}
|
@ -7,6 +7,7 @@ export class LeftSideMenuPage extends CommonPage {
|
||||
readonly buttonContacts: Locator
|
||||
readonly buttonTracker: Locator
|
||||
readonly buttonNotification: Locator
|
||||
readonly buttonDocuments: Locator
|
||||
|
||||
constructor (page: Page) {
|
||||
super()
|
||||
@ -15,5 +16,6 @@ export class LeftSideMenuPage extends CommonPage {
|
||||
this.buttonContacts = page.locator('button[id$="Contacts"]')
|
||||
this.buttonTracker = page.locator('button[id$="TrackerApplication"]')
|
||||
this.buttonNotification = page.locator('button[id$="Inbox"]')
|
||||
this.buttonDocuments = page.locator('button[id$="DocumentApplication"]')
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user