Skip to content

Commit 8f7f6c7

Browse files
e2e: add upsell testcase
1 parent eff6dc4 commit 8f7f6c7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/e2e/specs/upsell.spec.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,33 @@ test.describe( 'Upsell', () => {
4343
await expect( upgradeAlert ).toBeVisible();
4444
} );
4545
});
46+
47+
test.describe( 'List Page Upsell', () => {
48+
test.beforeEach( async ( { requestUtils, page } ) => {
49+
await page.goto('/wp-admin/edit.php?post_type=feedzy_imports');
50+
} );
51+
52+
test('Import/Export', async ({ editor, page }) => {
53+
// Locate and click the "Import Job" link
54+
const importButton = page.getByRole('link', { name: 'Import Job', exact: true });
55+
await expect(importButton).toBeVisible();
56+
await importButton.click();
57+
58+
// Wait for the popup to become visible
59+
const upsellPopup = page.locator('#fz_import_export_upsell');
60+
await expect(upsellPopup).toBeVisible();
61+
62+
// Locate and check the "Upgrade to PRO" link inside the popup
63+
const upgradeToProLink = upsellPopup.locator('a', { hasText: 'Upgrade to PRO' });
64+
await expect(upgradeToProLink).toBeVisible();
65+
66+
// Get the URL from the "Upgrade to PRO" link
67+
const upsellLink = new URL(await upgradeToProLink.getAttribute('href'));
68+
69+
// Validate the URL parameters
70+
expect(upsellLink.host).toBe('themeisle.com');
71+
expect(upsellLink.searchParams.get('utm_source')).toBe('wpadmin');
72+
expect(upsellLink.searchParams.get('utm_medium')).toBe('edit');
73+
expect(upsellLink.searchParams.get('utm_content')).toBe('feedzy-rss-feeds');
74+
});
75+
});

0 commit comments

Comments
 (0)