-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flip updated dApp connections flag #3492
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
76d8172
Flip updated dApp connections flag
Shadowfiend 70f5d89
Update How to connect to dapp box to new connections UI
Shadowfiend 2ae0359
Merge branch 'main' into dapp-connection-flip
Shadowfiend 60ed423
Add e2e hideDappConnectPopup helper to walletPageHelper
Shadowfiend 9e3fb5b
Test correct first-time dApp Connect popover behavior
Shadowfiend c82f7b4
Fix a stray dApp instead of website mention in messages.json
Shadowfiend 95fac2e
Only auto-dismiss Connect popup when default transitions to false
Shadowfiend 2578d1f
Fix document sizing in dApp Connection popup for e2e tests
Shadowfiend c9fc250
Merge branch 'main' into dapp-connection-flip
Shadowfiend 0c940fb
Don't resend to Taho when it is fallback and default is switched off
Shadowfiend 93cdbc7
Properly track previous wallet state for off->on->off default flow
Shadowfiend 220a0b8
Target background close button by role
Shadowfiend 31287cb
Merge branch 'main' into dapp-connection-flip
hyphenized File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth running one small dApp along hardhat for some standard tests of this kind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would really love to avoid more stuff we have to maintain tbh, but agree this is a pretty kludgey way to do it.