Skip to content

Commit 2f8fc3c

Browse files
committed
Tests: Added new UI smoke tests
1 parent e233b60 commit 2f8fc3c

19 files changed

+185
-119
lines changed

.github/workflows/playwright.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Testing for visual regression on old theme
1+
name: Running Playwright test on UI
22

33
# Run the workflow when code is pushed or when a pull request is created
44
on:
@@ -25,19 +25,16 @@ jobs:
2525
- name: Install dependencies and playwright browsers
2626
run: cd tests && npm ci && npx playwright install --with-deps
2727
- name: Run Playwright tests
28-
id: test-visual
28+
id: test-ui
2929
run: |
3030
make tests | tee output.log
31-
if grep -q -e "Error: A snapshot doesn't exist at" -e "Screenshot comparison failed" output.log; then
32-
echo "Playwright tests failed due to a snapshot issue."
33-
exit 1
34-
elif grep -q "failed" output.log; then
35-
echo "Playwright tests failed due to a non-snapshot issue."
31+
if grep -q "failed" output.log; then
32+
echo "Playwright tests failed. Please view the Playwright report to see full error."
3633
exit 1
3734
fi
3835
- uses: actions/upload-artifact@v4
3936
id: artifact-upload
40-
if: ${{ !cancelled() && failure() && steps.test-visual.conclusion == 'failure' }}
37+
if: ${{ !cancelled() && failure() && steps.test-ui.conclusion == 'failure' }}
4138
with:
4239
name: playwright-report
4340
path: tests/playwright-report/
@@ -47,10 +44,9 @@ jobs:
4744
if: ${{ failure() }}
4845
with:
4946
script: |
50-
const body = `### <span aria-hidden="true">❌</span> Playwright visual snapshot differences were detected.
47+
const body = `### <span aria-hidden="true">❌</span> Playwright differences were detected.
5148
52-
View the [Playwright report](${{ steps.artifact-upload.outputs.artifact-url }})
53-
**To approve the snapshot changes and update the snapshots, please comment:** /approve-snapshots`;
49+
View the [Playwright report](${{ steps.artifact-upload.outputs.artifact-url }})`;
5450
5551
await github.rest.issues.createComment({
5652
issue_number: context.issue.number,

.github/workflows/update-screenshot.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

layouts/404.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{ define "main"}}
22

3-
<div class="content">
4-
<div class="not-found-container">
3+
<div class="content" data-testid="content">
4+
<div class="not-found-container" data-testid="not-found-container">
55
<h1 class="info-header">
66
HTTP 404 - Page not found
77
</h1>

layouts/_default/baseof.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@
4343
{{ end }}
4444
<input type="checkbox" id="sidebar-panel" class="sidebar-panel" hidden/>
4545
<div class="grid-container">
46-
<aside class="sidebar">
46+
<aside class="sidebar" data-testid="sidebar">
4747
{{ partial "sidebar-v2.html" . }}
4848
</aside>
4949

50-
<header class="header">
50+
<header class="header" data-testid="header">
5151
{{ block "header" . }}{{end}}
5252
</header>
5353

5454
{{ block "main" . }}{{ end }}
5555

56-
<footer class="footer">
56+
<footer class="footer" data-testid="footer">
5757
{{ block "footer-v2" . }}
5858
{{ partial "footer-v2.html" . }}
5959
{{ end }}

layouts/_default/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ define "main" }}
22

3-
<main class="content " role="main">
3+
<main class="content " role="main" data-testid="content">
44
<section class="main-layout">
55
<section id="maincontent" class="content-layout">
66
<div data-cms-edit="content" class="text-content list-page">

layouts/_default/single.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ define "main" }}
22

3-
<main class="content">
3+
<main class="content" data-testid="content">
44
<!-- Replace icons -->
55
{{ $content := partial "icon-replacement.html" (dict "content" .Content) }}
66

layouts/partials/api.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--Use wide page layout for the API reference pages-->
22
<div class="nginx-docs-api-container">
3-
<div id="api-component" class="content">
3+
<div id="api-component" class="content" data-testid="content">
44
{{ .Content}}
55
</div>
66
</div>

layouts/partials/footer-v2.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div class="footer-layout">
2-
<div class="footer-f5-trademark">
2+
<div class="footer-f5-trademark" data-testid="footer-f5-trademark">
33
<img class="f5-logo-footer" src="{{ "/images/icons/Logo_F5.svg" | absURL }}" alt="F5 logo">
44
<p>©2025 F5, Inc. All rights reserved. NGINX is a registered trademark of F5, Inc.</p>
55
</div>
6-
<div class="footer-useful-links">
6+
<div class="footer-useful-links" data-testid="footer-useful-links">
77
<a
88
href="https://www.f5.com/company/policies/trademarks"
99
rel="noopener"

layouts/partials/header.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
{{ $productIdentifier := index ((split $relPermalink "/")) 1 }}
4444
{{ $productName := index $productMap $productIdentifier | default "Product Documentation" }}
4545

