Skip to content

Commit

Permalink
This should leave only the tx tests broken
Browse files Browse the repository at this point in the history
  • Loading branch information
elvijsTDL committed Jul 11, 2024
1 parent 4bc2ac0 commit f436093
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ const ImageSelect: FC<ImageSelectProps> = ({
/>
</Box>
) : (
<Button fullWidth sx={{ p: 0, m: 0 }} onClick={triggerFileUpload}>
<Button
data-testid="file-upload-button"
fullWidth
sx={{ p: 0, m: 0 }}
onClick={triggerFileUpload}
>
<input
data-testid="file-upload-field"
hidden
Expand Down
11 changes: 11 additions & 0 deletions apps/widget-builder/src/hooks/useDemoMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ const defaultProductDetails: ProductDetails = {

const demoPaymentDetails: WidgetProps["paymentDetails"] = {
paymentOptions: [
{
receiverAddress: "0xf26ce9749f29e61c25d0333bce2301cb2dfd3a22", // rebounder
chainId: supportedNetwork.optimismSepolia.id,
superToken: {
address: "0x0043d7c85c8b96a49a72a92c0b48cdc4720437d7", // ETHx
},
flowRate: {
amountEther: "1",
period: "month",
},
} as const,
{
receiverAddress: "0xf26ce9749f29e61c25d0333bce2301cb2dfd3a22", // rebounder
chainId: supportedNetwork.optimismSepolia.id,
Expand Down
9 changes: 9 additions & 0 deletions tests/pageObjects/basePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ export const demoOptions: PaymentOption[] = [
timeUnit: "month",
userDefinedRate: true,
},
{
network: "Optimism Sepolia",
superToken: "ETHx",
superTokenName: "ETHx",
chainId: "11155420",
flowRate: "1",
receiver: "0xF26Ce9749f29E61c25d0333bCE2301CB2DFd3a22",
timeUnit: "month",
},
];

export class BasePage {
Expand Down
4 changes: 3 additions & 1 deletion tests/pageObjects/builderPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class BuilderPage extends BasePage {
readonly editorErrorMessage: Locator;
readonly editorHoverErrorMessage: Locator;
readonly gatingTabSwitch: Locator;
readonly uploadImageButton: Locator;

paymentOptionDuringTest: PaymentOption | PartialPaymentOption | undefined;
paymentFormFieldWordMap: Map<string, Locator>;
Expand Down Expand Up @@ -177,6 +178,7 @@ export class BuilderPage extends BasePage {
this.summaryEditButtons = page.getByTestId("edit-payment-option-button");
this.summaryCopyButtons = page.getByTestId("clone-payment-option-button");
this.uploadImageField = page.getByTestId("file-upload-field");
this.uploadImageButton = page.getByTestId("file-upload-button");
this.darkModeSwitch = page.getByLabel("Dark mode: off");
this.containerBorderSlider = page.getByTestId("container-radius-slider");
this.containerBorderSliderValue = page.getByTestId(
Expand Down Expand Up @@ -1396,7 +1398,7 @@ export class BuilderPage extends BasePage {
await this.contractOwnerInputField.fill(nftDetails.owner);
}
if (nftDetails.image) {
await this.uploadImageField.scrollIntoViewIfNeeded();
await this.uploadImageButton.scrollIntoViewIfNeeded();
await this.uploadImageField.setInputFiles(nftDetails.image);
}
if (nftDetails.networks) {
Expand Down
3 changes: 2 additions & 1 deletion tests/pageObjects/widgetPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ export class WidgetPage extends BasePage {

async clickContinueButton() {
await test.step(`Clicking on the continue button`, async () => {
await this.continueButton.click();
await this.continueButton.scrollIntoViewIfNeeded();
await this.continueButton.click({ timeout: 30000 });
});
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/specs/widgetConfigurationTests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test.describe("Widget configuration test cases", () => {
metamask: MetaMask;
}) => {
let widgetPage = new WidgetPage(page);
await widgetPage.selectPaymentNetwork("11155420");
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fUSDCx");
await widgetPage.connectWallet(metamask);
await widgetPage.validateThatWrapAmountInputIs("3");
Expand Down
4 changes: 2 additions & 2 deletions tests/specs/widgetMetamaskStreamTransactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test.describe("Transactional test cases", () => {
await builderPage.openPaymentTab();
await builderPage.clickOnWandButton();
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fDAIx");
await widgetPage.selectPaymentToken("ETHx");
await widgetPage.connectWallet(metamask);
await widgetPage.skipWrapStep();
await widgetPage.validateAndSaveSenderAndReceiverAddresses(
Expand Down Expand Up @@ -57,7 +57,7 @@ test.describe("Transactional test cases", () => {
}) => {
let widgetPage = new WidgetPage(page);
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fUSDCx");
await widgetPage.selectPaymentToken("fDAIx");
await widgetPage.connectWallet(metamask);
await widgetPage.setWrapAmount("0");
await widgetPage.clickContinueButton();
Expand Down
6 changes: 3 additions & 3 deletions tests/specs/widgetMetamaskTokenTransactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ test.describe("Token transfer and approval test cases", () => {
}) => {
let widgetPage = new WidgetPage(page);
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fUSDCx");
await widgetPage.selectPaymentToken("fDAIx");
await widgetPage.connectWallet(metamask);
await widgetPage.validateAndSaveWrapPageBalances(
"Optimism Sepolia",
"fUSDCx",
"fDAIx",
);
await widgetPage.setWrapAmount("1");
await widgetPage.clickContinueButton();
Expand Down Expand Up @@ -85,7 +85,7 @@ test.describe("Token transfer and approval test cases", () => {
await builderPage.clickOnJsonEditorButton();
await builderPage.editJsonEditorTo("randomUpfrontPaymentReceiver");
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fTUSD");
await widgetPage.selectPaymentToken("fTUSDx");
await widgetPage.connectWallet(metamask);
await widgetPage.validateThatWrapAmountInputIs("4"); //1 upfront payment + 1 x 3 flow rate
await widgetPage.skipWrapStep();
Expand Down
6 changes: 3 additions & 3 deletions tests/specs/widgetMetamaskValidationErrors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ test.describe("Error state test cases", () => {
let builderPage = new BuilderPage(page);
paymentOptions.testOption.flowRate = "99999999";
await builderPage.addPaymentOption(paymentOptions.testOption);
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fUSDCx");
await widgetPage.selectPaymentNetwork(paymentOptions.testOption.network);
await widgetPage.selectPaymentToken(paymentOptions.testOption.superToken);
await widgetPage.connectWallet(metamask);
await widgetPage.setWrapAmount("0");
await widgetPage.clickContinueButton();
Expand All @@ -82,7 +82,7 @@ test.describe("Error state test cases", () => {
}) => {
let widgetPage = new WidgetPage(page);
let builderPage = new BuilderPage(page);
paymentOptions.testOption.flowRate = "1";
paymentOptions.testOption.flowRate = "3000";
paymentOptions.testOption.timeUnit = "day";
await builderPage.addPaymentOption(paymentOptions.testOption);
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
Expand Down
2 changes: 1 addition & 1 deletion tests/wallet-setup/basic.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ await ethHelper.revokeAllowanceIfNeccesary(

//Delete flow before tests, otherwise the widget might not pick it up
await ethHelper.deleteFlowIfNeccesary(
"fDAIx",
"ETHx",
process.env.WIDGET_WALLET_PUBLIC_KEY!,
rebounderAddresses["optimism-sepolia"],
);
Expand Down

0 comments on commit f436093

Please sign in to comment.