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

New Sidebar tests + fix flaky tests #6664

Merged
merged 5 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
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
117 changes: 113 additions & 4 deletions tests/sanity/tests/chat/chat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SignUpData } from '../model/common-types'
import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { LoginPage } from '../model/login-page'
import { SelectWorkspacePage } from '../model/select-workspace-page'
import { SidebarPage } from '../model/sidebar-page'
import {
PlatformURI,
generateTestData,
Expand All @@ -19,6 +20,7 @@ test.describe('Channel tests', () => {
let leftSideMenuPage: LeftSideMenuPage
let chunterPage: ChunterPage
let channelPage: ChannelPage
let sidebarPage: SidebarPage
let loginPage: LoginPage
let api: ApiEndpoint
let newUser2: SignUpData
Expand All @@ -32,6 +34,7 @@ test.describe('Channel tests', () => {
chunterPage = new ChunterPage(page)
channelPage = new ChannelPage(page)
loginPage = new LoginPage(page)
sidebarPage = new SidebarPage(page)
api = new ApiEndpoint(request)
await api.createAccount(data.userName, '1234', data.firstName, data.lastName)
await api.createWorkspaceWithLogin(data.workspaceName, data.userName, '1234')
Expand Down Expand Up @@ -395,7 +398,7 @@ test.describe('Channel tests', () => {
await channelPageSecond.checkMessageExist(`@${mentionName}`, true, `@${mentionName}`)
})

test('User can star and unstar a channel', async () => {
test('User is able to star and unstar a channel', async () => {
await test.step('Prepare channel', async () => {
await leftSideMenuPage.clickChunter()
await chunterPage.clickChannelBrowser()
Expand All @@ -419,7 +422,7 @@ test.describe('Channel tests', () => {
})
})

test('User can leave and join a channel', async () => {
test('User is able to leave and join a channel', async () => {
await test.step('Prepare channel', async () => {
await leftSideMenuPage.clickChunter()
await chunterPage.clickChannelBrowser()
Expand Down Expand Up @@ -461,7 +464,7 @@ test.describe('Channel tests', () => {
})
})

test('User can filter channels in table', async () => {
test('User is able to filter channels in table', async () => {
await test.step('Prepare channel', async () => {
await leftSideMenuPage.clickChunter()
await chunterPage.clickChannelBrowser()
Expand All @@ -486,7 +489,7 @@ test.describe('Channel tests', () => {
})
})

test('User can search channel in table', async () => {
test('User is able to search channel in table', async () => {
await test.step('Prepare channel', async () => {
await leftSideMenuPage.clickChunter()
await chunterPage.clickChannelBrowser()
Expand All @@ -512,4 +515,110 @@ test.describe('Channel tests', () => {
await channelPage.checkIfChannelTableExist('general', true)
})
})

test('User is able to work with a channel in a sidebar', async () => {
await test.step('Prepare channel', async () => {
await leftSideMenuPage.clickChunter()
await chunterPage.clickChannelBrowser()
await chunterPage.clickNewChannelHeader()
await chunterPage.createPrivateChannel(data.channelName, false)
await channelPage.checkIfChannelDefaultExist(true, data.channelName)

await leftSideMenuPage.clickChunter()
await channelPage.clickChooseChannel(data.channelName)
await channelPage.sendMessage('Test message')
})

await test.step('Open channel in sidebar', async () => {
await sidebarPage.checkIfSidebarPageButtonIsExist(false, 'chat')
await channelPage.makeActionWithChannelInMenu(data.channelName, 'Open in sidebar')

await sidebarPage.checkIfSidebarPageButtonIsExist(true, 'chat')
await sidebarPage.checkIfSidebarHasVerticalTab(true, data.channelName)
await sidebarPage.checkIfSidebarIsOpen(true)
await sidebarPage.checkIfChatSidebarTabIsOpen(true, data.channelName)
})

await test.step('Go to another page and check if sidebar will be keeping', async () => {
await leftSideMenuPage.clickTracker()
await sidebarPage.checkIfSidebarIsOpen(true)
await sidebarPage.checkIfChatSidebarTabIsOpen(true, data.channelName)
await leftSideMenuPage.clickChunter()
})

await test.step('Close channel in sidebar', async () => {
await sidebarPage.closeOpenedVerticalTab()
await sidebarPage.checkIfSidebarHasVerticalTab(false, data.channelName)
await sidebarPage.checkIfSidebarIsOpen(false)
})

await test.step('Reopen channel in sidebar', async () => {
await channelPage.makeActionWithChannelInMenu(data.channelName, 'Open in sidebar')
await sidebarPage.checkIfSidebarHasVerticalTab(true, data.channelName)
await sidebarPage.checkIfChatSidebarTabIsOpen(true, data.channelName)
})

await test.step('Open general in sidebar too', async () => {
await channelPage.makeActionWithChannelInMenu('general', 'Open in sidebar')
await sidebarPage.checkIfSidebarHasVerticalTab(true, data.channelName)
await sidebarPage.checkIfSidebarHasVerticalTab(true, 'general')
await sidebarPage.checkIfChatSidebarTabIsOpen(true, 'general')
})

await test.step('Pin and unpin channel tab', async () => {
await sidebarPage.pinVerticalTab(data.channelName)
await sidebarPage.checkIfVerticalTabIsPinned(true, data.channelName)

await sidebarPage.unpinVerticalTab(data.channelName)
await sidebarPage.checkIfVerticalTabIsPinned(false, data.channelName)
})

await test.step('Close sidebar tab by close button in vertical tab', async () => {
await sidebarPage.clickVerticalTab(data.channelName)
await sidebarPage.closeVerticalTabByCloseButton(data.channelName)
await sidebarPage.checkIfSidebarHasVerticalTab(false, data.channelName)
await sidebarPage.checkIfChatSidebarTabIsOpen(true, 'general')
})

await test.step('Close sidebar tab by context menu', async () => {
await channelPage.makeActionWithChannelInMenu('random', 'Open in sidebar')
await sidebarPage.closeVerticalTabByRightClick('random')
await sidebarPage.checkIfSidebarHasVerticalTab(false, 'random')
await sidebarPage.checkIfChatSidebarTabIsOpen(true, 'general')
})

await test.step('Close the last channel tab in Sidebar', async () => {
await sidebarPage.closeVerticalTabByCloseButton('general')
await sidebarPage.checkIfSidebarIsOpen(false)
await sidebarPage.checkIfSidebarPageButtonIsExist(false, 'chat')
})
})

test('User is able to create thread automatically in Sidebar', async () => {
await test.step('Prepare channel', async () => {
await leftSideMenuPage.clickChunter()
await chunterPage.clickChannelBrowser()
await chunterPage.clickNewChannelHeader()
await chunterPage.createPrivateChannel(data.channelName, false)
await channelPage.checkIfChannelDefaultExist(true, data.channelName)

await leftSideMenuPage.clickChunter()
await channelPage.clickChooseChannel(data.channelName)
await channelPage.sendMessage('Test message')
})

await test.step('Open channel in Sidebar', async () => {
await channelPage.replyToMessage('Test message', 'Reply message')

await sidebarPage.checkIfSidebarIsOpen(true)
await sidebarPage.checkIfSidebarHasVerticalTab(true, data.channelName)
await sidebarPage.checkIfChatSidebarTabIsOpen(true, 'Thread')
await sidebarPage.checkIfChatSidebarTabIsOpen(true, data.channelName)
})

await test.step('User go to another chat and Sidebar with tread disappears', async () => {
await channelPage.clickChannel('random')
await sidebarPage.checkIfSidebarIsOpen(false)
})
})
})
19 changes: 11 additions & 8 deletions tests/sanity/tests/documents/documents-content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ test.describe('Content in the Documents tests', () => {
})

test.describe('Image in the document', () => {
test('Check Image alignment setting', async ({ page }) => {
test('Check image alignment setting', async ({ page }) => {
await documentContentPage.addImageToDocument(page)

await test.step('Align image to right', async () => {
Expand All @@ -170,9 +170,8 @@ test.describe('Content in the Documents tests', () => {
})
})

test.skip('Check Image view and size actions', async ({ page }) => {
test.skip('Check Image size manipulations', async ({ page }) => {
await documentContentPage.addImageToDocument(page)
const imageSrc = await documentContentPage.firstImageInDocument().getAttribute('src')

await test.step('Set size of image to the 25%', async () => {
await documentContentPage.clickImageSizeButton('25%')
Expand All @@ -194,6 +193,11 @@ test.describe('Content in the Documents tests', () => {
await documentContentPage.clickImageSizeButton('Unset')
await documentContentPage.checkImageSize(IMAGE_ORIGINAL_SIZE)
})
})

test('Check Image views', async ({ page, context }) => {
await documentContentPage.addImageToDocument(page)
const imageSrc = await documentContentPage.firstImageInDocument().getAttribute('src')

await test.step('User can open image in fullscreen on current page', async () => {
await documentContentPage.clickImageFullscreenButton()
Expand All @@ -203,12 +207,11 @@ test.describe('Content in the Documents tests', () => {
})

await test.step('User can open image original in the new tab', async () => {
const [newPage] = await Promise.all([
page.waitForEvent('popup'),
documentContentPage.clickImageOriginalButton()
])
const pagePromise = context.waitForEvent('page')
await documentContentPage.clickImageOriginalButton()
const newPage = await pagePromise

await newPage.waitForLoadState('domcontentloaded')
await newPage.waitForLoadState()
expect(newPage.url()).toBe(imageSrc)
await newPage.close()
})
Expand Down
2 changes: 1 addition & 1 deletion tests/sanity/tests/model/common-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class CommonPage {
selectPopupButton = (): Locator => this.page.locator('div.selectPopup button')
selectPopupExpandButton = (): Locator => this.page.locator('div.selectPopup button[data-id="btnExpand"]')
popupSpanLabel = (point: string): Locator =>
this.page.locator('div[class$="opup"] span[class*="label"]', { hasText: point })
this.page.locator(`div[class$="opup"] span[class*="label"]:has-text("${point}")`)

readonly inputSearchIcon = (): Locator => this.page.locator('.searchInput-icon')

Expand Down
4 changes: 4 additions & 0 deletions tests/sanity/tests/model/planning/planning-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class PlanningPage extends CalendarPage {
private readonly panel = (): Locator => this.page.locator('div.hulyModal-container')
private readonly toDosContainer = (): Locator => this.page.locator('div.toDos-container')
private readonly schedule = (): Locator => this.page.locator('div.hulyComponent.modal')
private readonly sidebarSchedule = (): Locator => this.page.locator('#sidebar .calendar-container')
readonly pageHeader = (): Locator =>
this.page.locator('div[class*="navigator"] div[class*="header"]', { hasText: 'Planning' })

Expand Down Expand Up @@ -81,6 +82,9 @@ export class PlanningPage extends CalendarPage {
readonly eventInSchedule = (title: string): Locator =>
this.schedule().locator('div.event-container', { hasText: title })

readonly eventInSidebarSchedule = (title: string): Locator =>
this.sidebarSchedule().locator('div.event-container', { hasText: title })

readonly toDoInToDos = (hasText: string): Locator =>
this.toDosContainer().locator('button.hulyToDoLine-container', { hasText })

Expand Down
19 changes: 13 additions & 6 deletions tests/sanity/tests/model/recruiting/talent-details-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ export class TalentDetailsPage extends CommonRecruitingPage {
readonly buttonMergeContacts = (): Locator =>
this.page.locator('button[class*="menuItem"] span', { hasText: 'Merge contacts' })

readonly buttonFinalContact = (): Locator =>
this.page.locator('form[id="contact:string:MergePersons"] button', { hasText: 'Final contact' })
readonly formMergeContacts = (): Locator => this.page.locator('form[id="contact:string:MergePersons"]')

readonly buttonMergeRow = (): Locator => this.page.locator('form[id="contact:string:MergePersons"] div.box')
readonly buttonFinalContact = (): Locator => this.formMergeContacts().locator('button', { hasText: 'Final contact' })

readonly buttonMergeRow = (): Locator => this.formMergeContacts().locator('div.box')
readonly buttonPopupMergeContacts = (): Locator =>
this.page.locator('form[id="contact:string:MergePersons"] button > span', { hasText: 'Merge contacts' })
this.formMergeContacts().locator('button:has-text("Merge contacts")')

readonly textAttachmentName = (): Locator => this.page.locator('div.name a')
readonly titleAndSourceTalent = (title: string): Locator => this.page.locator('button > span', { hasText: title })
Expand All @@ -42,6 +43,12 @@ export class TalentDetailsPage extends CommonRecruitingPage {
await expect(this.textTagItem().first()).toContainText(skillTag)
}

async enterLocation (location: string): Promise<void> {
const input = this.inputLocation()
await input.click()
await input.fill(location)
}

async addTitle (title: string): Promise<void> {
await this.buttonInputTitle().click()
await this.fillToSelectPopup(this.page, title)
Expand Down Expand Up @@ -97,8 +104,8 @@ export class TalentDetailsPage extends CommonRecruitingPage {
}
}

async checkMergeContacts (talentName: string, title: string, source: string): Promise<void> {
await expect(this.page.locator('div.location input')).toHaveValue(talentName)
async checkMergeContacts (location: string, title: string, source: string): Promise<void> {
await expect(this.page.locator('div.location input')).toHaveValue(location)
await expect(this.titleAndSourceTalent(title)).toBeVisible()
await expect(this.titleAndSourceTalent(source)).toBeVisible()
}
Expand Down
Loading