Skip to content

Commit cab7e5a

Browse files
authored
#4618 Add tests for checking shareable public key (#5889)
* Add negative test * add positive test * update positive test * fix negative test
1 parent 2381926 commit cab7e5a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

extension/chrome/settings/modules/my_key.htm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
      
3333
<a href="#" class="action_download_pubkey">Save public key to a file</a>
3434
</div>
35-
<div class="line show_when_showing_public pubkey_link_container" style="display: none">Share your public key: <a href="" target="_blank"></a></div>
35+
<div class="line show_when_showing_public pubkey_link_container" style="display: none" data-test="container-shareable-pubkey-link">
36+
Share your public key: <a href="" target="_blank"></a>
37+
</div>
3638
<div class="line key_status_contatiner"></div>
3739
<div class="line">Key creation: <span class="key_creation" data-test="content-key-creation"></span></div>
3840
<div class="line">Key expiration: <span class="key_expiration" data-test="content-key-expiration"></span></div>

test/source/tests/flaky.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ export const defineFlakyTests = (testVariant: TestVariant, testWithBrowser: Test
109109
{ submitPubkey: true, usedPgpBefore: true },
110110
{ isSavePassphraseChecked: false, isSavePassphraseHidden: false }
111111
);
112+
await SettingsPageRecipe.toggleScreen(settingsPage, 'additional');
113+
await settingsPage.waitAndClick('@action-open-pubkey-page');
114+
const myKeyFrame = await settingsPage.getFrame(['my_key.htm']);
115+
expect(await myKeyFrame.isElementPresent('@container-shareable-pubkey-link')).to.be.true;
112116
})
113117
);
114118

@@ -245,6 +249,7 @@ export const defineFlakyTests = (testVariant: TestVariant, testWithBrowser: Test
245249
await SetupPageRecipe.createKey(settingsPage, 'unused', 'none', {
246250
selectKeyAlgo: 'rsa3072',
247251
key: { passphrase: 'long enough to suit requirements' },
252+
submitPubkey: false,
248253
});
249254
await SettingsPageRecipe.toggleScreen(settingsPage, 'additional');
250255

@@ -253,11 +258,11 @@ export const defineFlakyTests = (testVariant: TestVariant, testWithBrowser: Test
253258
t,
254259
`chrome/settings/modules/my_key.htm?placement=settings&parentTabId=60%3A0&acctEmail=${acctEmail}&fingerprint=${fingerprint}`
255260
);
261+
expect(await myKeyFrame.isElementPresent('@container-shareable-pubkey-link')).to.be.false;
256262
const downloadedFiles = await myKeyFrame.awaitDownloadTriggeredByClicking('@action-download-prv');
257263
// const longid = OpenPGPKey.fingerprintToLongid(fingerprint);
258264
const longid = fingerprint.substring(fingerprint.length - 16);
259265
const fileName = `flowcrypt-backup-usernosubmitclientconfigurationflowcrypttest-0x${longid}.asc`;
260-
261266
const key = await KeyUtil.parse(downloadedFiles[fileName].toString());
262267
expect(key.algo.bits).to.equal(3072);
263268
expect(key.algo.algorithm).to.equal('rsaEncryptSign');

0 commit comments

Comments
 (0)