Skip to content

Commit 776a64a

Browse files
committed
added data-testid to html for testing
1 parent 1df55d8 commit 776a64a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ nd-product: NGOOGL
1111
{{< raw-html >}}
1212
<link rel="stylesheet" href="/nginxaas-google/css/cost-calculator_v2.css">
1313
<div id="calculator">
14-
<h3 id="calculator-section-heading">
14+
<h3 id="calculator-section-heading" data-testid="calculator-section-main-header">
1515
Cost Estimation for Enterprise Plan
1616
<button id="printButton">Print Estimate</button>
1717
</h3>
1818

19-
<div class="section">
19+
<div class="section" data-testid="calculator-section-content">
2020
<div class="form-section">
2121
<div class="form-section-content">
2222
<h4 id="calculator-section-heading">Estimate Monthly Cost</h4>
@@ -51,7 +51,7 @@ nd-product: NGOOGL
5151
<div class="form-section-content">
5252
<div id="totals-section">
5353
<span class="total-text">Total Monthly Payment</span>
54-
<span id="total-value" class="total-text">--</span>
54+
<span id="total-value" class="total-text" data-testid-"total-value">--</span>
5555

5656
<details id="total-cost-details">
5757
<summary>Show calculations</summary>

tests/src/n4g-calculator.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test.describe("Testing for N4G calculator page", () => {
99
});
1010

1111
test("calculator renders", async ({ page }) => {
12-
const header = page.getByTestId("calculator-section-heading");
12+
const header = page.getByTestId("calculator-section-main-header");
1313
const content = page.getByTestId("calculator-section-content");
1414

1515
await expect(header).toBeVisible();
@@ -19,10 +19,8 @@ test.describe("Testing for N4G calculator page", () => {
1919
test("calculator values render", async ({ page }) => {
2020
// Conjunction - If outputs are rendered, it is safe to say the inputs are rendered.
2121
// NOT testing changing numbers will impact the total values as that should be the job of unit tests. This is just a smoke tests.
22-
const ncuEstimateValue = page.getByTestId("ncuEstimateValue");
2322
const totalValue = page.getByTestId("total-value");
2423

25-
expect(await ncuEstimateValue.textContent()).toBeTruthy();
2624
expect(await totalValue.textContent()).toBeTruthy();
2725
});
2826
});

0 commit comments

Comments
 (0)