oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1//go:build browser
2
3package thintest
4
5import (
6 "strconv"
7 "testing"
8)
9
10// TestBrowserMachines: the Machines screens at 1280 and 390. Nothing is
11// wider than the screen; Other people's machines opens on a click; a
12// row opens for its details; Revoke asks once more before its form
13// shows. On Add a machine, the machine that never connected comes
14// online in place when its runner connects, with no reload (the
15// person's stream through nav-stream.js). Saves the after shots when
16// EQUIPO_BROWSER_ARTIFACTS names a directory.
17func TestBrowserMachines(t *testing.T) {
18 settled := func(p *innerPage) {
19 p.wait(`document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`, "the page settled")
20 }
21 r := newMachinesRig(t)
22 for i, size := range settingsSizes {
23 w := strconv.FormatInt(size.w, 10)
24 p := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference")
25 p.open("/conversation/settings/machines")
26 p.fits("machines")
27 p.check(`!document.querySelector('[data-other-machines]').open && !document.querySelector('[data-other-machines] [data-machine]').checkVisibility()`, "others not folded")
28 p.check(`[...document.querySelectorAll('[data-my-machines] [equipo-mach]')].every(d=>!d.open)`, "a row open unasked")
29 p.check(`getComputedStyle(document.querySelector('[data-state="never"] [data-never-hint]')).display!=='none'`, "the never-connected hint is hidden")
30 settled(p)
31 p.shot("after-machines-" + w)
32 p.check(`(document.querySelector('[data-other-machines] > summary').click(),document.querySelector('[data-other-machines]').open)`, "others do not open")
33 never := `document.querySelector('[data-machine="` + r.never + `"]')`
34 p.check(`(`+never+`.querySelector('summary').click(),`+never+`.open)`, "a row does not open")
35 p.check(`!`+never+`.querySelector('[data-revoke]').checkVisibility()`, "Revoke posts without asking")
36 p.check(`(`+never+`.querySelector('[equipo-mach-confirm] > summary').click(),`+never+`.querySelector('[data-revoke]').checkVisibility())`, "Revoke does not ask")
37 p.fits("machines open")
38 settled(p)
39 p.shot("after-machines-open-" + w)
40 p.open("/conversation/settings/machines/add")
41 p.fits("add a machine")
42 settled(p)
43 p.shot("after-machines-add-" + w)
44 if i == 0 {
45 // The machine comes online on the page, which stays.
46 p.check(never+`.dataset.state==='never'`, "not never connected first")
47 r.dialWorker(r.neverToken, "Paul's MacBook Air", 0)
48 p.wait(never+`&&`+never+`.dataset.state==='online'`, "the new machine online in place")
49 p.stayed("machine online")
50 settled(p)
51 p.shot("after-machines-add-online-" + w)
52 }
53 p.stop()
54 }
55}
56