Skip to content

Commit

Permalink
Add tests for filter change in inbox (hcengineering#5851)
Browse files Browse the repository at this point in the history
Signed-off-by: Jasmin <[email protected]>
  • Loading branch information
JasminMus authored Jun 19, 2024
1 parent e76316f commit 8ea10fb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
36 changes: 36 additions & 0 deletions tests/sanity/tests/inbox/inbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,40 @@ test.describe('Inbox tests', () => {
await leftSideMenuPageSecond.clickNotification()
await inboxPageSecond.checkIfInboxChatExists('Channel general', false)
})

test('User is able to change filter in inbox', async ({ page, browser }) => {
const channelPage = new ChannelPage(page)
await leftSideMenuPage.openProfileMenu()
await leftSideMenuPage.inviteToWorkspace()
await leftSideMenuPage.getInviteLink()
const linkText = await page.locator('.antiPopup .link').textContent()
const page2 = await browser.newPage()
const leftSideMenuPageSecond = new LeftSideMenuPage(page2)
const inboxPageSecond = new InboxPage(page2)
await leftSideMenuPage.clickOnCloseInvite()
await page2.goto(linkText ?? '')
const joinPage = new SignInJoinPage(page2)
await joinPage.join(newUser2)

await leftSideMenuPage.clickChunter()
await channelPage.clickChannel('general')
await channelPage.sendMessage('Test message')
await leftSideMenuPage.clickTracker()

const newIssue = createNewIssueData(newUser2.firstName, newUser2.lastName)
await prepareNewIssueWithOpenStep(page, newIssue)
await issuesDetailsPage.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
await leftSideMenuPageSecond.clickTracker()
await leftSideMenuPageSecond.clickNotification()
await inboxPageSecond.clickOnInboxFilter('Channels')
await inboxPageSecond.checkIfInboxChatExists(newIssue.title, false)
await inboxPageSecond.checkIfInboxChatExists('Test message', true)
await inboxPageSecond.clickOnInboxFilter('Issues')
await inboxPageSecond.checkIfIssueIsPresentInInbox(newIssue.title)
await inboxPageSecond.checkIfInboxChatExists('Channel general', false)
})
})
9 changes: 9 additions & 0 deletions tests/sanity/tests/model/inbox.ts/inbox-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class InboxPage {
readonly leftSidePanelOpen = (): Locator => this.page.locator('#btnPAside')
readonly leftSidePanelClose = (): Locator => this.page.locator('#btnPClose')
readonly inboxChat = (text: string): Locator => this.page.getByText(text)
readonly issueTitle = (issueTitle: string): Locator => this.page.getByTitle(issueTitle)

// ACTIONS

Expand Down Expand Up @@ -39,6 +40,14 @@ export class InboxPage {
await this.inboxChat(text).click()
}

async clickOnInboxFilter (text: string): Promise<void> {
await this.inboxChat(text).click()
}

async checkIfIssueIsPresentInInbox (issueTitle: string): Promise<void> {
await expect(this.issueTitle(issueTitle)).toBeVisible()
}

async checkIfInboxChatExists (text: string, exists: boolean): Promise<void> {
if (exists) {
await expect(this.inboxChat(text)).toBeVisible()
Expand Down
2 changes: 1 addition & 1 deletion tests/sanity/tests/tracker/subissues.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ test.describe('Tracker sub-issues tests', () => {

await issuesDetailsPage.moreActionOnIssue('Move to project')
await issuesDetailsPage.fillMoveIssuesModal(secondProjectName)

await page.waitForTimeout(1000)
await issuesDetailsPage.openSubIssueByName(newSubIssue.title)
await expect(issuesDetailsPage.textIdentifier()).toHaveText(/SECON-\d+/)
})
Expand Down

0 comments on commit 8ea10fb

Please sign in to comment.