Phase 7 part 4: SEO → What to write next
One list per website of everything worth writing: new wording for pages (Push pages and the audit's title and description issues), landing pages for signals that get replies, pages for apps people name in their replies (their own words, without quoted mail or signatures), and keywords or briefs that stalled. Ranked by the sign-ups each is expected to bring, at most 10 shown, each with its reason in numbers and the button that starts its flow; Not now hides one for 90 days. The SEO module still opens on the Morning check; the Monday report links here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,12 +5,15 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"supermarket/internal/oauth"
|
||||
"supermarket/internal/profile"
|
||||
"supermarket/internal/secrets"
|
||||
"supermarket/internal/signals"
|
||||
)
|
||||
|
||||
func TestSearchConsole(t *testing.T) {
|
||||
@@ -140,3 +143,31 @@ func TestSignInHostsAllowedAsFormTargets(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestWhatToWriteNext(t *testing.T) {
|
||||
s, h := newTestServer(t, nil)
|
||||
p := &profile.Profile{Name: "Acme", Websites: []profile.Website{{URL: "https://acme.example", SearchConsoleProperty: "sc-domain:acme.example"}}}
|
||||
if err := profile.Save(s.DB, p); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sig := &signals.Signal{Name: "Leaving M365", Status: "testing"}
|
||||
signals.Save(s.DB, sig)
|
||||
signals.Record(s.DB, signals.Event{SignalID: sig.ID, Stage: signals.StageReplied, Channel: "email", Source: "manual", Subject: "contact:1", ExternalID: "r1", At: time.Now().AddDate(0, 0, -2)})
|
||||
|
||||
body := do(h, http.MethodGet, "/seo/next", nil, nil).Body.String()
|
||||
if !strings.Contains(body, "Leaving M365") || !strings.Contains(body, "kind=landing&signal=") || !strings.Contains(body, "Ranked by impressions for now") {
|
||||
t.Fatalf("next: %s", body)
|
||||
}
|
||||
rec := postForm(h, "/seo/next/dismiss?site=0", url.Values{"key": {"signal-page:" + strconv.FormatInt(sig.ID, 10)}})
|
||||
if rec.Code != http.StatusSeeOther {
|
||||
t.Fatalf("dismiss: %d", rec.Code)
|
||||
}
|
||||
if body := do(h, http.MethodGet, "/seo/next", nil, nil).Body.String(); strings.Contains(body, "Leaving M365") {
|
||||
t.Error("a dismissed suggestion still shows")
|
||||
}
|
||||
// The New pages form takes the suggestion's kind and signal.
|
||||
if body := do(h, http.MethodGet, "/sites/pages?kind=landing&signal="+strconv.FormatInt(sig.ID, 10), nil, nil).Body.String(); strings.Contains(body, "<form method=\"post\" action=\"/sites/pages\"") &&
|
||||
!strings.Contains(body, `value="landing" selected`) {
|
||||
t.Error("New pages wasn't filled in")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user