-
Notifications
You must be signed in to change notification settings - Fork 5
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
ost-ptk
committed
Nov 15, 2023
1 parent
a498e9a
commit ab104eb
Showing
1 changed file
with
42 additions
and
43 deletions.
There are no files selected for viewing
85 changes: 42 additions & 43 deletions
85
e2e-tests/popup/import-account-with-file/import-account-with-file.spec.ts
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,63 +1,62 @@ | ||
import { popup, popupExpect } from '../../fixtures'; | ||
import { ACCOUNT_NAMES, IMPORTED_ACCOUNT, secretKeyPath } from '../../common'; | ||
// import { ACCOUNT_NAMES, IMPORTED_ACCOUNT, secretKeyPath } from '../../common'; | ||
|
||
popup.describe('Popup UI: import account with file', () => { | ||
popup( | ||
'should import account with file', | ||
async ({ unlockVault, popupPage, context }) => { | ||
async ({ unlockVault, popupPage, context, browser }) => { | ||
await unlockVault(popupPage); | ||
|
||
await popupPage.getByTestId('menu-open-icon').click(); | ||
|
||
// const newPagePromise = context.waitForEvent('page'); | ||
// await popupPage.getByText('Import account').click(); | ||
// const importAccountPage = await newPagePromise; | ||
await popupPage.getByText('Import account').click(); | ||
const importAccountPage = await context.waitForEvent('page'); | ||
|
||
const [importAccountPage] = await Promise.all([ | ||
context.waitForEvent('page', { timeout: 5000 }), | ||
popupPage.getByText('Import account').click() | ||
]); | ||
// const [importAccountPage] = await Promise.all([ | ||
// context.waitForEvent('page'), | ||
// popupPage.getByText('Import account').click() | ||
// ]); | ||
|
||
const fileChooserPromise = importAccountPage.waitForEvent('filechooser'); | ||
// const fileChooserPromise = importAccountPage.waitForEvent('filechooser'); | ||
|
||
await popupExpect( | ||
importAccountPage.getByRole('heading', { | ||
name: 'Import account from secret key file' | ||
}) | ||
).toBeVisible(); | ||
|
||
await importAccountPage | ||
.getByRole('button', { name: 'Upload your file' }) | ||
.click(); | ||
|
||
const fileChooser = await fileChooserPromise; | ||
await fileChooser.setFiles(secretKeyPath); | ||
|
||
await importAccountPage | ||
.getByPlaceholder('Account name', { exact: true }) | ||
.fill(ACCOUNT_NAMES.importedAccountName); | ||
|
||
await importAccountPage.getByRole('button', { name: 'Import' }).click(); | ||
|
||
await popupExpect( | ||
importAccountPage.getByRole('heading', { | ||
name: 'Your account was successfully imported' | ||
}) | ||
).toBeVisible(); | ||
|
||
await importAccountPage.getByRole('button', { name: 'Done' }).click(); | ||
|
||
await popupPage.getByTestId('connection-status-modal').click(); | ||
|
||
await popupExpect( | ||
popupPage.getByText(ACCOUNT_NAMES.importedAccountName) | ||
).toBeVisible(); | ||
await popupExpect( | ||
popupPage.getByText(IMPORTED_ACCOUNT.truncatedPublicKey) | ||
).toBeVisible(); | ||
await popupExpect( | ||
popupPage.getByText('Imported', { exact: true }) | ||
).toBeVisible(); | ||
// | ||
// await importAccountPage | ||
// .getByRole('button', { name: 'Upload your file' }) | ||
// .click(); | ||
// | ||
// const fileChooser = await fileChooserPromise; | ||
// await fileChooser.setFiles(secretKeyPath); | ||
// | ||
// await importAccountPage | ||
// .getByPlaceholder('Account name', { exact: true }) | ||
// .fill(ACCOUNT_NAMES.importedAccountName); | ||
// | ||
// await importAccountPage.getByRole('button', { name: 'Import' }).click(); | ||
// | ||
// await popupExpect( | ||
// importAccountPage.getByRole('heading', { | ||
// name: 'Your account was successfully imported' | ||
// }) | ||
// ).toBeVisible(); | ||
// | ||
// await importAccountPage.getByRole('button', { name: 'Done' }).click(); | ||
// | ||
// await popupPage.getByTestId('connection-status-modal').click(); | ||
// | ||
// await popupExpect( | ||
// popupPage.getByText(ACCOUNT_NAMES.importedAccountName) | ||
// ).toBeVisible(); | ||
// await popupExpect( | ||
// popupPage.getByText(IMPORTED_ACCOUNT.truncatedPublicKey) | ||
// ).toBeVisible(); | ||
// await popupExpect( | ||
// popupPage.getByText('Imported', { exact: true }) | ||
// ).toBeVisible(); | ||
} | ||
); | ||
}); |