Skip to content

Commit 1f2cd49

Browse files
committed
test: fix outdated updated e2e tests
1 parent a4f4f43 commit 1f2cd49

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

apps/meteor/tests/e2e/e2e-encryption/e2ee-file-encryption.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ test.describe('E2EE File Encryption', () => {
5555
await poHomeChannel.content.getFileComposerByName('any_file.txt').click();
5656
await poHomeChannel.content.inputFileUploadName.fill(updatedFileName);
5757
await poHomeChannel.content.btnUpdateFileUpload.click();
58-
await poHomeChannel.content.btnSendMainComposer.click();
58+
await poHomeChannel.content.sendMessage('any_description');
5959

6060
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).toBeVisible();
61-
await expect(poHomeChannel.content.getFileDescription).not.toBeVisible();
61+
await expect(poHomeChannel.content.getFileDescription).toHaveText('any_description');
6262
await expect(poHomeChannel.content.lastMessageFileName).toContainText(updatedFileName);
6363
});
6464

apps/meteor/tests/e2e/page-objects/fragments/home-content.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ export class HomeContent {
166166
return this.page.getByRole('button', { name: 'Dismiss quoted message' });
167167
}
168168

169-
get descriptionInput(): Locator {
170-
return this.page.locator('//div[@id="modal-root"]//fieldset//div[2]//span//input');
171-
}
172-
173169
get getFileDescription(): Locator {
174170
return this.page.locator('[data-qa-type="message"]:last-child [data-qa-type="message-body"]');
175171
}
@@ -424,7 +420,7 @@ export class HomeContent {
424420
await this.page.locator('[role=dialog][data-qa="DropTargetOverlay"]').dispatchEvent('drop', { dataTransfer });
425421
}
426422

427-
async dragAndDropTxtFileToThread(): Promise<void> {
423+
async dragAndDropTxtFileToThread({ waitForResponse = true } = {}): Promise<void> {
428424
const contract = await fs.readFile(getFilePath('any_file.txt'), 'utf-8');
429425
const dataTransfer = await this.page.evaluateHandle((contract) => {
430426
const data = new DataTransfer();
@@ -436,8 +432,11 @@ export class HomeContent {
436432
}, contract);
437433

438434
await this.inputThreadMessage.dispatchEvent('dragenter', { dataTransfer });
439-
440435
await this.page.locator('[role=dialog][data-qa="DropTargetOverlay"]').dispatchEvent('drop', { dataTransfer });
436+
437+
if (waitForResponse) {
438+
await waitForMediaResponse(this.page);
439+
}
441440
}
442441

443442
async sendFileMessage(fileName: string, { waitForResponse = true } = {}): Promise<void> {

apps/meteor/tests/e2e/prune-messages.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test.describe('prune-messages', () => {
4242
} = poHomeChannel;
4343

4444
await content.sendFileMessage('any_file.txt');
45-
await content.btnModalConfirm.click();
45+
await content.btnSendMainComposer.click();
4646
await expect(content.lastMessageFileName).toHaveText('any_file.txt');
4747

4848
await sendTargetChannelMessage(api, targetChannel.fname as string, {
@@ -109,8 +109,7 @@ test.describe('prune-messages', () => {
109109
} = poHomeChannel;
110110

111111
await content.sendFileMessage('any_file.txt');
112-
await content.descriptionInput.fill('a message with a file');
113-
await content.btnModalConfirm.click();
112+
await content.btnSendMainComposer.click();
114113
await expect(content.lastMessageFileName).toHaveText('any_file.txt');
115114

116115
await test.step('prune files only', async () => {
@@ -144,8 +143,7 @@ test.describe('prune-messages', () => {
144143
const { content } = poHomeChannel;
145144

146145
await content.sendFileMessage('any_file.txt');
147-
await content.descriptionInput.fill('a message with a file');
148-
await content.btnModalConfirm.click();
146+
await content.btnSendMainComposer.click();
149147
await expect(content.lastMessageFileName).toHaveText('any_file.txt');
150148

151149
await content.lastUserMessage.hover();

0 commit comments

Comments
 (0)