Skip to content

Commit b87f824

Browse files
author
Alberto Fernández-Capel
authored
Merge pull request hotwired#998 from AfolabiOlaoluwa/enhance-navigation-tests-stability
fix: Improve test stability in navigation test cases
2 parents d63e198 + f2a94f4 commit b87f824

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/tests/functional/navigation_tests.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test("test after loading the page", async ({ page }) => {
5959
})
6060

6161
test("test following a same-origin unannotated link", async ({ page }) => {
62-
page.click("#same-origin-unannotated-link")
62+
await page.click("#same-origin-unannotated-link")
6363
await nextBody(page)
6464
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
6565
assert.equal(await visitAction(page), "advance")
@@ -89,50 +89,50 @@ test("test following a same-origin unannotated custom element link", async ({ pa
8989
})
9090

9191
test("test drive enabled; click an element in the shadow DOM wrapped by a link in the light DOM", async ({ page }) => {
92-
page.click("#shadow-dom-drive-enabled span")
92+
await page.click("#shadow-dom-drive-enabled span")
9393
await nextBody(page)
9494
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
9595
assert.equal(await visitAction(page), "advance")
9696
})
9797

9898
test("test drive disabled; click an element in the shadow DOM within data-turbo='false'", async ({ page }) => {
99-
page.click("#shadow-dom-drive-disabled span")
99+
await page.click("#shadow-dom-drive-disabled span")
100100
await nextBody(page)
101101
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
102102
assert.equal(await visitAction(page), "load")
103103
})
104104

105105
test("test drive enabled; click an element in the slot", async ({ page }) => {
106-
page.click("#element-in-slot")
106+
await page.click("#element-in-slot")
107107
await nextBody(page)
108108
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
109109
assert.equal(await visitAction(page), "advance")
110110
})
111111

112112
test("test drive disabled; click an element in the slot within data-turbo='false'", async ({ page }) => {
113-
page.click("#element-in-slot-disabled")
113+
await page.click("#element-in-slot-disabled")
114114
await nextBody(page)
115115
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
116116
assert.equal(await visitAction(page), "load")
117117
})
118118

119119
test("test drive disabled; click an element in the nested slot within data-turbo='false'", async ({ page }) => {
120-
page.click("#element-in-nested-slot-disabled")
120+
await page.click("#element-in-nested-slot-disabled")
121121
await nextBody(page)
122122
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
123123
assert.equal(await visitAction(page), "load")
124124
})
125125

126126
test("test following a same-origin unannotated link with search params", async ({ page }) => {
127-
page.click("#same-origin-unannotated-link-search-params")
127+
await page.click("#same-origin-unannotated-link-search-params")
128128
await nextBody(page)
129129
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
130130
assert.equal(search(page.url()), "?key=value")
131131
assert.equal(await visitAction(page), "advance")
132132
})
133133

134134
test("test following a same-origin unannotated form[method=GET]", async ({ page }) => {
135-
page.click("#same-origin-unannotated-form button")
135+
await page.click("#same-origin-unannotated-form button")
136136
await nextBody(page)
137137
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
138138
assert.equal(await visitAction(page), "advance")
@@ -150,28 +150,28 @@ test("test following a same-origin data-turbo-method=get link", async ({ page })
150150
})
151151

152152
test("test following a same-origin data-turbo-action=replace link", async ({ page }) => {
153-
page.click("#same-origin-replace-link")
153+
await page.click("#same-origin-replace-link")
154154
await nextBody(page)
155155
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
156156
assert.equal(await visitAction(page), "replace")
157157
})
158158

159159
test("test following a same-origin GET form[data-turbo-action=replace]", async ({ page }) => {
160-
page.click("#same-origin-replace-form-get button")
160+
await page.click("#same-origin-replace-form-get button")
161161
await nextBody(page)
162162
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
163163
assert.equal(await visitAction(page), "replace")
164164
})
165165

166166
test("test following a same-origin GET form button[data-turbo-action=replace]", async ({ page }) => {
167-
page.click("#same-origin-replace-form-submitter-get button")
167+
await page.click("#same-origin-replace-form-submitter-get button")
168168
await nextBody(page)
169169
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
170170
assert.equal(await visitAction(page), "replace")
171171
})
172172

173173
test("test following a same-origin POST form[data-turbo-action=replace]", async ({ page }) => {
174-
page.click("#same-origin-replace-form-post button")
174+
await page.click("#same-origin-replace-form-post button")
175175
await nextBody(page)
176176

177177
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
@@ -200,7 +200,7 @@ test("test following a POST form clears cache", async ({ page }) => {
200200
})
201201

202202
test("test following a same-origin POST link with data-turbo-action=replace", async ({ page }) => {
203-
page.click("#same-origin-replace-post-link")
203+
await page.click("#same-origin-replace-post-link")
204204
await nextBody(page)
205205

206206
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
@@ -222,7 +222,7 @@ test("test following a same-origin unannotated link inside a data-turbo=false co
222222
})
223223

224224
test("test following a same-origin data-turbo=true link inside a data-turbo=false container", async ({ page }) => {
225-
page.click("#same-origin-true-link-inside-false-container")
225+
await page.click("#same-origin-true-link-inside-false-container")
226226
await nextBody(page)
227227
assert.equal(pathname(page.url()), "/src/tests/fixtures/one.html")
228228
assert.equal(await visitAction(page), "advance")

0 commit comments

Comments
 (0)