@@ -34,11 +34,11 @@ module.exports = () => {
3434 describe ( 'URL/request method inputs' , ( ) => {
3535 setupFxn ( ) ;
3636
37- it ( 'can switch tabs in the composer pane' , async ( ) => { // May refactor since history tab will be a dropdown1
37+ it ( 'can view history in the composer pane' , async ( ) => { // May refactor since history tab will be a dropdown1
3838
3939 // Click history, confirm history column is active
4040 await page . locator ( 'a >> text=History' ) . click ( ) ;
41- const historySelected = await page . locator ( 'div# composer >> .is-active' ) . innerText ( ) ;
41+ const historySelected = await page . locator ( 'div[id^=" composer"] >> .is-active' ) . innerText ( ) ;
4242 expect ( historySelected ) . to . equal ( 'History' ) ;
4343
4444 // Click composer, confirm composer column is active
@@ -93,33 +93,31 @@ module.exports = () => {
9393
9494 it ( 'can select a request type' , async ( ) => {
9595 // possibly remove the first clicks based on button vs dropdown menu
96- await page . locator ( '#selected-network' ) . click ( ) ;
97- await page . locator ( '#composer >> a >> text=GRAPHQL' ) . click ( ) ;
98- expect ( await page . locator ( '#selected-network ' ) . innerText ( ) ) . to . equal ( 'GRAPHQL' )
96+ // await page.locator('#selected-network').click();
97+ await page . locator ( 'button >> text=GRAPHQL' ) . click ( ) ;
98+ expect ( await page . locator ( 'div#composer-graphql ' ) . count ( ) ) . to . equal ( 1 )
9999
100- await page . locator ( '#selected-network' ) . click ( ) ;
101- await page . locator ( '#composer >> a >> text=REST ' ) . click ( ) ;
102- expect ( await page . locator ( '#selected-network ' ) . innerText ( ) ) . to . equal ( 'REST' )
100+ // await page.locator('#selected-network').click();
101+ await page . locator ( 'button >> text=HTTP2 ' ) . click ( ) ;
102+ expect ( await page . locator ( 'div#composer-http2 ' ) . count ( ) ) . to . equal ( 1 )
103103
104- await page . locator ( '#selected-network' ) . click ( ) ;
105- await page . locator ( '#composer >> a >> text=gRPC ' ) . click ( ) ;
106- expect ( await page . locator ( '#selected-network ' ) . innerText ( ) ) . to . equal ( 'gRPC' )
104+ // await page.locator('#selected-network').click();
105+ await page . locator ( 'button >> text=GRPC ' ) . click ( ) ;
106+ expect ( await page . locator ( 'div#composer-grpc ' ) . count ( ) ) . to . equal ( 1 )
107107
108- await page . locator ( '#selected-network' ) . click ( ) ;
109- await page . locator ( '#composer >> a >> text=WEB SOCKETS ' ) . click ( ) ;
110- expect ( await page . locator ( '#selected-network ' ) . innerText ( ) ) . to . equal ( 'WEB SOCKETS' )
108+ // await page.locator('#selected-network').click();
109+ await page . locator ( 'button >> text=WEB SOCKET ' ) . click ( ) ;
110+ expect ( await page . locator ( 'div#composer-websocket ' ) . count ( ) ) . to . equal ( 1 )
111111
112- await page . locator ( '#selected-network' ) . click ( ) ;
113- await page . locator ( '#composer >> a >> text=WebRTC ' ) . click ( ) ;
114- expect ( await page . locator ( '#selected-network ' ) . innerText ( ) ) . to . equal ( 'WebRTC' )
112+ // await page.locator('#selected-network').click();
113+ await page . locator ( 'button >> text=WEBRTC ' ) . click ( ) ;
114+ expect ( await page . locator ( 'div#composer-webrtc ' ) . count ( ) ) . to . equal ( 1 )
115115
116- await page . locator ( '#selected-network' ) . click ( ) ;
117- await page . locator ( '#composer >> a >> text=OpenAPI' ) . click ( ) ;
118- expect ( await page . locator ( '#selected-network' ) . innerText ( ) ) . to . equal ( 'OpenAPI' )
116+ await page . locator ( 'button>> text=OPENAPI' ) . click ( ) ;
117+ expect ( await page . locator ( 'div#composer-openapi' ) . count ( ) ) . to . equal ( 1 )
119118
120- await page . locator ( '#selected-network' ) . click ( ) ;
121- await page . locator ( '#composer >> a >> text=WebHook' ) . click ( ) ;
122- expect ( await page . locator ( '#selected-network' ) . innerText ( ) ) . to . equal ( 'WebHook' )
119+ await page . locator ( 'button>> text=WEBHOOK' ) . click ( ) ;
120+ expect ( await page . locator ( 'div#composer-webhook' ) . count ( ) ) . to . equal ( 1 )
123121 } ) ;
124122
125123 // WIP code below to check dropdown menu items
@@ -134,42 +132,42 @@ module.exports = () => {
134132
135133 it ( 'can select a REST method' , async ( ) => { // ************************ REDO THIS TEST, it chains clicks in a bad way ********************
136134
137- // Make sure REST method is selected
138- await page . locator ( '#selected-network ' ) . click ( ) ;
139- await page . locator ( '#composer >> a >> text=REST' ) . click ( ) ;
135+ // Make sure HTTP2 method is selected
136+ await page . locator ( 'button>> text=HTTP2 ' ) . click ( ) ;
137+
140138
141139 // // click and select POST
142- await page . locator ( '#composer >> span >> text=GET ' ) . click ( ) ;
143- await page . locator ( '# composer >> a >> text=POST' ) . click ( ) ;
140+ await page . locator ( 'button#rest-method ' ) . click ( ) ;
141+ await page . locator ( 'div[id^=" composer"] >> a >> text=POST' ) . click ( ) ;
144142 expect ( await page . locator ( 'button.is-rest >> span >> text=POST' ) . count ( ) ) . to . equal ( 1 ) ;
145143
146144
147145 // // click and select PUT
148- await page . locator ( '#composer >> span >> text=POST ' ) . click ( ) ;
149- await page . locator ( '# composer >> a >> text=PUT' ) . click ( ) ;
146+ await page . locator ( 'button#rest-method ' ) . click ( ) ;
147+ await page . locator ( 'div[id^=" composer"] >> a >> text=PUT' ) . click ( ) ;
150148 expect ( await page . locator ( 'button.is-rest >> span >> text=PUT' ) . count ( ) ) . to . equal ( 1 ) ;
151149
152150 // // click and select GET
153- await page . locator ( '#composer >> span >> text=PUT ' ) . click ( ) ;
154- await page . locator ( '# composer >> a >> text=GET' ) . click ( ) ;
151+ await page . locator ( 'button#rest-method ' ) . click ( ) ;
152+ await page . locator ( 'div[id^=" composer"] >> a >> text=GET' ) . click ( ) ;
155153 expect ( await page . locator ( 'button.is-rest >> span >> text=GET' ) . count ( ) ) . to . equal ( 1 ) ;
156154
157155 // // click and select PATCH
158- await page . locator ( '#composer >> span >> text=GET ' ) . click ( ) ;
159- await page . locator ( '# composer >> a >> text=PATCH' ) . click ( ) ;
156+ await page . locator ( 'button#rest-method ' ) . click ( ) ;
157+ await page . locator ( 'div[id^=" composer"] >> a >> text=PATCH' ) . click ( ) ;
160158 expect ( await page . locator ( 'button.is-rest >> span >> text=PATCH' ) . count ( ) ) . to . equal ( 1 ) ;
161159
162160 // // click and select DELETE
163- await page . locator ( '#composer >> span >> text=PATCH ' ) . click ( ) ;
164- await page . locator ( '# composer >> a >> text=DELETE' ) . click ( ) ;
161+ await page . locator ( 'button#rest-method ' ) . click ( ) ;
162+ await page . locator ( 'div[id^=" composer"] >> a >> text=DELETE' ) . click ( ) ;
165163 expect ( await page . locator ( 'button.is-rest >> span >> text=DELETE' ) . count ( ) ) . to . equal ( 1 ) ;
166164 } ) ;
167165
168166
169167 it ( 'can type url into url input' , async ( ) => {
170- await page . locator ( '.input-is-medium ' ) . fill ( 'http://jsonplaceholder.typicode.com/posts/1' ) ;
168+ await page . locator ( '#url-input ' ) . fill ( 'http://jsonplaceholder.typicode.com/posts/1' ) ;
171169
172- const input = await page . locator ( '.input-is-medium ' ) . inputValue ( ) ;
170+ const input = await page . locator ( '#url-input ' ) . inputValue ( ) ;
173171
174172 expect ( input ) . to . equal ( 'http://jsonplaceholder.typicode.com/posts/1' )
175173 } ) ;
@@ -186,8 +184,7 @@ module.exports = () => {
186184 } ) ;
187185
188186 it ( 'can add new headers in request' , async ( ) => {
189- // click add header (specifically the button immediately to the right of the "header" title)
190- const addHeaderButton = await page . locator ( 'button:near(:text("Headers"), 5)' ) ;
187+ const addHeaderButton = await page . locator ( 'button#add-header' ) ;
191188 expect ( await addHeaderButton . count ( ) ) . to . equal ( 1 ) ;
192189
193190 await addHeaderButton . click ( ) ;
@@ -215,7 +212,7 @@ module.exports = () => {
215212
216213 it ( 'can add new cookies in request' , async ( ) => {
217214 // click add cookie
218- const addCookieButton = await page . locator ( 'button:near(:text("Cookies"), 5) ' ) ;
215+ const addCookieButton = await page . locator ( 'button#add-cookie ' ) ;
219216 expect ( await addCookieButton . count ( ) ) . to . equal ( 1 ) ;
220217
221218 await addCookieButton . click ( ) ;
@@ -236,20 +233,23 @@ module.exports = () => {
236233
237234 describe ( 'Request body inputs' , ( ) => {
238235 it ( 'body input appears for non GET requests' , async ( ) => {
236+ // // click and select GET
237+ await page . locator ( 'button#rest-method' ) . click ( ) ;
238+ await page . locator ( 'text=GET' ) . click ( ) ;
239239 let bodyInputcount = await page . locator ( '#body-entry-select' ) . count ( ) ;
240240 expect ( bodyInputcount ) . to . equal ( 0 ) ;
241241
242242 // // click and select POST
243- await page . locator ( '#composer >> span >> text=GET ' ) . click ( ) ;
244- await page . locator ( '# composer >> a >> text=POST' ) . click ( ) ;
243+ await page . locator ( 'button#rest-method ' ) . click ( ) ;
244+ await page . locator ( 'div[id^=" composer"] >> a >> text=POST' ) . click ( ) ;
245245
246246 bodyInputcount = await page . locator ( '#body-entry-select' ) . count ( ) ;
247247 expect ( bodyInputcount ) . to . equal ( 1 ) ;
248248 } ) ;
249249
250250 it ( 'can type plain text into body' , async ( ) => {
251251 const input = 'Team Swell is the best!' ;
252- const bodyInput = await page . locator ( '#body-entry-select >> textarea ' ) ;
252+ const bodyInput = await page . locator ( 'div.cm-line ' ) ;
253253 await bodyInput . fill ( input ) ;
254254 expect ( await page . locator ( 'div.CodeMirror-code >> span' ) . innerText ( ) ) . to . equal ( input )
255255 } ) ;
0 commit comments