File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,23 @@ let expectProfile = expectation =>
2929 | Playground => get (".cm-editor" )-> should ("be.visible" )-> ignore
3030 }
3131
32+ let expectLoadedStyles = () =>
33+ Cypress .cyWindow ()-> Cypress .thenPromise (async window => {
34+ let styles = await window .document
35+ -> Cypress .querySelectorAll (` link[rel="stylesheet"][href]` )
36+ -> Cypress .elementsFrom
37+ -> Array .map (async link => {
38+ let response = await window -> Cypress .windowFetch (link -> Cypress .elementHref )
39+ Cypress .expect (
40+ response -> Cypress .fetchStatus ,
41+ ~message = link -> Cypress .elementHref ,
42+ )-> Cypress .equal (200 )
43+ await response -> Cypress .responseText
44+ })
45+ -> Promise .all
46+ Cypress .expect (styles -> Array .length )-> Cypress .greaterThan (0 )
47+ })
48+
3249// static-server needs a trailing slash to resolve nested index.html files.
3350let directLoadPath = path =>
3451 Cypress .baseUrl ()-> String .includes ("127.0.0.1:4173" ) ? path ++ "/" : path
@@ -41,7 +58,7 @@ describe("Route profiles", () => {
4158 ` direct ${name} load has styles and hydrates` ,
4259 () => {
4360 visit (directLoadPath (path ))
44- get ( ` link[rel="stylesheet"]` ) -> should ( "exist" )-> ignore
61+ expectLoadedStyles ( )-> ignore
4562 expectProfile (expectation )
4663 },
4764 )
You can’t perform that action at this time.
0 commit comments