|
|
|
|
@ -6,20 +6,27 @@ import { createAuxContext } from './fixtures/createAuxContext'; |
|
|
|
|
import injectInitialData from './fixtures/inject-initial-data'; |
|
|
|
|
import { Users, storeState, restoreState } from './fixtures/userStates'; |
|
|
|
|
import { AccountProfile, HomeChannel } from './page-objects'; |
|
|
|
|
import { AccountSecurityPage } from './page-objects/account-security'; |
|
|
|
|
import { EncryptedRoomPage } from './page-objects/encrypted-room'; |
|
|
|
|
import { HomeSidenav } from './page-objects/fragments'; |
|
|
|
|
import { |
|
|
|
|
E2EEKeyDecodeFailureBanner, |
|
|
|
|
EnterE2EEPasswordBanner, |
|
|
|
|
EnterE2EEPasswordModal, |
|
|
|
|
SaveE2EEPasswordBanner, |
|
|
|
|
SaveE2EEPasswordModal, |
|
|
|
|
} from './page-objects/fragments/e2ee'; |
|
|
|
|
import { FileUploadModal } from './page-objects/fragments/file-upload-modal'; |
|
|
|
|
import { HomeFlextabExportMessages } from './page-objects/fragments/home-flextab-exportMessages'; |
|
|
|
|
import { LoginPage } from './page-objects/login'; |
|
|
|
|
import { test, expect } from './utils/test'; |
|
|
|
|
|
|
|
|
|
test.use({ storageState: Users.admin.state }); |
|
|
|
|
|
|
|
|
|
test.describe.serial('e2e-encryption initial setup', () => { |
|
|
|
|
let poAccountProfile: AccountProfile; |
|
|
|
|
let poHomeChannel: HomeChannel; |
|
|
|
|
let password: string; |
|
|
|
|
const newPassword = 'new password'; |
|
|
|
|
test.beforeAll(async () => { |
|
|
|
|
await injectInitialData(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
|
poAccountProfile = new AccountProfile(page); |
|
|
|
|
poHomeChannel = new HomeChannel(page); |
|
|
|
|
}); |
|
|
|
|
test.describe('initial setup', () => { |
|
|
|
|
test.use({ storageState: Users.admin.state }); |
|
|
|
|
|
|
|
|
|
test.beforeAll(async ({ api }) => { |
|
|
|
|
await api.post('/settings/E2E_Enable', { value: true }); |
|
|
|
|
@ -31,223 +38,259 @@ test.describe.serial('e2e-encryption initial setup', () => { |
|
|
|
|
await api.post('/settings/E2E_Allow_Unencrypted_Messages', { value: false }); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test.afterEach(async ({ api }) => { |
|
|
|
|
await api.recreateContext(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test("expect reset user's e2e encryption key", async ({ page }) => { |
|
|
|
|
await page.goto('/account/security'); |
|
|
|
|
|
|
|
|
|
// Reset key to start the flow from the beginning
|
|
|
|
|
// It will execute a logout
|
|
|
|
|
await poAccountProfile.securityE2EEncryptionSection.click(); |
|
|
|
|
await poAccountProfile.securityE2EEncryptionResetKeyButton.click(); |
|
|
|
|
|
|
|
|
|
await page.locator('role=button[name="Login"]').waitFor(); |
|
|
|
|
|
|
|
|
|
await injectInitialData(); |
|
|
|
|
|
|
|
|
|
// Login again, check the banner to save the generated password and test it
|
|
|
|
|
await restoreState(page, Users.admin); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.bannerSaveEncryptionPassword.click(); |
|
|
|
|
|
|
|
|
|
password = (await page.evaluate(() => localStorage.getItem('e2e.randomPassword'))) || 'undefined'; |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.dialogSaveE2EEPassword).toContainText(password); |
|
|
|
|
test.beforeEach(async ({ api, page }) => { |
|
|
|
|
const loginPage = new LoginPage(page); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.btnSavedMyPassword.click(); |
|
|
|
|
await api.post('/method.call/e2e.resetOwnE2EKey', { |
|
|
|
|
message: JSON.stringify({ msg: 'method', id: '1', method: 'e2e.resetOwnE2EKey', params: [] }), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.bannerSaveEncryptionPassword).not.toBeVisible(); |
|
|
|
|
await page.goto('/home'); |
|
|
|
|
await loginPage.waitForIt(); |
|
|
|
|
await loginPage.loginByUserState(Users.admin); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.sidenav.logout(); |
|
|
|
|
test('expect the randomly generated password to work', async ({ page }) => { |
|
|
|
|
const loginPage = new LoginPage(page); |
|
|
|
|
const saveE2EEPasswordBanner = new SaveE2EEPasswordBanner(page); |
|
|
|
|
const saveE2EEPasswordModal = new SaveE2EEPasswordModal(page); |
|
|
|
|
const enterE2EEPasswordBanner = new EnterE2EEPasswordBanner(page); |
|
|
|
|
const enterE2EEPasswordModal = new EnterE2EEPasswordModal(page); |
|
|
|
|
const e2EEKeyDecodeFailureBanner = new E2EEKeyDecodeFailureBanner(page); |
|
|
|
|
const sidenav = new HomeSidenav(page); |
|
|
|
|
|
|
|
|
|
await page.locator('role=button[name="Login"]').waitFor(); |
|
|
|
|
// Click the banner to open the dialog to save the generated password
|
|
|
|
|
await saveE2EEPasswordBanner.click(); |
|
|
|
|
const password = await saveE2EEPasswordModal.getPassword(); |
|
|
|
|
await saveE2EEPasswordModal.confirm(); |
|
|
|
|
await saveE2EEPasswordBanner.waitForDisappearance(); |
|
|
|
|
|
|
|
|
|
await injectInitialData(); |
|
|
|
|
// Log out
|
|
|
|
|
await sidenav.logout(); |
|
|
|
|
|
|
|
|
|
await restoreState(page, Users.admin); |
|
|
|
|
// Login again
|
|
|
|
|
await loginPage.loginByUserState(Users.admin); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.bannerEnterE2EEPassword.click(); |
|
|
|
|
// Enter the saved password
|
|
|
|
|
await enterE2EEPasswordBanner.click(); |
|
|
|
|
await enterE2EEPasswordModal.enterPassword(password); |
|
|
|
|
|
|
|
|
|
await page.locator('#modal-root input').fill(password); |
|
|
|
|
// No error banner
|
|
|
|
|
await e2EEKeyDecodeFailureBanner.expectToNotBeVisible(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await page.locator('#modal-root .rcx-button--primary').click(); |
|
|
|
|
test('expect to manually reset the password', async ({ page }) => { |
|
|
|
|
const accountSecurityPage = new AccountSecurityPage(page); |
|
|
|
|
const loginPage = new LoginPage(page); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.bannerEnterE2EEPassword).not.toBeVisible(); |
|
|
|
|
// Reset the E2EE key to start the flow from the beginning
|
|
|
|
|
await accountSecurityPage.goto(); |
|
|
|
|
await accountSecurityPage.resetE2EEPassword(); |
|
|
|
|
|
|
|
|
|
await storeState(page, Users.admin); |
|
|
|
|
await loginPage.loginByUserState(Users.admin); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('expect change the e2ee password', async ({ page }) => { |
|
|
|
|
await page.goto('/account/security'); |
|
|
|
|
test('expect to manually set a new password', async ({ page }) => { |
|
|
|
|
const accountSecurityPage = new AccountSecurityPage(page); |
|
|
|
|
const loginPage = new LoginPage(page); |
|
|
|
|
const saveE2EEPasswordBanner = new SaveE2EEPasswordBanner(page); |
|
|
|
|
const saveE2EEPasswordModal = new SaveE2EEPasswordModal(page); |
|
|
|
|
const enterE2EEPasswordBanner = new EnterE2EEPasswordBanner(page); |
|
|
|
|
const enterE2EEPasswordModal = new EnterE2EEPasswordModal(page); |
|
|
|
|
const e2EEKeyDecodeFailureBanner = new E2EEKeyDecodeFailureBanner(page); |
|
|
|
|
const sidenav = new HomeSidenav(page); |
|
|
|
|
|
|
|
|
|
await restoreState(page, Users.admin); |
|
|
|
|
const newPassword = faker.string.uuid(); |
|
|
|
|
|
|
|
|
|
await poAccountProfile.securityE2EEncryptionSection.click(); |
|
|
|
|
await poAccountProfile.securityE2EEncryptionPassword.click(); |
|
|
|
|
await poAccountProfile.securityE2EEncryptionPassword.fill(newPassword); |
|
|
|
|
await poAccountProfile.securityE2EEncryptionPasswordConfirmation.fill(newPassword); |
|
|
|
|
await poAccountProfile.securityE2EEncryptionSavePasswordButton.click(); |
|
|
|
|
// Click the banner to open the dialog to save the generated password
|
|
|
|
|
await saveE2EEPasswordBanner.click(); |
|
|
|
|
await saveE2EEPasswordModal.confirm(); |
|
|
|
|
await saveE2EEPasswordBanner.waitForDisappearance(); |
|
|
|
|
|
|
|
|
|
await poAccountProfile.btnClose.click(); |
|
|
|
|
// Set a new password
|
|
|
|
|
await accountSecurityPage.goto(); |
|
|
|
|
await accountSecurityPage.setE2EEPassword(newPassword); |
|
|
|
|
await accountSecurityPage.close(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.sidenav.logout(); |
|
|
|
|
// Log out
|
|
|
|
|
await sidenav.logout(); |
|
|
|
|
|
|
|
|
|
await page.locator('role=button[name="Login"]').waitFor(); |
|
|
|
|
|
|
|
|
|
await injectInitialData(); |
|
|
|
|
// Login again
|
|
|
|
|
await loginPage.loginByUserState(Users.admin); |
|
|
|
|
|
|
|
|
|
await restoreState(page, Users.admin, { except: ['public_key', 'private_key'] }); |
|
|
|
|
// Enter the saved password
|
|
|
|
|
await enterE2EEPasswordBanner.click(); |
|
|
|
|
await enterE2EEPasswordModal.enterPassword(newPassword); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.bannerEnterE2EEPassword.click(); |
|
|
|
|
// No error banner
|
|
|
|
|
await e2EEKeyDecodeFailureBanner.expectToNotBeVisible(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await page.locator('#modal-root input').fill(password); |
|
|
|
|
test.describe('basic features', () => { |
|
|
|
|
test.use({ storageState: Users.admin.state }); |
|
|
|
|
|
|
|
|
|
await page.locator('#modal-root .rcx-button--primary').click(); |
|
|
|
|
test.beforeAll(async ({ api }) => { |
|
|
|
|
await api.post('/settings/E2E_Enable', { value: true }); |
|
|
|
|
await api.post('/settings/E2E_Allow_Unencrypted_Messages', { value: true }); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.btnNotPossibleDecodeKey.click(); |
|
|
|
|
test.afterAll(async ({ api }) => { |
|
|
|
|
await api.post('/settings/E2E_Enable', { value: false }); |
|
|
|
|
await api.post('/settings/E2E_Allow_Unencrypted_Messages', { value: false }); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await page.locator('#modal-root input').fill(newPassword); |
|
|
|
|
test.beforeEach(async ({ api, page }) => { |
|
|
|
|
const loginPage = new LoginPage(page); |
|
|
|
|
|
|
|
|
|
await page.locator('#modal-root .rcx-button--primary').click(); |
|
|
|
|
await api.post('/method.call/e2e.resetOwnE2EKey', { |
|
|
|
|
message: JSON.stringify({ msg: 'method', id: '1', method: 'e2e.resetOwnE2EKey', params: [] }), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.btnNotPossibleDecodeKey).not.toBeVisible(); |
|
|
|
|
await expect(poHomeChannel.bannerEnterE2EEPassword).not.toBeVisible(); |
|
|
|
|
await page.goto('/home'); |
|
|
|
|
await loginPage.waitForIt(); |
|
|
|
|
await loginPage.loginByUserState(Users.admin); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('expect placeholder text in place of encrypted message', async ({ page }) => { |
|
|
|
|
await page.goto('/home'); |
|
|
|
|
const loginPage = new LoginPage(page); |
|
|
|
|
const saveE2EEPasswordBanner = new SaveE2EEPasswordBanner(page); |
|
|
|
|
const saveE2EEPasswordModal = new SaveE2EEPasswordModal(page); |
|
|
|
|
const encryptedRoomPage = new EncryptedRoomPage(page); |
|
|
|
|
const sidenav = new HomeSidenav(page); |
|
|
|
|
|
|
|
|
|
const channelName = faker.string.uuid(); |
|
|
|
|
const messageText = 'This is an encrypted message.'; |
|
|
|
|
|
|
|
|
|
await poHomeChannel.sidenav.createEncryptedChannel(channelName); |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
await saveE2EEPasswordBanner.click(); |
|
|
|
|
await saveE2EEPasswordModal.confirm(); |
|
|
|
|
await saveE2EEPasswordBanner.waitForDisappearance(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
await sidenav.createEncryptedChannel(channelName); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
await expect(encryptedRoomPage.encryptedIcon).toBeVisible(); |
|
|
|
|
await expect(encryptedRoomPage.encryptionNotReadyIndicator).not.toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('This is an encrypted message.'); |
|
|
|
|
await encryptedRoomPage.sendMessage(messageText); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.encryptedIcon).toBeVisible(); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.body).toHaveText(messageText); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.lastUserMessageBody).toHaveText('This is an encrypted message.'); |
|
|
|
|
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).toBeVisible(); |
|
|
|
|
await sidenav.logout(); |
|
|
|
|
|
|
|
|
|
// Logout and login
|
|
|
|
|
await poHomeChannel.sidenav.logout(); |
|
|
|
|
await page.locator('role=button[name="Login"]').waitFor(); |
|
|
|
|
await injectInitialData(); |
|
|
|
|
await restoreState(page, Users.admin, { except: ['private_key', 'public_key'] }); |
|
|
|
|
await loginPage.loginByUserState(Users.admin); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.sidenav.openChat(channelName); |
|
|
|
|
// Navigate to the encrypted channel WITHOUT entering the password
|
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
await sidenav.openChat(channelName); |
|
|
|
|
await expect(encryptedRoomPage.encryptedIcon).toBeVisible(); |
|
|
|
|
await expect(encryptedRoomPage.encryptionNotReadyIndicator).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.lastUserMessage).toContainText( |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.encryptedIcon).toBeVisible(); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.body).toHaveText( |
|
|
|
|
'This message is end-to-end encrypted. To view it, you must enter your encryption key in your account settings.', |
|
|
|
|
); |
|
|
|
|
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.lastUserMessage.hover(); |
|
|
|
|
await expect(page.locator('[role=toolbar][aria-label="Message actions"]')).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('expect placeholder text in place of encrypted file description, when non-encrypted files upload in disabled e2ee room', async ({ |
|
|
|
|
page, |
|
|
|
|
}) => { |
|
|
|
|
await page.goto('/home'); |
|
|
|
|
test('expect placeholder text in place of encrypted file upload description', async ({ page }) => { |
|
|
|
|
const encryptedRoomPage = new EncryptedRoomPage(page); |
|
|
|
|
const loginPage = new LoginPage(page); |
|
|
|
|
const saveE2EEPasswordBanner = new SaveE2EEPasswordBanner(page); |
|
|
|
|
const saveE2EEPasswordModal = new SaveE2EEPasswordModal(page); |
|
|
|
|
const fileUploadModal = new FileUploadModal(page); |
|
|
|
|
const sidenav = new HomeSidenav(page); |
|
|
|
|
|
|
|
|
|
const channelName = faker.string.uuid(); |
|
|
|
|
const fileName = faker.system.commonFileName('txt'); |
|
|
|
|
const fileDescription = faker.lorem.sentence(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.sidenav.createEncryptedChannel(channelName); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.sidenav.openChat(channelName); |
|
|
|
|
// Click the banner to open the dialog to save the generated password
|
|
|
|
|
await saveE2EEPasswordBanner.click(); |
|
|
|
|
await saveE2EEPasswordModal.confirm(); |
|
|
|
|
await saveE2EEPasswordBanner.waitForDisappearance(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.dragAndDropTxtFile(); |
|
|
|
|
await poHomeChannel.content.descriptionInput.fill('any_description'); |
|
|
|
|
await poHomeChannel.content.fileNameInput.fill('any_file1.txt'); |
|
|
|
|
await poHomeChannel.content.btnModalConfirm.click(); |
|
|
|
|
// Create an encrypted channel
|
|
|
|
|
await sidenav.createEncryptedChannel(channelName); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.getFileDescription).toHaveText('any_description'); |
|
|
|
|
await expect(poHomeChannel.content.lastMessageFileName).toContainText('any_file1.txt'); |
|
|
|
|
|
|
|
|
|
await test.step('disable E2EE in the room', async () => { |
|
|
|
|
await poHomeChannel.tabs.kebab.click(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.tabs.btnDisableE2E).toBeVisible(); |
|
|
|
|
await poHomeChannel.tabs.btnDisableE2E.click(); |
|
|
|
|
await expect(page.getByRole('dialog', { name: 'Disable encryption' })).toBeVisible(); |
|
|
|
|
await page.getByRole('button', { name: 'Disable encryption' }).click(); |
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
// will wait till the key icon in header goes away
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toHaveCount(0); |
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
await expect(encryptedRoomPage.encryptedIcon).toBeVisible(); |
|
|
|
|
await expect(encryptedRoomPage.encryptionNotReadyIndicator).not.toBeVisible(); |
|
|
|
|
|
|
|
|
|
await test.step('upload the file with encryption', async () => { |
|
|
|
|
// Upload a file
|
|
|
|
|
await encryptedRoomPage.dragAndDropTxtFile(); |
|
|
|
|
await fileUploadModal.setName(fileName); |
|
|
|
|
await fileUploadModal.setDescription(fileDescription); |
|
|
|
|
await fileUploadModal.send(); |
|
|
|
|
|
|
|
|
|
// Check the file upload
|
|
|
|
|
await expect(encryptedRoomPage.lastMessage.encryptedIcon).toBeVisible(); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.fileUploadName).toContainText(fileName); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.body).toHaveText(fileDescription); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await page.reload(); |
|
|
|
|
|
|
|
|
|
await test.step('upload the file in disabled E2EE room', async () => { |
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).not.toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.dragAndDropTxtFile(); |
|
|
|
|
await poHomeChannel.content.descriptionInput.fill('any_description'); |
|
|
|
|
await poHomeChannel.content.fileNameInput.fill('any_file1.txt'); |
|
|
|
|
await poHomeChannel.content.btnModalConfirm.click(); |
|
|
|
|
await test.step('disable encryption in the room', async () => { |
|
|
|
|
await encryptedRoomPage.disableEncryption(); |
|
|
|
|
await expect(encryptedRoomPage.encryptedIcon).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).not.toBeVisible(); |
|
|
|
|
await test.step('upload the file without encryption', async () => { |
|
|
|
|
await encryptedRoomPage.dragAndDropTxtFile(); |
|
|
|
|
await fileUploadModal.setName(fileName); |
|
|
|
|
await fileUploadModal.setDescription(fileDescription); |
|
|
|
|
await fileUploadModal.send(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.getFileDescription).toHaveText('any_description'); |
|
|
|
|
await expect(poHomeChannel.content.lastMessageFileName).toContainText('any_file1.txt'); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.encryptedIcon).not.toBeVisible(); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.fileUploadName).toContainText(fileName); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.body).toHaveText(fileDescription); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await test.step('Enable E2EE in the room', async () => { |
|
|
|
|
await poHomeChannel.tabs.kebab.click(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.tabs.btnEnableE2E).toBeVisible(); |
|
|
|
|
await poHomeChannel.tabs.btnEnableE2E.click(); |
|
|
|
|
await expect(page.getByRole('dialog', { name: 'Enable encryption' })).toBeVisible(); |
|
|
|
|
await page.getByRole('button', { name: 'Enable encryption' }).click(); |
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
// will wait till the key icon in header appears
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toHaveCount(1); |
|
|
|
|
await test.step('enable encryption in the room', async () => { |
|
|
|
|
await encryptedRoomPage.enableEncryption(); |
|
|
|
|
await expect(encryptedRoomPage.encryptedIcon).toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// Logout to remove e2ee keys
|
|
|
|
|
await poHomeChannel.sidenav.logout(); |
|
|
|
|
// Log out
|
|
|
|
|
await sidenav.logout(); |
|
|
|
|
|
|
|
|
|
// Login again
|
|
|
|
|
await page.locator('role=button[name="Login"]').waitFor(); |
|
|
|
|
await injectInitialData(); |
|
|
|
|
await restoreState(page, Users.admin, { except: ['private_key', 'public_key'] }); |
|
|
|
|
await loginPage.loginByUserState(Users.admin); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.sidenav.openChat(channelName); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
await sidenav.openChat(channelName); |
|
|
|
|
await expect(encryptedRoomPage.encryptedIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.nthMessage(0)).toContainText( |
|
|
|
|
await expect(encryptedRoomPage.lastNthMessage(1).body).toHaveText( |
|
|
|
|
'This message is end-to-end encrypted. To view it, you must enter your encryption key in your account settings.', |
|
|
|
|
); |
|
|
|
|
await expect(poHomeChannel.content.nthMessage(0).locator('.rcx-icon--name-key')).toBeVisible(); |
|
|
|
|
await expect(encryptedRoomPage.lastNthMessage(1).encryptedIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await expect(encryptedRoomPage.lastMessage.encryptedIcon).not.toBeVisible(); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.fileUploadName).toContainText(fileName); |
|
|
|
|
await expect(encryptedRoomPage.lastMessage.body).toHaveText(fileDescription); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('should display only the download file method when exporting messages in an e2ee room', async ({ page }) => { |
|
|
|
|
await page.goto('/home'); |
|
|
|
|
const sidenav = new HomeSidenav(page); |
|
|
|
|
const encryptedRoomPage = new EncryptedRoomPage(page); |
|
|
|
|
const exportMessagesTab = new HomeFlextabExportMessages(page); |
|
|
|
|
|
|
|
|
|
const channelName = faker.string.uuid(); |
|
|
|
|
await poHomeChannel.sidenav.createEncryptedChannel(channelName); |
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
await sidenav.createEncryptedChannel(channelName); |
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
await expect(encryptedRoomPage.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.tabs.kebab.click({ force: true }); |
|
|
|
|
await poHomeChannel.tabs.btnExportMessages.click(); |
|
|
|
|
await expect(poHomeChannel.tabs.exportMessages.downloadFileMethod).toBeVisible(); |
|
|
|
|
await encryptedRoomPage.showExportMessagesTab(); |
|
|
|
|
await expect(exportMessagesTab.downloadFileMethod).toBeVisible(); |
|
|
|
|
await expect(exportMessagesTab.sendEmailMethod).not.toBeVisible(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test.use({ storageState: Users.admin.state }); |
|
|
|
|
|
|
|
|
|
test.describe.serial('e2e-encryption', () => { |
|
|
|
|
// test.skip();
|
|
|
|
|
|
|
|
|
|
let poHomeChannel: HomeChannel; |
|
|
|
|
|
|
|
|
|
test.use({ storageState: Users.userE2EE.state }); |
|
|
|
|
@ -275,8 +318,6 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('hello world'); |
|
|
|
|
@ -319,8 +360,6 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('This is the thread main message.'); |
|
|
|
|
@ -353,8 +392,6 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('This is an encrypted message.'); |
|
|
|
|
@ -406,8 +443,6 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('hello @user1'); |
|
|
|
|
@ -426,8 +461,6 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('Are you in the #general channel?'); |
|
|
|
|
@ -450,8 +483,6 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('Are you in the #general channel, @user1 ?'); |
|
|
|
|
@ -667,8 +698,6 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('This is an encrypted message.'); |
|
|
|
|
@ -710,8 +739,6 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('This is an encrypted message.'); |
|
|
|
|
@ -778,8 +805,6 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.content.sendMessage('This message should be pinned and stared.'); |
|
|
|
|
@ -849,6 +874,8 @@ test.describe.serial('e2e-encryption', () => { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test.describe.serial('e2ee room setup', () => { |
|
|
|
|
// test.skip();
|
|
|
|
|
|
|
|
|
|
let poAccountProfile: AccountProfile; |
|
|
|
|
let poHomeChannel: HomeChannel; |
|
|
|
|
let e2eePassword: string; |
|
|
|
|
@ -1040,6 +1067,8 @@ test.describe.serial('e2ee room setup', () => { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test.describe('e2ee support legacy formats', () => { |
|
|
|
|
// test.skip();
|
|
|
|
|
|
|
|
|
|
test.use({ storageState: Users.userE2EE.state }); |
|
|
|
|
|
|
|
|
|
let poHomeChannel: HomeChannel; |
|
|
|
|
@ -1068,8 +1097,6 @@ test.describe('e2ee support legacy formats', () => { |
|
|
|
|
|
|
|
|
|
await expect(page).toHaveURL(`/group/${channelName}`); |
|
|
|
|
|
|
|
|
|
await poHomeChannel.dismissToast(); |
|
|
|
|
|
|
|
|
|
await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible(); |
|
|
|
|
|
|
|
|
|
const rid = await page.locator('[data-qa-rc-room]').getAttribute('data-qa-rc-room'); |
|
|
|
|
|