-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
845f2f0
commit ced342f
Showing
6 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Users } from './fixtures/userStates'; | ||
import { HomeChannel, Utils } from './page-objects'; | ||
import { createTargetChannel } from './utils'; | ||
import { test, expect } from './utils/test'; | ||
|
||
test.use({ storageState: Users.admin.state }); | ||
|
||
test.describe.serial('export-messages', () => { | ||
let poHomeChannel: HomeChannel; | ||
let poUtils: Utils; | ||
let targetChannel: string; | ||
|
||
test.beforeAll(async ({ api }) => { | ||
targetChannel = await createTargetChannel(api); | ||
}); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
poHomeChannel = new HomeChannel(page); | ||
poUtils = new Utils(page); | ||
|
||
await page.goto('/home'); | ||
}); | ||
|
||
test('should all export methods be available in targetChannel', async () => { | ||
await poHomeChannel.sidenav.openChat(targetChannel); | ||
await poHomeChannel.tabs.kebab.click({ force: true }); | ||
await poHomeChannel.tabs.btnExportMessages.click(); | ||
await expect(poHomeChannel.tabs.exportMessages.sendEmailMethod).not.toBeDisabled(); | ||
|
||
await poHomeChannel.tabs.exportMessages.sendEmailMethod.click(); | ||
await expect(poHomeChannel.tabs.exportMessages.getMethodByName('Send email')).toBeVisible(); | ||
await expect(poHomeChannel.tabs.exportMessages.getMethodByName('Send file via email')).toBeVisible(); | ||
await expect(poHomeChannel.tabs.exportMessages.getMethodByName('Download file')).toBeVisible(); | ||
}); | ||
|
||
test('should display an error when trying to send email without filling to users or to additional emails', async () => { | ||
await poHomeChannel.sidenav.openChat(targetChannel); | ||
await poHomeChannel.content.sendMessage('hello world'); | ||
await poHomeChannel.tabs.kebab.click({ force: true }); | ||
await poHomeChannel.tabs.btnExportMessages.click(); | ||
|
||
await poHomeChannel.content.getMessageByText('hello world').click(); | ||
await poHomeChannel.tabs.exportMessages.btnSend.click(); | ||
|
||
await expect( | ||
poUtils.getAlertByText('You must select one or more users or provide one or more email addresses, separated by commas'), | ||
).toBeVisible(); | ||
}); | ||
|
||
test('should display an error when trying to send email without selecting any email', async () => { | ||
await poHomeChannel.sidenav.openChat(targetChannel); | ||
await poHomeChannel.content.sendMessage('hello world'); | ||
await poHomeChannel.tabs.kebab.click({ force: true }); | ||
await poHomeChannel.tabs.btnExportMessages.click(); | ||
|
||
await poHomeChannel.tabs.exportMessages.textboxAdditionalEmails.fill('[email protected]'); | ||
await poHomeChannel.tabs.exportMessages.btnSend.click(); | ||
|
||
await expect(poUtils.getAlertByText(`You haven't selected any messages`)).toBeVisible(); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
apps/meteor/tests/e2e/page-objects/fragments/home-flextab-exportMessages.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { Page } from '@playwright/test'; | ||
|
||
export class HomeFlextabExportMessages { | ||
private readonly page: Page; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
} | ||
|
||
get sendEmailMethod() { | ||
return this.page.getByLabel('Send email'); | ||
} | ||
|
||
get downloadFileMethod() { | ||
return this.page.getByLabel('Download file'); | ||
} | ||
|
||
getMethodByName(name: string) { | ||
return this.page.getByRole('option', { name }); | ||
} | ||
|
||
get textboxAdditionalEmails() { | ||
return this.page.getByRole('textbox', { name: 'To additional emails' }); | ||
} | ||
|
||
get btnSend() { | ||
return this.page.locator('role=button[name="Send"]'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters