Added tests with backlink checks (#6251)

Signed-off-by: Alexander Platov <alexander.platov@hardcoreeng.com>
This commit is contained in:
Alexander Platov 2024-08-05 08:36:08 +03:00 committed by GitHub
parent 0076c4f76c
commit b50c44f236
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 95 additions and 9 deletions

View File

@ -188,6 +188,7 @@ test.describe('channel tests', () => {
await channelPage.clickChannelTab()
await channelPage.clickOnUser(data.lastName + ' ' + data.firstName)
await channelPage.addMemberToChannel(newUser2.lastName + ' ' + newUser2.firstName)
await channelPage.pressEscape()
await leftSideMenuPageSecond.clickChunter()
await channelPageSecond.checkIfChannelDefaultExist(true, data.channelName)
await channelPageSecond.clickChannelTab()
@ -409,4 +410,30 @@ test.describe('channel tests', () => {
await channelPage.addMemberToChannelPreview(newUser2.lastName + ' ' + newUser2.firstName)
await page2.close()
})
test('Checking backlinks in the Chat', async ({ browser, page }) => {
await leftSideMenuPage.openProfileMenu()
await leftSideMenuPage.inviteToWorkspace()
await leftSideMenuPage.getInviteLink()
const linkText = await page.locator('.antiPopup .link').textContent()
await leftSideMenuPage.clickOnCloseInvite()
const page2 = await browser.newPage()
const leftSideMenuPageSecond = new LeftSideMenuPage(page2)
const channelPageSecond = new ChannelPage(page2)
await api.createAccount(newUser2.email, newUser2.password, newUser2.firstName, newUser2.lastName)
await page2.goto(linkText ?? '')
const joinPage = new SignInJoinPage(page2)
await joinPage.join(newUser2)
await leftSideMenuPage.clickChunter()
await channelPage.clickChannel('general')
const mentionName = `${newUser2.lastName} ${newUser2.firstName}`
await channelPage.sendMention(mentionName)
await channelPage.checkMessageExist(`@${mentionName}`, true, `@${mentionName}`)
await leftSideMenuPageSecond.clickChunter()
await channelPageSecond.clickChannel('general')
await channelPageSecond.checkMessageExist(`@${mentionName}`, true, `@${mentionName}`)
await page2.close()
})
})

View File

@ -1,15 +1,19 @@
import { expect, type Locator, type Page } from '@playwright/test'
import { CommonPage } from './common-page'
export class ChannelPage {
export class ChannelPage extends CommonPage {
readonly page: Page
constructor (page: Page) {
super(page)
this.page = page
}
readonly inputMessage = (): Locator => this.page.locator('div[class~="text-editor-view"]')
readonly buttonSendMessage = (): Locator => this.page.locator('g#Send')
readonly textMessage = (messageText: string): Locator => this.page.getByText(messageText)
readonly textMessage = (messageText: string): Locator =>
this.page.locator('.hulyComponent .activityMessage', { hasText: messageText })
readonly channelName = (channel: string): Locator => this.page.getByText('general random').getByText(channel)
readonly channelTab = (): Locator => this.page.getByRole('link', { name: 'Channels' }).getByRole('button')
readonly channelTable = (): Locator => this.page.getByRole('table')
@ -71,6 +75,12 @@ export class ChannelPage {
await this.buttonSendMessage().click()
}
async sendMention (message: string): Promise<void> {
await this.inputMessage().fill(`@${message}`)
await this.selectMention(message)
await this.buttonSendMessage().click()
}
async clickOnOpenChannelDetails (): Promise<void> {
await this.openChannelDetails().click()
}
@ -232,9 +242,9 @@ export class ChannelPage {
async checkMessageExist (message: string, messageExists: boolean, messageText: string): Promise<void> {
if (messageExists) {
await expect(this.textMessage(messageText).filter({ hasText: message })).toBeVisible()
await expect(this.textMessage(messageText)).toBeVisible()
} else {
await expect(this.textMessage(messageText).filter({ hasText: message })).toBeHidden()
await expect(this.textMessage(messageText)).toBeHidden()
}
}

View File

@ -38,7 +38,7 @@ export class CommonPage {
historyBoxButtonFirst = (): Locator => this.page.locator('div.history-box button:first-child')
inboxNotyButton = (): Locator => this.page.locator('button[id$="Inbox"] > div.noty')
mentionPopupListItem = (mentionName: string): Locator =>
this.page.locator('form.mentionPoup div.list-item span.name', { hasText: mentionName })
this.page.locator('form.mentionPoup div.list-item', { hasText: mentionName })
hulyPopupRowButton = (name: string): Locator =>
this.page.locator('div.hulyPopup-container button.hulyPopup-row', { hasText: name })
@ -298,4 +298,12 @@ export class CommonPage {
async openRowInTableByText (text: string): Promise<void> {
await this.linesFromTable(text).locator('a', { hasText: text }).click()
}
async checkRowsInListExist (text: string, count: number = 1): Promise<void> {
await expect(this.linesFromList(text)).toHaveCount(count)
}
async pressEscape (): Promise<void> {
await this.page.keyboard.press('Escape')
}
}

View File

@ -10,6 +10,7 @@ export class IssuesDetailsPage extends CommonTrackerPage {
this.page = page
}
readonly issueTitle = (): Locator => this.page.locator('div.hulyHeader-container div.title')
readonly inputTitle = (): Locator => this.page.locator('div.popupPanel-body input[type="text"]')
readonly inputDescription = (): Locator => this.page.locator('div.popupPanel-body div.textInput div.tiptap')
readonly textIdentifier = (): Locator => this.page.locator('div.title.not-active')

View File

@ -19,6 +19,7 @@ export class IssuesPage extends CommonTrackerPage {
inputPopupCreateNewIssueDescription = (): Locator =>
this.page.locator('form[id="tracker:string:NewIssue"] div.tiptap')
buttonPopupCreateNewIssueProject = (): Locator => this.page.locator('[id="space\\.selector"]')
buttonPopupCreateNewIssueStatus = (): Locator =>
this.page.locator('form[id="tracker:string:NewIssue"] div#status-editor button')
@ -279,10 +280,6 @@ export class IssuesPage extends CommonTrackerPage {
await this.modifiedDateMenuItem().click()
}
async pressEscape (): Promise<void> {
await this.page.keyboard.press('Escape')
}
async clickEstimationContainer (): Promise<void> {
await this.estimationContainer().click()
}
@ -423,6 +420,10 @@ export class IssuesPage extends CommonTrackerPage {
async fillNewIssueForm (data: NewIssue): Promise<void> {
await this.inputPopupCreateNewIssueTitle().fill(data.title)
await this.inputPopupCreateNewIssueDescription().fill(data.description)
if (data.projectName != null) {
await this.buttonPopupCreateNewIssueProject().click()
await this.selectMenuItem(this.page, data.projectName)
}
if (data.status != null) {
await this.buttonPopupCreateNewIssueStatus().click()
await this.selectFromDropdown(this.page, data.status)

View File

@ -1,6 +1,7 @@
export interface NewIssue extends Issue {
title: string
description: string
projectName?: string
}
export interface Issue {

View File

@ -3,6 +3,7 @@ import { generateId, PlatformSetting, PlatformURI } from '../utils'
import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { IssuesPage } from '../model/tracker/issues-page'
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
import { TrackerNavigationMenuPage } from '../model/tracker/tracker-navigation-menu-page'
import { NewIssue } from '../model/tracker/types'
import { EmployeeDetailsPage } from '../model/contacts/employee-details-page'
@ -92,4 +93,41 @@ test.describe('Mentions issue tests', () => {
lastName: mentionName.split(' ')[0]
})
})
test('Checking backlinks in different spaces', async ({ page }) => {
const backlinkIssueDefault: NewIssue = {
title: `Issue for Default project-${generateId()}`,
description: 'Description',
projectName: 'Default'
}
const backlinkIssueSecond: NewIssue = {
title: `Issue for Second project-${generateId()}`,
description: 'Description',
projectName: 'Second Project'
}
await leftSideMenuPage.clickTracker()
await issuesPage.createNewIssue(backlinkIssueDefault)
await issuesPage.createNewIssue(backlinkIssueSecond)
const issuesNavigationPage = new TrackerNavigationMenuPage(page)
await issuesNavigationPage.issuesLinkForProject(backlinkIssueDefault.projectName ?? '').click()
await issuesPage.clickModelSelectorAll()
await issuesPage.searchIssueByName(backlinkIssueDefault.title)
await issuesPage.checkRowsInListExist(backlinkIssueDefault.title)
const defaultId = await issuesPage.getIssueId(backlinkIssueDefault.title)
await issuesNavigationPage.issuesLinkForProject(backlinkIssueSecond.projectName ?? '').click()
await issuesPage.clickModelSelectorAll()
await issuesPage.searchIssueByName(backlinkIssueSecond.title)
await issuesPage.checkRowsInListExist(backlinkIssueSecond.title)
const secondId = await issuesPage.getIssueId(backlinkIssueSecond.title)
await issuesPage.openIssueByName(backlinkIssueSecond.title)
await issuesDetailsPage.addMentions(defaultId)
await issuesDetailsPage.checkCommentExist(`@${defaultId}`)
await issuesDetailsPage.openLinkFromActivitiesByText(`@${defaultId}`)
await issuesDetailsPage.checkIssue(backlinkIssueDefault)
await issuesDetailsPage.addMentions(secondId)
await issuesDetailsPage.checkCommentExist(`@${secondId}`)
await issuesDetailsPage.openLinkFromActivitiesByText(`@${secondId}`)
await issuesDetailsPage.checkIssue(backlinkIssueSecond)
await issuesDetailsPage.clickCloseIssueButton()
})
})