Skip to content

Commit

Permalink
refactor(e2e-assets): simplify wallet mnemonic import by using clipbo…
Browse files Browse the repository at this point in the history
…ard for seed phrase
  • Loading branch information
nelitow committed Dec 12, 2024
1 parent 937d66e commit c14a18a
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions packages/e2e-assets/playwright/crx/assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ test.describe('Check assets', () => {
await page.getByRole('button', { name: 'Next: Seed Phrase' }).click();
const mnemonic = process.env.READONLY_TESTNET_ASSETS_VIEW;
console.log(`Importing wallet with mnemonic: ${mnemonic}`);
const words = mnemonic.split(' ');
for (const [index, word] of words.entries()) {
console.log(`Filling word ${index + 1}: ${word}`);
const locator = page.locator('div').filter({
hasText: new RegExp(`^${index + 1}$`),
});
const input = locator.getByLabel('Type your text');
await input.fill(word);
console.log(`Filled word ${index + 1}`);
}

await page.evaluate(async (text) => {
await navigator.clipboard.writeText(text);
}, mnemonic);

// const words = mnemonic.split(' ');
// for (const [index, word] of words.entries()) {
// console.log(`Filling word ${index + 1}: ${word}`);
// const locator = page.locator('div').filter({
// hasText: new RegExp(`^${index + 1}$`),
// });
// const input = locator.getByLabel('Type your text');
// await input.fill(word);
// console.log(`Filled word ${index + 1}`);
// }

await page.getByRole('button', { name: 'Paste seed phrase' }).click();

await page.getByRole('button', { name: 'Next: Your password' }).click();
await page.getByPlaceholder('Type your password').fill('qwe123QWE!@#');
Expand Down

0 comments on commit c14a18a

Please sign in to comment.