Skip to content

Commit d9bb351

Browse files
Add basic smoke test to N4A calculator on prod (#1130)
* Test: Added UI render test for n4a calc * Testing: N4A Button testing * Testing: N4A input testing * Testing: Refactor testing + update package.json + Add ignore * Testing: Add playwright workflow * chore: Updated package lock * removed unneeded util file --------- Co-authored-by: Maximus Smith <[email protected]>
1 parent e79e735 commit d9bb351

File tree

10 files changed

+552
-92
lines changed

10 files changed

+552
-92
lines changed

.github/workflows/notification.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
workflows:
66
- "QE LinkChecker"
77
- "Check for Broken Links"
8+
- "UI validation on prod"
89
types: [completed]
910

1011
permissions:

.github/workflows/playwright.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: UI validation on prod
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 * * * *"
6+
7+
jobs:
8+
run-playwright-tests:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: lts/*
15+
- name: Install dependencies
16+
run: npm ci
17+
- name: Install Playwright Browsers
18+
run: npx playwright install --with-deps
19+
- name: Run Playwright tests
20+
run: npx playwright test --retries=2
21+
- uses: actions/upload-artifact@v4
22+
if: ${{ !cancelled() }}
23+
with:
24+
name: playwright-report
25+
path: tests/playwright-report/
26+
retention-days: 30
27+
- uses: actions/upload-artifact@v4
28+
if: ${{ !cancelled() }}
29+
with:
30+
name: test-results
31+
path: tests/test-results/
32+
retention-days: 30

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ build
4040
*.swp
4141
*.mo
4242
node_modules
43+
44+
# Playwright
45+
/coverage
46+
*/test-results
47+
*/playwright-report

content/nginxaas-azure/billing/usage-and-cost-estimator.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,45 @@ type:
1111
{{< raw-html >}}
1212

1313
<link rel="stylesheet" href="/nginxaas-azure/css/cost-calculator_v2.css">
14-
<div id="calculator">
15-
<h3 id="calculator-section-heading">
14+
<div id="calculator" data-testid="calculator">
15+
<h3 id="calculator-section-heading" data-testid="calculator-section-heading">
1616
Cost Estimation for Standard V2 Plan
1717
<button id="printButton">Print Estimate</button>
1818
</h3>
19-
<div class="section">
19+
<div class="section" data-testid="calculator-section-content">
2020
<div class="form-section">
21-
<div class="form-section-content">
21+
<div class="form-section-content" data-testid="form-section-content-estimateNCUUsage">
2222
<h4>1. Estimate NCU Usage </h4>
2323
<div>
2424
<div class="form-field">
2525
<label for="avgNewConnsPerSec">
2626
Average New Connections per Second
2727
</label>
28-
<input id="avgNewConnsPerSec" type="number" />
28+
<input id="avgNewConnsPerSec" type="number" data-testid="input-avgNewConnsPerSec"/>
2929
</div>
3030
<div class="form-field avg-conn-duration-container">
3131
<label for="avgConnDuration">
3232
Average Connection Duration
3333
</label>
34-
<input id="avgConnDuration" type="number" />
34+
<input id="avgConnDuration" type="number" data-testid="input-avgConnDuration"/>
3535
</div>
3636
<div class="form-field bandwidth-input-container">
3737
<label for="totalBandwidth">
3838
Total Processed Data
3939
</label>
40-
<input id="totalBandwidth" type="number" />
40+
<input id="totalBandwidth" type="number" data-testid="input-totalBandwidth"/>
4141
</div>
4242
</div>
4343
</div>
44-
<div class="form-section-content">
44+
<div class="form-section-content" data-testid="form-section-content-capacityUnitsNeeded">
4545
<div class=form-section-footer>
4646
<div class="totals">
4747
<span>NGINX Capacity Units Needed</span>
48-
<span id="ncuEstimateValue">--</span>
48+
<span id="ncuEstimateValue" data-testid="ncuEstimateValue">--</span>
4949
<span> Sold in bundles of 10, with a minimum of 10</span>
5050
</div>
5151
<details id="ncu-usage-details">
52-
<summary>Show calculations</summary>
52+
<summary data-testid="button-ncu-usage-details">Show calculations</summary>
5353
<div id="ncuEstimateDetails">
5454
<div class="math">
5555
<var id="ncuEstConnRate">x</var> new connections per second *
@@ -72,36 +72,36 @@ Max(
7272
</div>
7373
</div>
7474
<div class="form-section">
75-
<div class=form-section-content>
75+
<div class="form-section-content" data-testid="form-section-content-estimateMonthlyCost">
7676
<h4 id="calculator-section-heading">
7777
2. Estimate Monthly Cost
7878
</h4>
7979
<div class="form-field">
8080
<label for="region">
8181
Region
8282
</label>
83-
<select id="region">
83+
<select id="region" data-testid="dropdown-region">
8484
<!-- options appended from tiers data -->
8585
</select>
8686
</div>
8787
<div class="form-field">
8888
<label for="numNcus">
8989
NCUs <span class="label-details">- value from usage estimate: <span id="numNcusEstVal"> - </span></span>
9090
</label>
91-
<input id="numNcus" type="number" step="10" min="10" />
91+
<input id="numNcus" data-testid="input-numNcus" type="number" step="10" min="10" />
9292
<span id="ncuValidation"></span>
9393
</div>
9494
<div class="form-field">
9595
<label for="numHours">
9696
Hours <span class="label-details">- used in a month</span>
9797
</label>
98-
<input id="numHours" type="number"/>
98+
<input id="numHours" data-testid="input-numHours" type="number"/>
9999
</div>
100100
<div class="form-field">
101101
<label for="numListenPorts">
102102
Listen Ports <span class="label-details">- first 5 are included</span>
103103
</label>
104-
<input id="numListenPorts" type="number"/>
104+
<input id="numListenPorts" data-testid="input-numListenPorts" type="number"/>
105105
</div>
106106
<div class="form-field">
107107
<label for="isWAF">
@@ -113,7 +113,7 @@ Max(
113113
<div class=form-section-content>
114114
<div id="totals-section">
115115
<span class="total-text">Total Monthly Payment</span>
116-
<span id="total-value" class="total-text">--</span>
116+
<span id="total-value" data-testid="total-value" class="total-text">--</span>
117117
<div class="subtitle">
118118
The standard Azure networking and bandwidth charges apply to NGINX deployments.
119119
</div>

0 commit comments

Comments
 (0)