-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flip updated dApp connections flag (#3492)
- Loading branch information
Showing
13 changed files
with
180 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,96 @@ | ||
import { test } from "./utils" | ||
import { test, expect } from "./utils" | ||
|
||
test("dapp connect", async ({ page, context, walletPageHelper }) => { | ||
await walletPageHelper.onboarding.addReadOnlyAccount("testertesting.eth") | ||
test.describe("dApp Connections", () => { | ||
test("should display an informational popup for Taho as default on first connection", async ({ | ||
context, | ||
walletPageHelper, | ||
}) => { | ||
await walletPageHelper.onboarding.addReadOnlyAccount("testertesting.eth") | ||
|
||
const dappPage = await context.newPage() | ||
await dappPage.goto("https://swap.cow.fi/") | ||
await dappPage | ||
.locator("#swap-button") | ||
.getByRole("button", { name: "Connect Wallet" }) | ||
.click() | ||
const dappPage = await context.newPage() | ||
await dappPage.goto("https://swap.cow.fi/") | ||
await dappPage | ||
.locator("#swap-button") | ||
.getByRole("button", { name: "Connect Wallet" }) | ||
.click() | ||
|
||
// Get page after a specific action (e.g. clicking a link) | ||
const [popupPage] = await Promise.all([ | ||
context.waitForEvent("page"), | ||
await dappPage.locator("text=Injected").click(), // Opens a new tab | ||
]) | ||
await popupPage.waitForLoadState() | ||
// Get page after a specific action (e.g. clicking a link) | ||
const [popupPage] = await Promise.all([ | ||
context.waitForEvent("page"), | ||
await dappPage.locator("text=Injected").click(), // Opens a new tab | ||
]) | ||
await popupPage.waitForLoadState() | ||
|
||
await popupPage.locator("button", { hasText: "Connect" }).click() | ||
// Clear the one-time informational popup, if present. | ||
const connectingPopupTitle = popupPage.locator("h3", { | ||
hasText: "Connecting with Taho", | ||
}) | ||
|
||
await walletPageHelper.goToStartPage() | ||
expect(await connectingPopupTitle.count()).toBe(1) | ||
await expect(connectingPopupTitle).toBeVisible() | ||
|
||
await page.locator('text="Settings"').click() | ||
await page.locator("text=Connected websites").click() | ||
// Clear the popover. | ||
const popupCloseLocator = popupPage.getByRole("button", { | ||
name: "Background close", | ||
}) | ||
|
||
await page.locator('xpath=//li[contains(., "CoW Swap")]//button').click() | ||
await popupCloseLocator.click() | ||
await popupCloseLocator.waitFor({ state: "detached", timeout: 1000 }) | ||
|
||
await popupPage.locator("button", { hasText: "Reject" }).click() | ||
|
||
await dappPage.close() | ||
|
||
const dappPage2 = await context.newPage() | ||
await dappPage2.goto("https://swap.cow.fi/") | ||
await dappPage2 | ||
.locator("#swap-button") | ||
.getByRole("button", { name: "Connect Wallet" }) | ||
.click() | ||
|
||
// Get page after a specific action (e.g. clicking a link) | ||
const [popupPage2] = await Promise.all([ | ||
context.waitForEvent("page"), | ||
await dappPage2.locator("text=Injected").click(), // Opens a new tab | ||
]) | ||
await popupPage2.waitForLoadState() | ||
|
||
// Check that the popup is no longer displayed. | ||
const connectingPopupTitle2 = popupPage2.locator("h3", { | ||
hasText: "Connecting with Taho", | ||
}) | ||
expect(await connectingPopupTitle2.count()).toBe(0) | ||
}) | ||
|
||
test("should work and add an entry to the connected websites list", async ({ | ||
page, | ||
context, | ||
walletPageHelper, | ||
}) => { | ||
await walletPageHelper.onboarding.addReadOnlyAccount("testertesting.eth") | ||
await walletPageHelper.hideDappConnectPopup() | ||
|
||
const dappPage = await context.newPage() | ||
await dappPage.goto("https://swap.cow.fi/") | ||
await dappPage | ||
.locator("#swap-button") | ||
.getByRole("button", { name: "Connect Wallet" }) | ||
.click() | ||
|
||
// Get page after a specific action (e.g. clicking a link) | ||
const [popupPage] = await Promise.all([ | ||
context.waitForEvent("page"), | ||
await dappPage.locator("text=Injected").click(), // Opens a new tab | ||
]) | ||
await popupPage.waitForLoadState() | ||
|
||
await popupPage.locator("button", { hasText: "Connect" }).click() | ||
|
||
await walletPageHelper.goToStartPage() | ||
|
||
await page.locator('text="Settings"').click() | ||
await page.locator("text=Connected websites").click() | ||
|
||
await page.locator('xpath=//li[contains(., "CoW Swap")]//button').click() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,7 @@ html, | |
body, | ||
#tally-root { | ||
height: 100%; | ||
width: 100%; | ||
} | ||
|
||
body.popup { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters