-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dx): add setup leap connect for e2e
- Loading branch information
Showing
6 changed files
with
91 additions
and
32 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
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,27 +1,14 @@ | ||
import { expect, selectors } from "@playwright/test"; | ||
import { test } from "./utils/fixture"; | ||
|
||
import { SSH_VM_IMAGES } from "@src/utils/sdl/data"; | ||
import { DeployHelloWorldPage } from "./pages/DeployHelloWorldPage"; | ||
import { setupLeap } from "./utils/wallet"; | ||
|
||
test.beforeAll(async ({ page, extensionId }) => { | ||
page.waitForLoadState("domcontentloaded"); | ||
console.log("clicking seed"); | ||
selectors.setTestIdAttribute("data-testing-id"); | ||
// test.describe.configure({ mode: "serial" }); | ||
|
||
await page.goto(`chrome-extension://${extensionId}/index.html#/onboarding`); | ||
await page.getByTestId("import-seed-phrase").click(); | ||
test.only("deploy hello world", async ({ extPage: page, extensionId, context }) => { | ||
await setupLeap(context, page, extensionId); | ||
|
||
await page.locator(`//*[@id="root"]/div/div[2]/div/div[1]/div[1]/div/div[2]/div[1]`).click(); | ||
await page.locator("input").fill("test"); | ||
|
||
await page.pause(); | ||
|
||
selectors.setTestIdAttribute("data-testid"); | ||
}); | ||
|
||
test.only("deploy hello world", async ({ page }) => { | ||
console.log("testing"); | ||
const customTemplatePage = new DeployHelloWorldPage(page, "new-deployment", "build-template-card"); | ||
await customTemplatePage.gotoInteractive(); | ||
await page.pause(); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { selectors, type BrowserContext, type Page } from "@playwright/test"; | ||
|
||
export const setupLeap = async (context: BrowserContext, page: Page, extensionId: string) => { | ||
page.waitForLoadState("domcontentloaded"); | ||
selectors.setTestIdAttribute("data-testing-id"); | ||
|
||
await page.getByTestId("import-seed-phrase").click(); | ||
|
||
const mnemonic = process.env.TEST_WALLET_MNEMONIC; | ||
if (!mnemonic) { | ||
throw new Error("TEST_WALLET_MNEMONIC is not set"); | ||
} | ||
const mnemonicArray = mnemonic.split(" "); | ||
|
||
for (let i = 0; i < mnemonicArray.length; i++) { | ||
await page.locator(`//*[@id="root"]/div/div[2]/div/div[1]/div[1]/div/div[2]/div[${i + 1}]`).click(); | ||
await page.locator("input").last().fill(mnemonicArray[i]); | ||
} | ||
|
||
await page.getByTestId("btn-import-wallet").click(); | ||
|
||
// Select wallet | ||
await page.getByTestId("wallet-1").click(); | ||
await page.getByTestId("btn-select-wallet-proceed").click(); | ||
|
||
// Set password | ||
await page.getByTestId("input-password").fill("12345678"); | ||
await page.getByTestId("input-confirm-password").fill("12345678"); | ||
await page.getByTestId("btn-password-proceed").click(); | ||
|
||
await page.waitForLoadState("domcontentloaded"); | ||
|
||
// Reset test id attribute for console | ||
selectors.setTestIdAttribute("data-testid"); | ||
|
||
await page.goto("http://localhost:3000"); | ||
|
||
await page.getByTestId("welcome-modal-accept-button").click(); | ||
await page.getByTestId("connect-wallet-btn").click(); | ||
|
||
await page.getByRole("button", { name: "Leap Leap" }).click(); | ||
|
||
// Connect to Leap | ||
const popupPage = await context.waitForEvent("page"); | ||
await popupPage.waitForLoadState("domcontentloaded"); | ||
await popupPage.getByRole("button", { name: "Connect" }).click(); | ||
|
||
// await page.pause(); | ||
}; |