WIP VI improve UX [snapshot task 2]
This commit is contained in:
1 parent
a73b3075b6
commit
8665d04f2c
6 files changed
+95
-66
No files matched your search
@@ -13,6 +13,8 @@ export async function crossBrowserDriver(provider: string) {
|
||||
const role = new URL(location.href).searchParams.get('role');
|
||||
if (role !== 'sender' && role !== 'receiver') throw new Error('Invalid role');
|
||||
const { click, input, wait, element } = window.__hellcon;
|
||||
// Use the memory fallback so the received bytes can be checked in-page.
|
||||
Object.defineProperty(navigator, 'serviceWorker', { value: undefined });
|
||||
const pause = (ms: number) => new Promise<void>(resolve => setTimeout(resolve, ms));
|
||||
const post = async (key: string, value: unknown) => fetch('/.test/' + key, {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify(value)});
|
||||
const get = async <K extends keyof Exchange>(key: K): Promise<Exchange[K] | null> => (await fetch('/.test/' + key)).json();
|
||||
@@ -43,7 +45,7 @@ try {
|
||||
if(fps[0]!==other[1]||fps[1]!==other[0])throw new Error('Fingerprints do not match');
|
||||
click('Both fingerprints match — confirm');
|
||||
if(role==='receiver'){
|
||||
await stage('waiting for metadata');await wait(()=>document.querySelector('.incoming'));click('Receive in memory (up to 64 MiB)');
|
||||
await stage('waiting for metadata');await wait(()=>document.querySelector('.incoming'));click('Accept file');
|
||||
await stage('receiving');await wait(()=>document.querySelector('a.download'));
|
||||
await wait(()=>get('senderResult'));
|
||||
await pause(250);
|
||||
|
||||
Reference in new issue
Block a user