Skip to content

Commit 2afaeec

Browse files
committed
Update check for rendered components
1 parent a2b11e8 commit 2afaeec

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

k6/root.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ export default () => {
88
const rootUrl = url('');
99
check(http.get(rootUrl), {
1010
'status was 200': (res) => res.status === 200,
11-
'includes expected text': (res) => res.body?.toString()?.includes('Hello WORLD!'),
11+
'renders components successfully': (res) => {
12+
const body = res.html().text();
13+
return Object.entries({
14+
// This is visible on the page in the browser 4 times, but for some reason, the one under
15+
// "Server Rendered React Component Without Redux" is missing in `body`.
16+
'Hello, Mr. Server Side Rendering!': 3,
17+
'Hello, Mrs. Client Side Rendering!': 2,
18+
'Hello, Mrs. Client Side Hello Again!': 1,
19+
'Hello ES5, Mrs. Client Side Rendering!': 1,
20+
'Hello WORLD! Will this work?? YES! Time to visit Maui': 1,
21+
}).every(([text, count]) => body.split(text).length >= count + 1);
22+
},
1223
});
1324
};

0 commit comments

Comments
 (0)