diff --git a/tests/sanity/tests/chat/chat.spec.ts b/tests/sanity/tests/chat/chat.spec.ts index 4e29c88d34..58abaf09a3 100644 --- a/tests/sanity/tests/chat/chat.spec.ts +++ b/tests/sanity/tests/chat/chat.spec.ts @@ -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() + }) }) diff --git a/tests/sanity/tests/model/channel-page.ts b/tests/sanity/tests/model/channel-page.ts index 7226e1c78a..9991085cc1 100644 --- a/tests/sanity/tests/model/channel-page.ts +++ b/tests/sanity/tests/model/channel-page.ts @@ -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 { + await this.inputMessage().fill(`@${message}`) + await this.selectMention(message) + await this.buttonSendMessage().click() + } + async clickOnOpenChannelDetails (): Promise { await this.openChannelDetails().click() } @@ -232,9 +242,9 @@ export class ChannelPage { async checkMessageExist (message: string, messageExists: boolean, messageText: string): Promise { 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() } } diff --git a/tests/sanity/tests/model/common-page.ts b/tests/sanity/tests/model/common-page.ts index 0ee1643926..cd94426f64 100644 --- a/tests/sanity/tests/model/common-page.ts +++ b/tests/sanity/tests/model/common-page.ts @@ -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 { await this.linesFromTable(text).locator('a', { hasText: text }).click() } + + async checkRowsInListExist (text: string, count: number = 1): Promise { + await expect(this.linesFromList(text)).toHaveCount(count) + } + + async pressEscape (): Promise { + await this.page.keyboard.press('Escape') + } } diff --git a/tests/sanity/tests/model/tracker/issues-details-page.ts b/tests/sanity/tests/model/tracker/issues-details-page.ts index 051b39fc1f..e1e77c44a3 100644 --- a/tests/sanity/tests/model/tracker/issues-details-page.ts +++ b/tests/sanity/tests/model/tracker/issues-details-page.ts @@ -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') diff --git a/tests/sanity/tests/model/tracker/issues-page.ts b/tests/sanity/tests/model/tracker/issues-page.ts index 2c409e39eb..869789e494 100644 --- a/tests/sanity/tests/model/tracker/issues-page.ts +++ b/tests/sanity/tests/model/tracker/issues-page.ts @@ -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 { - await this.page.keyboard.press('Escape') - } - async clickEstimationContainer (): Promise { await this.estimationContainer().click() } @@ -423,6 +420,10 @@ export class IssuesPage extends CommonTrackerPage { async fillNewIssueForm (data: NewIssue): Promise { 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) diff --git a/tests/sanity/tests/model/tracker/types.ts b/tests/sanity/tests/model/tracker/types.ts index 0c7267d203..a99378ca4f 100644 --- a/tests/sanity/tests/model/tracker/types.ts +++ b/tests/sanity/tests/model/tracker/types.ts @@ -1,6 +1,7 @@ export interface NewIssue extends Issue { title: string description: string + projectName?: string } export interface Issue { diff --git a/tests/sanity/tests/tracker/mentions.spec.ts b/tests/sanity/tests/tracker/mentions.spec.ts index d8659fec32..535ee1c5b3 100644 --- a/tests/sanity/tests/tracker/mentions.spec.ts +++ b/tests/sanity/tests/tracker/mentions.spec.ts @@ -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() + }) })