-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
89 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './getExtensionId' | ||
export * from './prepareExtension' |
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,24 @@ | ||
import type { BrowserContext } from '@playwright/test' | ||
|
||
export async function persistLocalStorage( | ||
origins: { | ||
origin: string | ||
localStorage: { name: string; value: string }[] | ||
}[], | ||
context: BrowserContext | ||
) { | ||
const newPage = await context.newPage() | ||
|
||
for (const { origin, localStorage } of origins) { | ||
const frame = newPage.mainFrame() | ||
await frame.goto(origin) | ||
|
||
await frame.evaluate((localStorageData) => { | ||
localStorageData.forEach(({ name, value }) => { | ||
window.localStorage.setItem(name, value) | ||
}) | ||
}, localStorage) | ||
} | ||
|
||
await newPage.close() | ||
} |
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,18 @@ | ||
import type { Page } from '@playwright/test' | ||
import { unlock } from './actions' | ||
import Selectors from './selectors' | ||
|
||
export class LockPage { | ||
static readonly selectors = Selectors | ||
readonly selectors = Selectors | ||
|
||
readonly page: Page | ||
|
||
constructor(page: Page) { | ||
this.page = page | ||
} | ||
|
||
async unlock(password: string) { | ||
await unlock(this.page, password) | ||
} | ||
} |
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,17 @@ | ||
export default { | ||
createWalletButton: 'Create a new wallet', | ||
importRecoveryPhraseButton: 'Import existing recovery phrase', | ||
useRecoveryPhraseButton: 'Use recovery phrase or private key', | ||
phraseCount24: '24 words', | ||
walletName: 'My wallet', | ||
phraseSelectChain: 'Select Chains', | ||
phraseAccountCreated: 'Account Created!', | ||
walletInput: 'input[name="name"]:focus', | ||
passwordInput: 'input[name="password"]', | ||
confirmPasswordInput: 'input[name="confirmPassword"]', | ||
submitWalletDataButton: 'button[type="submit"]', | ||
submitChainButton: 'button[type="button"]', | ||
finishButton: 'button[type="button"]', | ||
textAreaSelector: 'textbox', | ||
submitPhraseButton: 'button[type="submit"]', | ||
}; |
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,18 @@ | ||
import type { Page } from '@playwright/test' | ||
import { unlock } from './actions' | ||
import Selectors from './selectors' | ||
|
||
export class LockPage { | ||
static readonly selectors = Selectors | ||
readonly selectors = Selectors | ||
|
||
readonly page: Page | ||
|
||
constructor(page: Page) { | ||
this.page = page | ||
} | ||
|
||
async unlock(password: string) { | ||
await unlock(this.page, password) | ||
} | ||
} |
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,3 @@ | ||
export default { | ||
approveButton: 'button[type="button"]', | ||
}; |
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,7 @@ | ||
export const createDataTestSelector = (dataTestId: string) => { | ||
if (dataTestId.includes(' ')) { | ||
throw new Error('[CreateDataTestSelector] dataTestId cannot contain spaces') | ||
} | ||
|
||
return `[data-testid="${dataTestId}"]` | ||
} |