Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi committed Oct 14, 2024
1 parent c9ab8ce commit 9178f5a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
20 changes: 12 additions & 8 deletions esbuild/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'node:path';
import { readdirSync } from 'node:fs';
import type { BuildOptions } from 'esbuild';
import type { Manifest } from 'webextension-polyfill';

Expand All @@ -10,6 +11,13 @@ export const SRC_DIR = path.resolve(ROOT_DIR, 'src');
export const DEV_DIR = path.resolve(ROOT_DIR, 'dev');
export const DIST_DIR = path.resolve(ROOT_DIR, 'dist');

const KEY_AUTO_ADD_TARGETS = readdirSync(
path.join(SRC_DIR, 'content', 'keyAutoAdd'),
{ withFileTypes: true },
)
.filter((e) => e.isFile())
.map(({ name }) => path.basename(name, path.extname(name)));

export type Target = (typeof TARGETS)[number];
export type Channel = (typeof CHANNELS)[number];
export type BuildArgs = {
Expand All @@ -28,14 +36,10 @@ export const options: BuildOptions = {
in: path.join(SRC_DIR, 'content', 'index.ts'),
out: path.join('content', 'content'),
},
{
in: path.join(SRC_DIR, 'content', 'keyAutoAdd', 'testWallet.ts'),
out: path.join('content', 'keyAutoAdd', 'testWallet'),
},
{
in: path.join(SRC_DIR, 'content', 'keyAutoAdd', 'fynbos.ts'),
out: path.join('content', 'keyAutoAdd', 'fynbos'),
},
...KEY_AUTO_ADD_TARGETS.map((name) => ({
in: path.join(SRC_DIR, 'content', 'keyAutoAdd', `${name}.ts`),
out: path.join('content', 'keyAutoAdd', name),
})),
{
in: path.join(SRC_DIR, 'content', 'polyfill.ts'),
out: path.join('polyfill', 'polyfill'),
Expand Down
2 changes: 1 addition & 1 deletion src/content/keyAutoAdd/fynbos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const waitForLogin: Run<void> = async (
let alreadyLoggedIn = window.location.href.startsWith(keyAddUrl);
if (!alreadyLoggedIn) setNotificationSize('notification');
try {
sleep(2000);
await sleep(2000);
alreadyLoggedIn = await waitForURL(
(url) => (url.origin + url.pathname).startsWith(keyAddUrl),
{ timeout: LOGIN_WAIT_TIMEOUT },
Expand Down
7 changes: 3 additions & 4 deletions tests/e2e/connectAutoKeyFynbos.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ test('Connect to Fynbos with automatic key addition when not logged-in to wallet
return keyNickName;
});

await test.step('shows connect consent page', async () => {
await test.step('shows wallet consent page', async () => {
await waitForGrantConsentPage(page);
expect(page.getByRole('button', { name: 'Approve' })).toBeVisible();
});
Expand All @@ -133,15 +133,14 @@ test('Connect to Fynbos with automatic key addition when not logged-in to wallet
`/settings/keys?_data=${encodeURIComponent('routes/settings.keys')}`,
{ credentials: 'include' },
);
type Result = {
const data = await res.json();
return data as {
keys: {
id: string;
applicationName: string;
publicKeyFingerprint: string;
}[];
};
const data: Result = await res.json();
return data;
});

return data.keys
Expand Down

0 comments on commit 9178f5a

Please sign in to comment.