Skip to content

Commit 860752c

Browse files
committed
Fix tests - use specific ID, not TagName that picks the first element of the type.
1 parent ba57845 commit 860752c

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/Components/test/E2ETest/Tests/SectionsWithCascadingParametersTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void RenderSectionContent_CascadingParameterForSectionOutletIsDeterminedB
3535
Browser.FindElement(By.Id("render-section-outlet")).Click();
3636
Browser.FindElement(By.Id("render-second-section-content")).Click();
3737

38-
Browser.Equal("Second Section with additional text for second section", () => Browser.Exists(By.TagName("p")).Text);
38+
Browser.Equal("Second Section with additional text for second section", () => Browser.Exists(By.Id("text-component")).Text);
3939
}
4040

4141
[Fact]
@@ -46,7 +46,7 @@ public void ChangeCascadingValueForSectionContent_CascadingValueForSectionOutlet
4646

4747
Browser.FindElement(By.Id("change-cascading-value")).Click();
4848

49-
Browser.Equal("First Section with additional text for second section", () => Browser.Exists(By.TagName("p")).Text);
49+
Browser.Equal("First Section with additional text for second section", () => Browser.Exists(By.Id("text-component")).Text);
5050
}
5151

5252
[Fact]
@@ -56,7 +56,7 @@ public void RenderTwoSectionContentsWithSameId_CascadingParameterForSectionOutle
5656
Browser.FindElement(By.Id("render-first-section-content")).Click();
5757
Browser.FindElement(By.Id("render-section-outlet")).Click();
5858

59-
Browser.Equal("First Section with additional text for first section", () => Browser.Exists(By.TagName("p")).Text);
59+
Browser.Equal("First Section with additional text for first section", () => Browser.Exists(By.Id("text-component")).Text);
6060
}
6161

6262
[Fact]
@@ -68,7 +68,7 @@ public void SecondSectionContentIdChanged_CascadingParameterForSectionOutletIsDe
6868

6969
Browser.FindElement(By.Id("change-second-section-content-id")).Click();
7070

71-
Browser.Equal("First Section with additional text for first section", () => Browser.Exists(By.TagName("p")).Text);
71+
Browser.Equal("First Section with additional text for first section", () => Browser.Exists(By.Id("text-component")).Text);
7272
}
7373

7474
[Fact]
@@ -80,7 +80,7 @@ public void SecondSectionContentDisposed_CascadingParameterForSectionOutletIsDet
8080

8181
Browser.FindElement(By.Id("dispose-second-section-content")).Click();
8282

83-
Browser.Equal("First Section with additional text for first section", () => Browser.Exists(By.TagName("p")).Text);
83+
Browser.Equal("First Section with additional text for first section", () => Browser.Exists(By.Id("text-component")).Text);
8484
}
8585

8686
[Fact]
@@ -92,7 +92,7 @@ public void FirstSectionContentDisposedThenRenderSecondSectionContent_CascadingP
9292
Browser.FindElement(By.Id("dispose-first-section-content")).Click();
9393
Browser.FindElement(By.Id("render-second-section-content")).Click();
9494

95-
Browser.Equal("Second Section with additional text for second section", () => Browser.Exists(By.TagName("p")).Text);
95+
Browser.Equal("Second Section with additional text for second section", () => Browser.Exists(By.Id("text-component")).Text);
9696
}
9797

9898
[Fact]
@@ -105,6 +105,6 @@ public void SectionOutletIdChanged_CascadingParameterForSectionOutletIsDetermine
105105

106106
Browser.FindElement(By.Id("change-section-outlet-id")).Click();
107107

108-
Browser.Equal("Second Section with additional text for second section", () => Browser.Exists(By.TagName("p")).Text);
108+
Browser.Equal("Second Section with additional text for second section", () => Browser.Exists(By.Id("text-component")).Text);
109109
}
110110
}

src/Components/test/E2ETest/Tests/SectionsWithErrorBoundaryTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void RenderSectionContent_ErrorBoundaryForSectionOutletContentIsDetermine
3737

3838
Browser.FindElement(By.Id("error-button")).Click();
3939

40-
Browser.Equal("Sorry!", () => Browser.Exists(By.TagName("p")).Text);
40+
Browser.Equal("Sorry!", () => Browser.Exists(By.Id("error-content")).Text);
4141
}
4242

4343
[Fact]
@@ -88,7 +88,7 @@ public void FirstSectionContentDisposedThenRenderSecondSectionContent_ErrorBound
8888
Browser.FindElement(By.Id("render-second-section-content")).Click();
8989
Browser.FindElement(By.Id("error-button")).Click();
9090

91-
Browser.Equal("Sorry!", () => Browser.Exists(By.TagName("p")).Text);
91+
Browser.Equal("Sorry!", () => Browser.Exists(By.Id("error-content")).Text);
9292
}
9393

9494
[Fact]
@@ -102,6 +102,6 @@ public void SectionOutletIdChanged_ErrorBoundaryForSectionOutletIsDeterminedByMa
102102
Browser.FindElement(By.Id("change-section-outlet-id")).Click();
103103
Browser.FindElement(By.Id("error-button")).Click();
104104

105-
Browser.Equal("Sorry!", () => Browser.Exists(By.TagName("p")).Text);
105+
Browser.Equal("Sorry!", () => Browser.Exists(By.Id("error-content")).Text);
106106
}
107107
}

src/Components/test/testassets/BasicTestApp/SectionsTest/SectionsWithErrorBoundary.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</SectionContent>
4141
</ChildContent>
4242
<ErrorContent>
43-
<p>Sorry!</p>
43+
<p id="error-content">Sorry!</p>
4444
</ErrorContent>
4545
</ErrorBoundary>
4646
}

src/Components/test/testassets/BasicTestApp/SectionsTest/TextComponentWithCascadingParameter.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p>@Text @AdditionalText</p>
1+
<p id="text-component">@Text @AdditionalText</p>
22

33
@code {
44
[Parameter]

0 commit comments

Comments
 (0)