static,tests: update search page test
The search results total is rewritten to keep the
snapshot tests consistent between test runs.
Change-Id: I1b2fa5af13188a9e205fbe45b2550651e6262930
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/350998
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/static/frontend/legacy_search/legacy_search.tmpl b/static/frontend/legacy_search/legacy_search.tmpl
index d5b06d2..7e49f49 100644
--- a/static/frontend/legacy_search/legacy_search.tmpl
+++ b/static/frontend/legacy_search/legacy_search.tmpl
@@ -18,7 +18,7 @@
<h1 class="SearchResults-header">Results for “{{.Query}}”</h1>
<div class="SearchResults-help"><a href="/search-help">Search help</a></div>
<div class="SearchResults-resultCount go-textSubtle">
- {{template "pagination_summary" .Pagination}} {{pluralize .Pagination.TotalCount "result"}}
+ <span data-test-id="results-total">{{template "pagination_summary" .Pagination}} {{pluralize .Pagination.TotalCount "result"}}</span>
{{template "pagination_nav" .Pagination}}
</div>
{{if eq (len .Results) 0}}
diff --git a/tests/e2e/__snapshots__/ci/search.desktop.test.ts.snap b/tests/e2e/__snapshots__/ci/search.desktop.test.ts.snap
index fe4902f..8620429 100644
--- a/tests/e2e/__snapshots__/ci/search.desktop.test.ts.snap
+++ b/tests/e2e/__snapshots__/ci/search.desktop.test.ts.snap
@@ -58,7 +58,7 @@
"role": "link",
},
Object {
- "name": "1 – 25 of 117 results",
+ "name": "1 – 25 of 125 results",
"role": "StaticText",
},
Object {
diff --git a/tests/e2e/__snapshots__/ci/search.mobile.test.ts.snap b/tests/e2e/__snapshots__/ci/search.mobile.test.ts.snap
index 1c586ba..7393b7b 100644
--- a/tests/e2e/__snapshots__/ci/search.mobile.test.ts.snap
+++ b/tests/e2e/__snapshots__/ci/search.mobile.test.ts.snap
@@ -45,7 +45,7 @@
"role": "link",
},
Object {
- "name": "1 – 25 of 117 results",
+ "name": "1 – 25 of 125 results",
"role": "StaticText",
},
Object {
diff --git a/tests/e2e/helpers/search.page.ts b/tests/e2e/helpers/search.page.ts
index c11b870..b0de471 100644
--- a/tests/e2e/helpers/search.page.ts
+++ b/tests/e2e/helpers/search.page.ts
@@ -42,5 +42,8 @@
pg.$$eval(page, '[data-test-id="snippet-license"]', els =>
els.map(el => (el.innerHTML = 'BSD-3-Clause'))
),
+ pg.$$eval(page, '[data-test-id="results-total"]', els =>
+ els.map(el => (el.innerHTML = '1 – 25 of 125 results'))
+ ),
]);
}