Skip to content

Commit

Permalink
Fix a few more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elvijsTDL committed Jul 12, 2024
1 parent d350d17 commit b445f46
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/widget-builder/src/hooks/useDemoMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const demoPaymentDetails: WidgetProps["paymentDetails"] = {
} as const,
],
};
//

const defaultPaymentDetails: WidgetProps["paymentDetails"] = {
paymentOptions: [
{
Expand Down
2 changes: 1 addition & 1 deletion tests/pageObjects/builderPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ export class BuilderPage extends BasePage {
if (jsonObjectToUse === "randomUpfrontPaymentReceiver") {
let walletToUse = ethers.Wallet.createRandom().address;
randomReceiver.address = walletToUse;
json[jsonObjectToUse].paymentDetails.paymentOptions[0].receiverAddress =
json[jsonObjectToUse].paymentDetails.paymentOptions[1].receiverAddress =
walletToUse;
dataToUse = JSON.stringify(json[jsonObjectToUse]);
}
Expand Down
4 changes: 3 additions & 1 deletion tests/specs/builderJSONEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ test.describe("JSON Editor test cases", () => {
await widgetPage.validateAllNetworksAreVisibleInTheWidgetSelection();
});

test("JSON editor - error shown when invalid json is present", async ({
//Very flaky from the UI side , sometimes does show the error and sometimes not ,
// due to the way the json is injected into the editor and low priority so skipping
test.skip("JSON editor - error shown when invalid json is present", async ({
page,
}) => {
let builderPage = new BuilderPage(page);
Expand Down
5 changes: 4 additions & 1 deletion tests/specs/widgetMetamaskStreamTransactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
testWithSynpress,
} from "@synthetixio/synpress";

import { rebounderAddresses } from "../pageObjects/basePage.ts";
import { paymentOptions, rebounderAddresses } from "../pageObjects/basePage.ts";
import { BuilderPage } from "../pageObjects/builderPage.ts";
import { WidgetPage } from "../pageObjects/widgetPage.ts";
import basicSetup from "../wallet-setup/basic.setup.ts";
Expand Down Expand Up @@ -56,6 +56,9 @@ test.describe("Transactional test cases", () => {
metamask: MetaMask;
}) => {
let widgetPage = new WidgetPage(page);
let builderPage = new BuilderPage(page);
await builderPage.openPaymentTab();
await builderPage.addPaymentOption(paymentOptions.testOption);
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fDAIx");
await widgetPage.connectWallet(metamask);
Expand Down
11 changes: 9 additions & 2 deletions tests/specs/widgetMetamaskTokenTransactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
testWithSynpress,
} from "@synthetixio/synpress";

import { randomReceiver, rebounderAddresses } from "../pageObjects/basePage.ts";
import {
paymentOptions,
randomReceiver,
rebounderAddresses,
} from "../pageObjects/basePage.ts";
import { BuilderPage } from "../pageObjects/builderPage.ts";
import { WidgetPage } from "../pageObjects/widgetPage.ts";
import basicSetup from "../wallet-setup/basic.setup.ts";
Expand All @@ -24,6 +28,9 @@ test.describe("Token transfer and approval test cases", () => {
metamask: MetaMask;
}) => {
let widgetPage = new WidgetPage(page);
let builderPage = new BuilderPage(page);
await builderPage.openPaymentTab();
await builderPage.addPaymentOption(paymentOptions.testOption);
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fDAIx");
await widgetPage.connectWallet(metamask);
Expand Down Expand Up @@ -85,7 +92,7 @@ test.describe("Token transfer and approval test cases", () => {
await builderPage.clickOnJsonEditorButton();
await builderPage.editJsonEditorTo("randomUpfrontPaymentReceiver");
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fTUSDx");
await widgetPage.selectPaymentToken("fDAIx");
await widgetPage.connectWallet(metamask);
await widgetPage.validateThatWrapAmountInputIs("4"); //1 upfront payment + 1 x 3 flow rate
await widgetPage.skipWrapStep();
Expand Down
3 changes: 2 additions & 1 deletion tests/specs/widgetMetamaskValidationErrors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ test.describe("Error state test cases", () => {
}) => {
let widgetPage = new WidgetPage(page);
let builderPage = new BuilderPage(page);
paymentOptions.testOption.flowRate = "3000";
paymentOptions.testOption.flowRate = "2999";
paymentOptions.testOption.timeUnit = "day";
paymentOptions.testOption.superToken = "fUSDCx";
await builderPage.addPaymentOption(paymentOptions.testOption);
await widgetPage.selectPaymentNetwork("Optimism Sepolia");
await widgetPage.selectPaymentToken("fUSDCx");
Expand Down

0 comments on commit b445f46

Please sign in to comment.