diff options
Diffstat (limited to 'packages/meshbay-hub/tests/harness/photo_delete_probe.py')
| -rwxr-xr-x | packages/meshbay-hub/tests/harness/photo_delete_probe.py | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/packages/meshbay-hub/tests/harness/photo_delete_probe.py b/packages/meshbay-hub/tests/harness/photo_delete_probe.py index a99566d..2c41b14 100755 --- a/packages/meshbay-hub/tests/harness/photo_delete_probe.py +++ b/packages/meshbay-hub/tests/harness/photo_delete_probe.py @@ -5,8 +5,8 @@ Deleting a photo from the Photos app, in a real browser. Mounts the shipped `PhotosApp` on a made-up index, with a transport that records what it is asked to delete and an index that drops what was deleted, as a node's does. Right-clicks a tile, picks Delete, answers the page's own -confirmation (ask.js) one way then the other, and does the same from the -lightbox's bar. +confirmation (ask.js) one way then the other, and checks the lightbox's bar +offers none. photo_delete_probe.py @@ -109,16 +109,8 @@ const pick = async (label) => { await wait(50); return true; }; -// The page's own confirmation: what it says, whether it is the topmost thing -// on screen, and an answer. +// The page's own confirmation: what it says, and an answer. const dialog = () => document.querySelector('[role="alertdialog"]'); -const onTop = () => { - const d = dialog(); - if (!d) return false; - const r = d.getBoundingClientRect(); - const hit = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2); - return Boolean(hit && d.contains(hit)); -}; const answer = async (yes) => { const d = dialog(); const buttons = [...d.querySelectorAll('button')]; @@ -172,21 +164,12 @@ const answer = async (yes) => { await closeMenus(); cases.push({ case: 'operator', delete_offered: all }); - // -- from the lightbox: the button, the dialog above it, the next photo -- + // -- the lightbox: no delete button, the tile is where it is -- await mount({}); document.querySelectorAll('.photo-tile')[0].click(); await frame(); - const title = () => (document.querySelector('.photo-lightbox .video-title') || {}).textContent; - const before = title(); - const btn = document.querySelector('.photo-lightbox button[aria-label="Delete"]'); - if (btn) btn.click(); - await wait(50); - const dialogOnTop = onTop(); - if (dialog()) await answer(true); - await wait(100); await frame(); - cases.push({ case: 'lightbox', button: Boolean(btn), dialog_on_top: dialogOnTop, - before, after: title() || null, open: Boolean(document.querySelector('.photo-lightbox')), - deleted: DELETED.map((d) => d[0]) }); + cases.push({ case: 'lightbox', open: Boolean(document.querySelector('.photo-lightbox')), + button: Boolean(document.querySelector('.photo-lightbox button[aria-label="Delete"]')) }); // -- read-only (Search): never -- await mount({ readOnly: true, isNodeAdmin: true }); @@ -196,7 +179,8 @@ const answer = async (yes) => { await closeMenus(); ro.click(); await frame(); cases.push({ case: 'read only', labels: roLabels, - lightbox_button: Boolean(document.querySelector('.photo-lightbox button[aria-label="Delete"]')) }); + lightbox_button: Boolean( + document.querySelector('.photo-lightbox button[aria-label="Delete"]')) }); parent.postMessage({ cases, logs: LOGS, origin: location.origin }, '*'); } catch (err) { |