@@ -18,6 +18,9 @@ beforeEach(async () => page.goto(`http://example.com`));
1818
1919test ( "should render the default skin" , async ( ) => {
2020 await page . goto ( `${ DOMAIN } /#{"disableMarquee":true}` ) ;
21+ await page . evaluate (
22+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
23+ ) ;
2124 expect ( await page . screenshot ( ) ) . toMatchImageSnapshot ( snapshotOptions ) ;
2225} ) ;
2326
@@ -31,12 +34,18 @@ test("can load a skin via the query params", async () => {
3134 // If this test starts to fail, check that the cache-bust location of the skin has not changed.
3235 `${ DOMAIN } /?skinUrl=/skins/MacOSXAqua1-5-88dbd4e043795c98625462a908a2d965.wsz#{"disableMarquee":true}`
3336 ) ;
37+ await page . evaluate (
38+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
39+ ) ;
3440 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
3541 expect ( await page . screenshot ( ) ) . toMatchImageSnapshot ( snapshotOptions ) ;
3642} ) ;
3743
3844test ( "can set a background color via the query params" , async ( ) => {
3945 await page . goto ( `${ DOMAIN } /?bg=%23ff0000#{"disableMarquee":true}` ) ;
46+ await page . evaluate (
47+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
48+ ) ;
4049 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
4150 expect ( await page . screenshot ( ) ) . toMatchImageSnapshot ( snapshotOptions ) ;
4251} ) ;
@@ -45,6 +54,9 @@ test("can set a background color via the query params", async () => {
4554test . skip ( "can set soundcloud playlist via the query params" , async ( ) => {
4655 // If this test starts to fail, it might be flakyiness coming from the SoundCloud API, or that Poolside FM has changed their playlist.
4756 await page . goto ( `${ DOMAIN } /?scPlaylist=1040356177#{"disableMarquee":true}` ) ;
57+ await page . evaluate (
58+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
59+ ) ;
4860 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
4961 expect ( await page . screenshot ( ) ) . toMatchImageSnapshot ( snapshotOptions ) ;
5062} ) ;
@@ -55,6 +67,9 @@ test("should render the Topaz skin", async () => {
5567 "#webamp-file-input" ,
5668 path . join ( __dirname , "../../demo/skins/TopazAmp1-2.wsz" )
5769 ) ;
70+ await page . evaluate (
71+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
72+ ) ;
5873 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
5974 expect ( await page . screenshot ( ) ) . toMatchImageSnapshot ( snapshotOptions ) ;
6075} ) ;
@@ -65,6 +80,9 @@ test("should render a skin that defines transparent regions", async () => {
6580 "#webamp-file-input" ,
6681 path . join ( __dirname , "../../demo/skins/Green-Dimension-V2.wsz" )
6782 ) ;
83+ await page . evaluate (
84+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
85+ ) ;
6886 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
6987 expect ( await page . screenshot ( ) ) . toMatchImageSnapshot ( snapshotOptions ) ;
7088} ) ;
@@ -75,6 +93,9 @@ test("should render a skin that has files that only differ by case: main.bmp and
7593 "#webamp-file-input" ,
7694 path . join ( __dirname , "../../demo/skins/My_Funny_Valentine.wsz" )
7795 ) ;
96+ await page . evaluate (
97+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
98+ ) ;
7899 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
79100 expect ( await page . screenshot ( ) ) . toMatchImageSnapshot ( snapshotOptions ) ;
80101} ) ;
@@ -85,6 +106,9 @@ test("uses the volume spirtes as a fallback when balance spirtes are missing", a
85106 "#webamp-file-input" ,
86107 path . join ( __dirname , "../../demo/skins/AmigaPPC-dark.wsz" )
87108 ) ;
109+ await page . evaluate (
110+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
111+ ) ;
88112 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
89113 expect ( await page . screenshot ( ) ) . toMatchImageSnapshot ( snapshotOptions ) ;
90114} ) ;
@@ -96,6 +120,9 @@ test("pads empty space in the marquee with the space character", async () => {
96120 "#webamp-file-input" ,
97121 path . join ( __dirname , "../../demo/skins/Sonic_Attitude.wsz" )
98122 ) ;
123+ await page . evaluate (
124+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
125+ ) ;
99126 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
100127 await page . evaluate ( ( ) =>
101128 window . __webamp . store . dispatch ( { type : "SET_FOCUS" , input : "balance" } )
@@ -109,13 +136,19 @@ test("can render skins that have forward slash in filename", async () => {
109136 "#webamp-file-input" ,
110137 path . join ( __dirname , "../../demo/skins/rei_1.wsz" )
111138 ) ;
139+ await page . evaluate (
140+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
141+ ) ;
112142 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
113143 expect ( await page . screenshot ( ) ) . toMatchImageSnapshot ( snapshotOptions ) ;
114144} ) ;
115145
116146test ( "closing winamp shows the icon" , async ( ) => {
117147 await page . goto ( `${ DOMAIN } /#{"disableMarquee":true}` ) ;
118148 await page . evaluate ( ( ) => window . __webamp . skinIsLoaded ( ) ) ;
149+ await page . evaluate (
150+ ( ) => document . getElementsByClassName ( "loaded-icon" ) . length > 0
151+ ) ;
119152 await page . evaluate ( ( ) =>
120153 window . __webamp . store . dispatch ( { type : "CLOSE_WINAMP" } )
121154 ) ;
0 commit comments