diff --git a/test/samples/openpgp/flowcrypttestkeyimportedgmailcom-0x825B8AE8B14CFC0E.key b/test/samples/openpgp/flowcrypttestkeyimportedgmailcom-0x825B8AE8B14CFC0E.key new file mode 100644 index 00000000000..f3352563860 Binary files /dev/null and b/test/samples/openpgp/flowcrypttestkeyimportedgmailcom-0x825B8AE8B14CFC0E.key differ diff --git a/test/source/tests/page-recipe/setup-page-recipe.ts b/test/source/tests/page-recipe/setup-page-recipe.ts index 91b7c7a7618..05b01259734 100644 --- a/test/source/tests/page-recipe/setup-page-recipe.ts +++ b/test/source/tests/page-recipe/setup-page-recipe.ts @@ -114,10 +114,10 @@ export class SetupPageRecipe extends PageRecipe { await settingsPage.waitAndClick('@input-step2bmanualenter-source-paste', { retryErrs: true }); await settingsPage.waitAndType('@input-step2bmanualenter-ascii-key', key.armored); } else if (key.filePath) { // inputted as a file - await settingsPage.waitAndClick('@input-step2bmanualenter-file', { retryErrs: true }); - await Util.sleep(0.5); - const fileInput = await settingsPage.target.$('input[type=file]'); - await fileInput!.uploadFile(key.filePath); + const [fileChooser] = await Promise.all([ + settingsPage.page.waitForFileChooser(), + settingsPage.waitAndClick('@input-step2bmanualenter-file', { retryErrs: true })]); + await fileChooser.accept([key.filePath]); await Util.sleep(1); } else { throw new Error('dont know how to import test key because missing both "armored" and "filePath"'); diff --git a/test/source/tests/setup.ts b/test/source/tests/setup.ts index 51ed3cf3512..7808a3a0064 100644 --- a/test/source/tests/setup.ts +++ b/test/source/tests/setup.ts @@ -47,6 +47,18 @@ export const defineSetupTests = (testVariant: TestVariant, testWithBrowser: Test { isSavePassphraseChecked: false, isSavePassphraseDisabled: false }); })); + ava.default('setup - import unarmored key from file', testWithBrowser(undefined, async (t, browser) => { + const settingsPage = await BrowserRecipe.openSettingsLoginApprove(t, browser, 'flowcrypt.test.key.imported@gmail.com'); + const key = { + title: 'unarmored OpenPGP key', + filePath: 'test/samples/openpgp/flowcrypttestkeyimportedgmailcom-0x825B8AE8B14CFC0E.key', + armored: null, // tslint:disable-line:no-null-keyword + passphrase: 'will recognize i used pgp', + longid: null // tslint:disable-line:no-null-keyword + }; + await SetupPageRecipe.manualEnter(settingsPage, key.title, { submitPubkey: false, usedPgpBefore: false, key }); + })); + ava.default('setup - import key - submit - used before', testWithBrowser(undefined, async (t, browser) => { const settingsPage = await BrowserRecipe.openSettingsLoginApprove(t, browser, 'flowcrypt.test.key.used.pgp@gmail.com'); await SetupPageRecipe.manualEnter(settingsPage, 'flowcrypt.test.key.used.pgp', { submitPubkey: true, usedPgpBefore: true }, @@ -444,7 +456,7 @@ AN8G3r5Htj8olot+jm9mIa5XLXWzMNUZgg== await composeFrame.waitAndClick('@action-send'); await inboxPage.waitAll('@dialog-passphrase'); const passphraseDialog = await inboxPage.getFrame(['passphrase.htm']); - await passphraseDialog.waitForContent('@lost-pass-phrase-with-ekm','Ask your IT staff for help if you lost your pass phrase.'); + await passphraseDialog.waitForContent('@lost-pass-phrase-with-ekm', 'Ask your IT staff for help if you lost your pass phrase.'); const forgetPassPhraseElement = await passphraseDialog.waitAny('@forget-pass-phrase'); expect(await InboxPageRecipe.isElementDisabled(forgetPassPhraseElement)).to.equal(true); expect(await InboxPageRecipe.isElementChecked(forgetPassPhraseElement)).to.equal(true);