#gena_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1318243244827480106
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
`import { test, expect, Page } from '@playwright/test';
/**
- Fills Credit card information on the standard checkout page and validates successful payment processing.
- @param page
- @param checkoutLink
*/
export const checkout = async (page:Page, checkoutLink) => {
let testCardNumber = '4242 4242 4242 4242';
let expDate = '12 / 29';
let cvv = '123';
await page.goto(checkoutLink);
// Ensure we're always filling form out from the US ("ZIP" is US-only)
await page.locator('#billingCountry').selectOption('US');
// Fill input[name="email"]
var currentTime = Date.now();
var demoUsername = 'demobuyeruser' + Math.floor(currentTime / 1000);
await page.locator('input[name="email"]').type(demoUsername + '@mail.com', {delay: 30});
// Fill [placeholder="\31 234 1234 1234 1234"]
// replace it with .type(value, {delay: 30})
await page.locator('[placeholder="\31 234 1234 1234 1234"]').type(testCardNumber, {delay: 30});
// Fill [placeholder="MM / YY"]
await page.locator('[placeholder="MM \/ YY"]').type(expDate, {delay: 30});
// Fill [placeholder="CVC"]
await page.locator('[placeholder="CVC"]').type(cvv, {delay: 30});
// Fill input[name="billingName"]
await page.locator('input[name="billingName"]').type('Demo user', {delay: 30});
// Fill [placeholder="ZIP"]
await page.locator('[placeholder="ZIP"]').type('94080', {delay: 30});
const phone = await page.locator('#phoneNumber').first();
if (phone.isVisible()) {
await phone.type('4242424242', {delay: 30});
}
// Click [data-testid="hosted-payment-submit-button"]
await page.locator('[data-testid="hosted-payment-submit-button"]').click();
// Click text=Thanks for your payment
await page.locator('text=Thanks for your payment').click();
};`
this is the checkout.ts where i'm having trouble.
The checkout UI in the documentation differs from the real one
I don't know if that's the real problem, but I noticed this while trying to figure this out and maybe it might work
Hi there ๐ unfortunately, we're not able to assist with completing our certification challenges.