46-
<button class="product-selector__button" id="product-selector-button">
46+
<button class="product-selector__button" id="product-selector-button" data-testid="product-selector__button">
4747
{{/* product name and selector */}}
4848
<span class="product-name">{{ $productName }}</span>
4949
<span class="product-selector-button-icon">
@@ -52,7 +52,7 @@
5252
</svg>
5353
</span>
5454
</button>
55-
<div class="product-selector" id="product-selector">
55+
<div class="product-selector" id="product-selector" data-testid="product-selector">
5656
{{ $groupedProducts := dict
5757
"nginx-one" (where $nginxProducts "type" "nginx-one")
5858
"nginx-app-protect" (where $nginxProducts "type" "nginx-app-protect")
@@ -63,7 +63,7 @@
6363
{{ range $orderedKeys }}
6464
{{ $type := . }}
6565
{{ $products := index $groupedProducts $type }}
66-
<div class="product-selector-content" id="product-selector-content">
66+
<div class="product-selector-content" id="product-selector-content" data-testid="product-selector-content">
6767
<p>{{ $type | humanize | title | upper }}</p>
6868
<ul>
6969
{{ range $products }}
@@ -78,13 +78,13 @@
7878
</div>
7979

8080
{{ if ( not ( in .Site.Params.buildtype "package" ) ) }}
81-
<div class="header__search">
81+
<div class="header__search" data-testid="header__search">
8282
<!-- Standalone search box. -->
8383
{{ partial "coveo-atomic-search.html" (dict "id" "search-standalone-header") }}
8484
</div>
8585
{{ end }}
8686

87-
<div class="header__f5sites">
87+
<div class="header__f5sites" data-testid="header__f5sites">
8888
{{ $f5Sites := slice
8989
(dict "title" "DevCentral" "url" "https://community.f5.com/" "description" "Connect & learn in our hosted community")
9090
(dict "title" "MyF5" "url" "https://my.f5.com/" "description" "Your key to everything F5, including support, registration keys, and subscriptions")
@@ -93,11 +93,11 @@
9393

9494
<ul class="navbar navbar-nav">
9595
<li class="nav-item-explore active">
96-
<button id="navbar-sites-button" class="button navbar-button">
96+
<button id="navbar-sites-button" class="button navbar-button" data-testid="header__f5sites__button">
9797
F5 Sites
9898
<i id="navbar-sites-button-icon" class="link-chevron-icon fa-solid fa-chevron-down"></i>
9999
</button>
100-
<div class="dropdown-content" id="dropdown-content">
100+
<div class="dropdown-content" id="dropdown-content" data-testid="header__f5sites-content">
101101
<ul>
102102
{{ range $f5Sites }}
103103
<li>

layouts/partials/sidebar-list.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{{ $firstSection := .firstSection }}
44
{{ $idPrefix := .idPrefix }}
55
{{ with $firstSection }}
6-
<ul class="sidebar__ul">
6+
<ul class="sidebar__ul" data-testid="sidebar__ul">
77
{{ $pages := .Pages.ByWeight }}
88
{{ range $index, $p := $pages }}
99
{{- $onPage := eq $currentUrl $p.Permalink -}}
@@ -14,10 +14,11 @@
1414
{{- $nextIndex := add $index 1 -}}
1515
{{- $nextLink := index $pages $nextIndex -}}
1616
{{ if eq $p.Kind "section" }}
17-
<li class="sidebar__section">
17+
<li class="sidebar__section" data-testid="sidebar__section">
1818
<button
1919
id="{{ $linkID }}"
2020
class="sidebar__toggle {{ if $isAncestor }}sidebar__toggle--ancestor{{ end }}"
21+
data-testid="sidebar__section__toggle"
2122
aria-expanded="{{ $shouldExpand }}"
2223
aria-controls="{{ $sectionID }}"
2324
>
@@ -33,7 +34,7 @@
3334
>
3435
{{ if and .Content (gt (len .Pages) 0) }}
3536
<ul>
36-
<li class="sidebar__page">
37+
<li class="sidebar__page" data-testid="sidebar__page">
3738
<a
3839
href="{{ $p.Permalink }}"
3940
class="sidebar__link {{ if $onPage }}sidebar__link--current{{ end }}"
@@ -57,7 +58,7 @@
5758
{{- $tocHasItems := (in $p.TableOfContents "<li>") -}}
5859
{{- $pageHasTOC := (and $onPage $tocHasItems $p.Params.toc) -}}
5960
{{- $tocID := printf "%stoc-%s" $idPrefix (urlize $p.Permalink) -}}
60-
<li class="sidebar__page">
61+
<li class="sidebar__page" data-testid="sidebar__page">
6162
{{ if $pageHasTOC }}
6263
<button
6364
class="sidebar__toggle sidebar__link sidebar__link--current"

0 commit comments

Comments
 (0)