Skip to content

Commit

Permalink
Fix broken e2e tests + upgrade purchases-ui-js version (#270)
Browse files Browse the repository at this point in the history
## Motivation / Description
This PR depends on
RevenueCat/purchases-ui-js#64.
Once that one is shipped, we can upgrade purchases-ui-js in here to use
`v0.0.19` and use the new test paywall offerings

To test this, you can run this locally with the latest version of
`purchases-ui-js` and load the dependency from there

## Changes introduced

## Linear ticket (if any)

## Additional comments

---------

Co-authored-by: Guido Torres <[email protected]>
  • Loading branch information
guido732 and Guido Torres authored Jan 8, 2025
1 parent 5bbe250 commit 8b51727
Show file tree
Hide file tree
Showing 3 changed files with 854 additions and 732 deletions.
15 changes: 7 additions & 8 deletions examples/rcbilling-demo/src/tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import type { Locator } from "playwright";

const _LOCAL_URL = "http://localhost:3001/";
const CARD_SELECTOR = "div.card";
const PACKAGE_SELECTOR = "button.package";
const RC_PAYWALL_TEST_OFFERING_ID = "rc_paywalls_e2e_test";
const PACKAGE_SELECTOR = "button.rc-pw-package";
const RC_PAYWALL_TEST_OFFERING_ID = "rc_paywalls_e2e_test_2";
const RC_PAYWALL_TEST_OFFERING_ID_WITH_VARIABLES =
"rc_paywalls_e2e_test_variables";
"rc_paywalls_e2e_test_variables_2";

test.describe("Main", () => {
test.afterEach(({ browser }) => {
Expand Down Expand Up @@ -88,13 +88,12 @@ test.describe("Main", () => {
offeringId: RC_PAYWALL_TEST_OFFERING_ID_WITH_VARIABLES,
useRcPaywall: true,
});

// Gets all packages
const packageCards = await getAllElementsByLocator(page, PACKAGE_SELECTOR);

// Get the purchase button as a Locator
const purchaseButton = (
await getAllElementsByLocator(page, "button.purchase-button")
await getAllElementsByLocator(page, "button.rc-pw-purchase-button")
)[0];

await expect(purchaseButton).toContainText(
Expand All @@ -115,7 +114,7 @@ test.describe("Main", () => {
}) => {
const userId = `${getUserId(browserName)}_subscription`;
const page = await setupTest(browser, userId, {
offeringId: RC_PAYWALL_TEST_OFFERING_ID,
offeringId: RC_PAYWALL_TEST_OFFERING_ID_WITH_VARIABLES,
useRcPaywall: true,
});
const title = page.getByText("E2E Tests for Purchases JS");
Expand All @@ -129,7 +128,7 @@ test.describe("Main", () => {

// Get the purchase button as a Locator
const purchaseButton = (
await getAllElementsByLocator(page, "button.purchase-button")
await getAllElementsByLocator(page, "button.rc-pw-purchase-button")
)[0];

await expect(purchaseButton).toBeVisible();
Expand Down Expand Up @@ -263,7 +262,7 @@ test.describe("Main", () => {

// Get the purchase button as a Locator
const purchaseButton = (
await getAllElementsByLocator(page, "button.purchase-button")
await getAllElementsByLocator(page, "button.rc-pw-purchase-button")
)[0];

await expect(purchaseButton).toBeVisible();
Expand Down
Loading

0 comments on commit 8b51727

Please sign in to comment.