Skip to content

Commit

Permalink
use xpath
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkShawn2020 committed Mar 31, 2024
1 parent 8456fd9 commit 0d902f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/components/card-gen-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const Controls = ({
)}

<ButtonWithLoading
id={"copy-card"}
loading={coping}
onClick={async () => {
setCoping(true)
Expand All @@ -119,6 +120,7 @@ export const Controls = ({
</ButtonWithLoading>

<ButtonWithLoading
id={"download-card"}
loading={downloading}
onClick={async () => {
setDownloading(true)
Expand Down
1 change: 1 addition & 0 deletions src/components/card-gen-input-line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const InputLine = () => {
/>

<Button
id={"generate-card"}
onClick={async () => {
const card = await genCardFromUrl(inputUrl, options)
console.log("-- parsed card: ", card)
Expand Down
10 changes: 6 additions & 4 deletions src/core/download-card.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export const downloadCardAction = async (
console.log("-- to input: ", url)
await page.getByPlaceholder(GEN_CARD_INPUT_PLACEHOLDER).fill(url)
console.log("-- to click generate button")
await page.getByRole("button", { name: /generate card/i }).click()
await page.locator("#generate-card").click()
// await page.getByRole("button", { name: /generate card/i }).click()
console.log("-- to wait card generated")
await sleep(3000)
// await page.waitForFunction(() => {
Expand All @@ -59,9 +60,10 @@ export const downloadCardAction = async (
// })

console.log("-- to click download button")
await page
.getByRole("button", { name: /download card/i })
.click({ timeout: 3000 })
await page.locator("#download-card").click()
// await page
// .getByRole("button", { name: /download card/i })
// .click({ timeout: 3000 })
},
)
}

0 comments on commit 0d902f4

Please sign in to comment.