package idtest // The contract between estilo's door and rastrillo's screen, as Equipo // draws it. import ( "fmt" "html/template" "net/http" "regexp" "strings" "testing" "amadan.net/oficina/equipo/internal/equipo/door" "amadan.net/oficina/estilo.git/chrome" "amadan.net/oficina/estilo.git/sky" "amadan.net/rastrillo/rastrillo/ui" ) // estilo-signin-screen over rastrillo's real states: HideBrand drops the // partial's brand column (estilo's door draws Equipo's mark and name // around the card), so [estilo-signin-screen] > section has the door as // its only element child in every state, both modes, the refusal and the // confirm step included. func TestDoorScreenHoldsOnlyTheDoor(t *testing.T) { t.Parallel() modes(t, func(t *testing.T, f *fixture, home bool) { _, record := f.emailRecord(t, address) paths := []string{"/signin", "/signin?ways=1", "/signin?way=email", "/signin?err=expired", "/signin?sent=1", "/signin?reauth=1", "/signin?force=1"} if home { paths = append(paths, "/signin/local", "/signin?way=oficina") } for _, p := range paths { for _, jar := range []*http.Cookie{nil, record} { w := f.request("GET", p, "", nil, jar) if w.Code != http.StatusOK { t.Fatalf("GET %s: %d", p, w.Code) } screenOnlyHoldsTheDoor(t, p, w.Body.String()) } } f.remove(t, address) screenOnlyHoldsTheDoor(t, "refusal", f.request("GET", "/signin", "", nil, f.local(t, address)).Body.String()) }) } func screenOnlyHoldsTheDoor(t *testing.T, name, body string) { t.Helper() children, err := screenChildren(body) if err != nil { t.Fatal(name, err) } if len(children) != 1 || !strings.HasPrefix(children[0], "
Equipo