33 [ playground ] : { host } ,
44} = Cypress . env ( )
55
6- const HIT_ITEM_CLASS =
7- playground === 'react' ? '.ais-InfiniteHits-item' : '.ais-Hits-item'
6+ const HIT_ITEM_CLASS = '.ais-InfiniteHits-item'
87
98describe ( `${ playground } playground test` , ( ) => {
109 before ( ( ) => {
@@ -17,20 +16,15 @@ describe(`${playground} playground test`, () => {
1716 } )
1817
1918 it ( 'Contains stats' , ( ) => {
20- if ( playground === 'react' ) cy . contains ( '12,546 results' )
21- if ( playground === 'angular' ) cy . contains ( '12546 results' )
19+ cy . contains ( '15 results' )
2220 } )
2321
2422 it ( 'Contains filter clear' , ( ) => {
25- if ( playground === 'react' ) cy . contains ( 'Clear all filters' )
26- if ( playground === 'angular' ) cy . contains ( 'Clear refinements' )
23+ cy . contains ( 'Clear all filters' )
2724 } )
2825
2926 it ( 'Contains Genres' , ( ) => {
30- cy . contains ( 'Genres' )
3127 cy . contains ( 'Action' )
32- if ( playground === 'react' ) cy . contains ( '5,554' )
33- if ( playground === 'angular' ) cy . contains ( '5554' )
3428 } )
3529
3630 it ( 'Contains searchBar' , ( ) => {
@@ -46,7 +40,7 @@ describe(`${playground} playground test`, () => {
4640 const select = `.ais-SortBy-select`
4741 cy . get ( select ) . select ( 'steam-video-games:recommendationCount:asc' )
4842 cy . wait ( 1000 )
49- cy . get ( HIT_ITEM_CLASS ) . eq ( 0 ) . contains ( 'Rag Doll Kung Fu ' )
43+ cy . get ( HIT_ITEM_CLASS ) . eq ( 0 ) . contains ( 'Deathmatch Classic ' )
5044 } )
5145
5246 it ( 'Sort by default relevancy' , ( ) => {
@@ -57,28 +51,22 @@ describe(`${playground} playground test`, () => {
5751 } )
5852
5953 it ( 'click on facets' , ( ) => {
60- cy . get ( HIT_ITEM_CLASS ) . eq ( 0 ) . contains ( 'Counter-Strike' )
61-
6254 const checkbox = `.ais-RefinementList-list .ais-RefinementList-checkbox`
6355 cy . get ( checkbox ) . eq ( 1 ) . click ( )
64-
65- if ( playground === 'react' ) cy . contains ( '1,939' )
66- if ( playground === 'angular' ) cy . contains ( '1939' )
67-
68- cy . contains ( 'Counter-Strike' ) . should ( 'not.exist' )
56+ cy . get ( HIT_ITEM_CLASS ) . eq ( 1 ) . contains ( 'Team Fortress Classic' )
57+ cy . get ( HIT_ITEM_CLASS ) . eq ( 1 ) . contains ( '4.99 $' )
6958 } )
7059
7160 it ( 'Search' , ( ) => {
72- cy . get ( '.ais-SearchBox-input' ) . type ( 'orwell ' )
61+ cy . get ( '.ais-SearchBox-input' ) . type ( 'Half-Life ' )
7362 cy . wait ( 1000 )
74- cy . get ( HIT_ITEM_CLASS ) . eq ( 0 ) . contains ( 'Orwell' )
75- cy . get ( HIT_ITEM_CLASS ) . eq ( 0 ) . contains ( 'Late 2016' )
63+ cy . get ( HIT_ITEM_CLASS ) . eq ( 0 ) . contains ( 'Half-Life' )
7664 } )
7765
7866 it ( 'Unclick on facets' , ( ) => {
7967 const checkbox = `.ais-RefinementList-list .ais-RefinementList-checkbox`
8068 cy . get ( checkbox ) . eq ( 0 ) . click ( )
81- cy . get ( HIT_ITEM_CLASS ) . eq ( 0 ) . contains ( 'Orwell ' )
69+ cy . get ( HIT_ITEM_CLASS ) . eq ( 0 ) . contains ( 'Half-Life ' )
8270 } )
8371
8472 it ( 'Placeholder Search' , ( ) => {
@@ -88,19 +76,7 @@ describe(`${playground} playground test`, () => {
8876 } )
8977
9078 it ( 'Paginate Search' , ( ) => {
91- cy . get ( HIT_ITEM_CLASS ) . eq ( 0 ) . contains ( 'Counter-Strike' )
92-
93- if ( playground === 'react' ) {
94- cy . get ( '.ais-InfiniteHits-loadMore' ) . click ( )
95- cy . get ( HIT_ITEM_CLASS ) . should ( 'have.length' , 12 )
96- } else {
97- if ( playground === 'vue' ) {
98- cy . get ( '.ais-Pagination-item' ) . eq ( 3 ) . click ( )
99- } else {
100- cy . get ( '.ais-Pagination-item--page' ) . eq ( 1 ) . click ( )
101- }
102-
103- cy . contains ( 'Counter-Strike' ) . should ( 'not.exist' )
104- }
79+ cy . get ( '.ais-InfiniteHits-loadMore' ) . click ( )
80+ cy . get ( HIT_ITEM_CLASS ) . should ( 'have.length' , 11 )
10581 } )
10682} )
0 commit comments