Skip to content

Commit

Permalink
fixing import account test
Browse files Browse the repository at this point in the history
  • Loading branch information
ost-ptk committed Nov 15, 2023
1 parent a498e9a commit ab104eb
Showing 1 changed file with 42 additions and 43 deletions.
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();
}
);
});

0 comments on commit ab104eb

Please sign in to comment.