Skip to content

Commit

Permalink
update(test): handle file uploads with promise instead of input element
Browse files Browse the repository at this point in the history
  • Loading branch information
luisecm committed Nov 28, 2024
1 parent 96e56b7 commit 11d0810
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion playwright/PageObjects/FilesScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,11 @@ export class FilesPage extends MainPage {
}

async uploadFile(filePath: string) {
const fileChooserPromise = this.page.waitForEvent("filechooser");
await this.clickOnUploadFileButton();
await this.uploadFileInput.setInputFiles(filePath);
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(filePath);

if (this.viewport === "mobile-chrome") {
await this.uploadFileButton.click();
}
Expand Down

0 comments on commit 11d0810

Please sign in to comment.