@@ -76,44 +76,29 @@ describe('Browsing', () => {
76
76
error = false
77
77
} )
78
78
it ( 'has a blank query' , ( ) => {
79
- // Find the search button and perform an empty search, which should lead to the browse page
80
79
cy . get ( 'button.search-button' ) . click ( )
81
- // The new url should include "/browse"
82
80
cy . url ( ) . should ( 'include' , '/browse' )
83
- // The new url should not contain a query
84
81
cy . url ( ) . should ( 'not.include' , '?' )
85
- // The search bar on the browse page should remain blank
86
82
cy . get ( 'input.search-bar' ) . should ( 'have.value' , '' )
87
- // The service card component should be visible
88
83
cy . get ( ".card[data-cy='item-card']" ) . should ( 'be.visible' )
89
84
} )
90
85
91
86
it ( 'has a query term' , ( ) => {
92
- // Type an example search into the searchbar
93
87
cy . get ( 'input.search-bar' ) . type ( 'test' )
94
- // Press the search button
95
88
cy . get ( 'button.search-button' ) . click ( )
96
- // The new url should include the query
97
89
cy . url ( ) . should ( 'include' , '/browse?q=test' )
98
- // The search bar on the browse page should have the text that was searched for
99
90
cy . get ( 'input.search-bar' ) . should ( 'have.value' , 'test' )
100
- // The service card component should be visible
101
91
cy . get ( ".card[data-cy='item-card']" ) . should ( 'be.visible' )
102
92
} )
103
93
104
94
before ( ( ) => {
105
95
wares = false
106
96
} )
107
97
it ( 'has a query term, but that term has no results' , ( ) => {
108
- // type an example search into the searchbar
109
98
cy . get ( 'input.search-bar' ) . type ( 'asdfghjk' )
110
- // Press the search button
111
99
cy . get ( 'button.search-button' ) . click ( )
112
- // The new url should include the query
113
100
cy . url ( ) . should ( 'include' , '/browse?q=asdfghjk' )
114
- // The search bar on the browse page should have the text that was searched for
115
101
cy . get ( 'input.search-bar' ) . should ( 'have.value' , 'asdfghjk' )
116
- // The message showing that there are no results should show
117
102
cy . get ( "p[data-cy='no-results']" ) . should ( 'contain' , 'Your search for asdfghjk returned no results' )
118
103
} )
119
104
} )
@@ -137,28 +122,18 @@ describe('Browsing', () => {
137
122
138
123
context ( 'a search is completed successfully and' , ( ) => {
139
124
it ( 'navigates to "/browse" with a blank query' , ( ) => {
140
- // Find the search button and perform an empty search, which should lead to the browse page
141
125
cy . get ( 'button.search-button' ) . click ( )
142
- // The new url should include "/browse"
143
126
cy . url ( ) . should ( 'include' , '/browse' )
144
- // The new url should not contain a query
145
127
cy . url ( ) . should ( 'not.include' , '?' )
146
- // The search bar on the browse page should remain blank
147
128
cy . get ( 'input.search-bar' ) . should ( 'have.value' , '' )
148
- // The service card component should be visible
149
129
cy . get ( ".card[data-cy='item-card']" ) . should ( 'be.visible' )
150
130
} )
151
131
152
132
it ( 'navigates to "/browse" with a query term' , ( ) => {
153
- // type an example search into the searchbar
154
133
cy . get ( 'input.search-bar' ) . type ( 'test' )
155
- // Press the search button
156
134
cy . get ( 'button.search-button' ) . click ( )
157
- // The new url should include the query
158
135
cy . url ( ) . should ( 'include' , '/browse?q=test' )
159
- // The search bar on the browse page should have the text that was searched for
160
136
cy . get ( 'input.search-bar' ) . should ( 'have.value' , 'test' )
161
- // The service card component should be visible
162
137
cy . get ( ".card[data-cy='item-card']" ) . should ( 'be.visible' )
163
138
} )
164
139
} )
0 commit comments