Add subscription from cart page

This commit is contained in:
Emili Castells Guasch 2023-03-30 14:47:28 +02:00
parent 50dd59ec77
commit 610ba3e935
3 changed files with 69 additions and 1 deletions

View file

@ -111,7 +111,7 @@ test.describe('Subscriptions Customer', () => {
test('Purchase Subscription from Checkout Page', async ({page}) => {
await loginAsCustomer(page);
await page.goto('/product/another-sub');
await page.goto('/product/subscription');
await page.click("text=Sign up now");
await page.goto('/checkout');
await fillCheckoutForm(page);
@ -159,4 +159,31 @@ test.describe('Subscriptions Customer', () => {
const title = page.locator('.entry-title');
await expect(title).toHaveText('Order received');
});
test('Purchase Subscription from Cart Page', async ({page}) => {
await loginAsCustomer(page);
await page.goto('/product/subscription');
await page.click("text=Sign up now");
await page.goto('/cart');
const [popup] = await Promise.all([
page.waitForEvent('popup'),
page.frameLocator('.component-frame').locator('[data-funding-source="paypal"]').click(),
]);
await popup.waitForLoadState();
await popup.fill('#email', CUSTOMER_EMAIL);
await popup.locator('#btnNext').click();
await popup.fill('#password', CUSTOMER_PASSWORD);
await popup.locator('#btnLogin').click();
await popup.locator('text=Continue').click();
await popup.locator('#confirmButtonTop').click();
await fillCheckoutForm(page);
await page.locator('text=Sign up now').click();
const title = page.locator('.entry-title');
await expect(title).toHaveText('Order received');
});
});