Skip to content

Commit

Permalink
fix for attaching video
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoishin committed Dec 17, 2024
1 parent 85f578d commit 931cc6e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/api/twitter.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,15 @@ export const tweet = async (text: string, files: string[]) => {
throw new Error("No file input");
}
await fileInput.uploadFile(...files);
await page.waitForSelector('div[data-testid="attachments"]');
await Promise.race([
page.waitForSelector('div[data-testid="attachments"] img'),
page.waitForSelector('div[data-testid="attachments"] video'),
]);
}

const tweetButton = await page.waitForSelector(
'button[data-testid="tweetButtonInline"]:not([aria-disabled="true"])'
'button[data-testid="tweetButtonInline"]:not([aria-disabled="true"])',
{ timeout: 120_000 }
);
if (!tweetButton) {
throw new Error("No tweet button");
Expand Down

0 comments on commit 931cc6e

Please sign in to comment.