mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add suspend subscription to my account
This commit is contained in:
parent
610ba3e935
commit
74d1b03463
2 changed files with 54 additions and 1 deletions
|
@ -107,7 +107,7 @@ test.describe.serial('Subscriptions Merchant', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test.describe('Subscriptions Customer', () => {
|
||||
test.describe('Subscriber purchase a Subscription', () => {
|
||||
test('Purchase Subscription from Checkout Page', async ({page}) => {
|
||||
await loginAsCustomer(page);
|
||||
|
||||
|
@ -186,4 +186,36 @@ test.describe('Subscriptions Customer', () => {
|
|||
const title = page.locator('.entry-title');
|
||||
await expect(title).toHaveText('Order received');
|
||||
});
|
||||
|
||||
test('Subscriber Suspend Subscription', async ({page, request}) => {
|
||||
await loginAsCustomer(page);
|
||||
await page.goto('/my-account/subscriptions');
|
||||
await page.locator('text=View').first().click();
|
||||
|
||||
const subscriptionId = await page.locator('#ppcp-subscription-id').textContent();
|
||||
let subscription = await request.get(`https://api.sandbox.paypal.com/v1/billing/subscriptions/${subscriptionId}`, {
|
||||
headers: {
|
||||
'Authorization': AUTHORIZATION,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
expect(subscription.ok()).toBeTruthy();
|
||||
let details = await subscription.json();
|
||||
await expect(details.status).toBe('ACTIVE');
|
||||
|
||||
await page.locator('text=Suspend').click();
|
||||
const title = page.locator('.woocommerce-message');
|
||||
await expect(title).toHaveText('Your subscription has been cancelled.');
|
||||
|
||||
subscription = await request.get(`https://api.sandbox.paypal.com/v1/billing/subscriptions/${subscriptionId}`, {
|
||||
headers: {
|
||||
'Authorization': AUTHORIZATION,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
expect(subscription.ok()).toBeTruthy();
|
||||
|
||||
details = await subscription.json();
|
||||
await expect(details.status).toBe('SUSPENDED');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue