Skip to content

Commit

Permalink
e2e: add upsell testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
girishpanchal30 committed Dec 27, 2024
1 parent 528aac9 commit 717c3c2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/e2e/specs/upsell.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,33 @@ test.describe( 'Upsell', () => {
await expect( upgradeAlert ).toBeVisible();
} );
});

test.describe( 'List Page Upsell', () => {
test.beforeEach( async ( { requestUtils, page } ) => {
await page.goto('/wp-admin/edit.php?post_type=feedzy_imports');
} );

test('Import/Export', async ({ editor, page }) => {
// Locate and click the "Import Job" link
const importButton = page.getByRole('link', { name: 'Import Job', exact: true });
await expect(importButton).toBeVisible();

Check failure on line 83 in tests/e2e/specs/upsell.spec.js

View workflow job for this annotation

GitHub Actions / E2E

[chromium] › upsell.spec.js:80:9 › List Page Upsell › Import/Export

1) [chromium] › upsell.spec.js:80:9 › List Page Upsell › Import/Export ─────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: getByRole('link', { name: 'Import Job', exact: true }) Expected: visible Received: <element(s) not found> Call log: - expect.toBeVisible with timeout 5000ms - waiting for getByRole('link', { name: 'Import Job', exact: true }) 81 | // Locate and click the "Import Job" link 82 | const importButton = page.getByRole('link', { name: 'Import Job', exact: true }); > 83 | await expect(importButton).toBeVisible(); | ^ 84 | await importButton.click(); 85 | 86 | // Wait for the popup to become visible at /home/runner/work/feedzy-rss-feeds/feedzy-rss-feeds/tests/e2e/specs/upsell.spec.js:83:36

Check failure on line 83 in tests/e2e/specs/upsell.spec.js

View workflow job for this annotation

GitHub Actions / E2E

[chromium] › upsell.spec.js:80:9 › List Page Upsell › Import/Export

1) [chromium] › upsell.spec.js:80:9 › List Page Upsell › Import/Export ─────────────────────────── Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: getByRole('link', { name: 'Import Job', exact: true }) Expected: visible Received: <element(s) not found> Call log: - expect.toBeVisible with timeout 5000ms - waiting for getByRole('link', { name: 'Import Job', exact: true }) 81 | // Locate and click the "Import Job" link 82 | const importButton = page.getByRole('link', { name: 'Import Job', exact: true }); > 83 | await expect(importButton).toBeVisible(); | ^ 84 | await importButton.click(); 85 | 86 | // Wait for the popup to become visible at /home/runner/work/feedzy-rss-feeds/feedzy-rss-feeds/tests/e2e/specs/upsell.spec.js:83:36

Check failure on line 83 in tests/e2e/specs/upsell.spec.js

View workflow job for this annotation

GitHub Actions / E2E

[chromium] › upsell.spec.js:80:9 › List Page Upsell › Import/Export

1) [chromium] › upsell.spec.js:80:9 › List Page Upsell › Import/Export ─────────────────────────── Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: getByRole('link', { name: 'Import Job', exact: true }) Expected: visible Received: <element(s) not found> Call log: - expect.toBeVisible with timeout 5000ms - waiting for getByRole('link', { name: 'Import Job', exact: true }) 81 | // Locate and click the "Import Job" link 82 | const importButton = page.getByRole('link', { name: 'Import Job', exact: true }); > 83 | await expect(importButton).toBeVisible(); | ^ 84 | await importButton.click(); 85 | 86 | // Wait for the popup to become visible at /home/runner/work/feedzy-rss-feeds/feedzy-rss-feeds/tests/e2e/specs/upsell.spec.js:83:36
await importButton.click();

// Wait for the popup to become visible
const upsellPopup = page.locator('#fz_import_export_upsell');
await expect(upsellPopup).toBeVisible();

// Locate and check the "Upgrade to PRO" link inside the popup
const upgradeToProLink = upsellPopup.locator('a', { hasText: 'Upgrade to PRO' });
await expect(upgradeToProLink).toBeVisible();

// Get the URL from the "Upgrade to PRO" link
const upsellLink = new URL(await upgradeToProLink.getAttribute('href'));

// Validate the URL parameters
expect(upsellLink.host).toBe('themeisle.com');
expect(upsellLink.searchParams.get('utm_source')).toBe('wpadmin');
expect(upsellLink.searchParams.get('utm_medium')).toBe('edit');
expect(upsellLink.searchParams.get('utm_content')).toBe('feedzy-rss-feeds');
});
});

0 comments on commit 717c3c2

Please sign in to comment.