aboutsummaryrefslogtreecommitdiff
path: root/internal/testing/htmlcheck
AgeCommit message (Collapse)Author
2026-03-26all: run go fix -stringsbuilderHana Kim
Change-Id: I839e47c2b39ee592909f7ecb03603d4fb1d1954b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753430 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26all: run go fix -slicescontainsHana Kim
Change-Id: I14479d9e612dfa7eed9188206746af5b51c10201 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753428 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2026-03-26all: fix rangeintHana Kim
Change-Id: I58ed5e7d2a3bbc13bc389ac7239737e18856dbfe Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753427 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ethan Lee <ethanalee@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-11-15internal/testing/htmlcheck: replace use of cascadia in InMichael Matloob
This cl implements the :nth-child() and :nth-of-type() pseudoclasses for the css selector query function, allowing it to be used for htmlcheck.In. It also replaces the single use of a a child combinator '>' in a test with a descendant combinator ' ' so that we don't need to implement the child combinator. The test should have the same behavior. For golang/go#61399 Change-Id: I09d9b8fbcd0eafd37aceb5994515687c85244ef8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/542058 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-11-15internal/testing/htmlcheck: replace cascadia for htmlcheck.NotInMichael Matloob
This change reimplements a subset of cascadia's query functionality so we can replace it for htmlcheck.NotIn. It adds code that parses a subset of the css selector syntax (currently it's more than we need for NotIn but not enough for In) and adds a query function to query the selector in the given html node. Unlike cascadia, our query function can match the node itself. Future cls will add support for more selector syntax so we can support everything htmlcheck.In is used for but we only intend so support just what we need. I also limit the selector syntax to ascii for simplicity. For #61399 Change-Id: Ia03cc8a9ab42ae11d445a650e1ca0a07ee8a391f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/541437 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2023-11-10internal/testing/htmlcheck: delete InAllMichael Matloob
It doesn't seem to be used anywhere. For #61399 Change-Id: I068ed8638ec24702a210b269097bec735ce0368b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/539483 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-07-30content/static,internal/frontend: add more granular page typesAndrew Bonventre
This change specifies more granular page types primarily for use by the details pages to differentiate between the type of page (module, package, etc.) and the name of the item being viewed. This change also hides the type of the item in the fixed header when it is not wide enough to show other information. Change-Id: I1e25e75dbdbac01b5d54ea96224f3464cf9fa9f9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245487 Reviewed-by: Julie Qiu <julie@golang.org>
2020-03-27internal/testing/htmlcheck: remove InAtJonathan Amsterdam
The same can be achieved with CSS selectors, using :nth-child and :nth-of-type. Change-Id: I57486922d5d0060862b20d67f56be808b6c65082 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/617945 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27internal/testing: add an integration test for pkg/directory resolutionRob Findley
A new integration test, TestModulePackageDirectoryResolution is added to test the resolution of modules vs. packages vs. directories when a path is only a valid package a certain versions. In order for this test to pass I had to fix the return code when we suggest a search: previously we were returning StatusSeeOther, but that should really only be used when we're actually redirecting to a different page via the location header. Instead, we now return StatusNotFound. A convenience function htmlcheck.Run is added for running htmlcheck on the Body of a net/http.Response. Updates b/143814014 Fixes b/145858138 Updates b/144031201 Updates b/143760329 Change-Id: Ie3f02165a6607b341379a1aea2eb078f300ad405 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/614811 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27internal/pagecheck: add checks for overview pagesJonathan Amsterdam
Change-Id: I643e59f9eb13f9b9abbf8c30daedb2264a3a65e3 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/602822 Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27internal/frontend: clarify versionsJonathan Amsterdam
Avoid the use of the naked term "version" in the details header. Instead, we have: - DisplayVersion: the version formatted for human readability. - LinkVersion: the version to use in links to the discovery site. Also, use the link version in nav tab links: Fixes b/144873325. And improve test coverage. Change-Id: Ida80867b6bd70a32c18f45b21b0b361b9e8e904f Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/603789 Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27internal/frontend: move page checkers to a separate packageJonathan Amsterdam
Factor out common structural checks on pages, so we can use them in more than one place. - Add internal/testing/pagecheck for common checks on page contents - Use in internal/frontend/server_test.go Change-Id: I744cf090f6bfad8c788be5b21cb5ed80f9adf8de Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/600800 Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27internal/testing/htmlcheck: package for checking html structureJonathan Amsterdam
Move the html-checking code from internal/frontend tests to its own package. Ths is a first step towards making these structural tests usable elsewhere, like in an integration test that runs against a live endpoint. Since these are now exported, give them better names in some cases. Also, generalize to use regexps where that makes sense. Change-Id: I1a3e0c09954d9cb07200c087db17e499a9d0d9a7 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/599089 Reviewed-by: Julie Qiu <julieqiu@google.com>