-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: brunobar79 <[email protected]> Co-authored-by: gregs <[email protected]> Co-authored-by: Esteban Miño <[email protected]> Co-authored-by: Christopher Howard <[email protected]> Co-authored-by: DanielSinclair <[email protected]>
- Loading branch information
1 parent
0fa7c1d
commit e7c8fb1
Showing
11 changed files
with
319 additions
and
46 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
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,78 @@ | ||
import 'chromedriver'; | ||
import 'geckodriver'; | ||
import { WebDriver } from 'selenium-webdriver'; | ||
import { afterAll, beforeAll, describe, expect, it } from 'vitest'; | ||
|
||
import { | ||
delayTime, | ||
findElementByTestIdAndClick, | ||
findElementByText, | ||
getExtensionIdByName, | ||
getTextFromText, | ||
goToPopup, | ||
goToWelcome, | ||
initDriverWithOptions, | ||
shortenAddress, | ||
typeOnTextInput, | ||
} from '../helpers'; | ||
|
||
let rootURL = 'chrome-extension://'; | ||
let driver: WebDriver; | ||
|
||
const browser = process.env.BROWSER || 'chrome'; | ||
const os = process.env.OS || 'mac'; | ||
const wallet = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'; | ||
|
||
describe('Import wallet flow', () => { | ||
beforeAll(async () => { | ||
driver = await initDriverWithOptions({ | ||
browser, | ||
os, | ||
}); | ||
const extensionId = await getExtensionIdByName(driver, 'Rainbow'); | ||
if (!extensionId) throw new Error('Extension not found'); | ||
rootURL += extensionId; | ||
}); | ||
|
||
afterAll(async () => driver.quit()); | ||
|
||
// Import a wallet | ||
it('should be able import a wallet via pkey', async () => { | ||
// Start from welcome screen | ||
await goToWelcome(driver, rootURL); | ||
await findElementByTestIdAndClick({ | ||
id: 'import-wallet-button', | ||
driver, | ||
}); | ||
await findElementByTestIdAndClick({ | ||
id: 'import-wallet-option', | ||
driver, | ||
}); | ||
|
||
await typeOnTextInput({ | ||
id: 'secret-textarea', | ||
driver, | ||
text: '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', | ||
}); | ||
|
||
await findElementByTestIdAndClick({ | ||
id: 'import-wallets-button', | ||
driver, | ||
}); | ||
|
||
await typeOnTextInput({ id: 'password-input', driver, text: 'test1234' }); | ||
await typeOnTextInput({ | ||
id: 'confirm-password-input', | ||
driver, | ||
text: 'test1234', | ||
}); | ||
await findElementByTestIdAndClick({ id: 'set-password-button', driver }); | ||
await delayTime('long'); | ||
await findElementByText(driver, 'Your wallets ready'); | ||
|
||
goToPopup(driver, rootURL); | ||
await delayTime('short'); | ||
const account = await getTextFromText({ id: 'account-name', driver }); | ||
expect(account).toBe(await shortenAddress(wallet)); | ||
}); | ||
}); |
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,13 @@ | ||
import { mergeConfig } from 'vite'; | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
import viteConfig from '../vitest.config'; | ||
|
||
export default mergeConfig( | ||
viteConfig, | ||
defineConfig({ | ||
test: { | ||
threads: false, | ||
}, | ||
}), | ||
); |
Oops, something went wrong.