88 requestBodySection , requestCredentialsSection ,
99 requestHeadersSection , requestPanel ,
1010 requestQueryParamSection , requestSendButton ,
11- requestUrlSection
11+ requestUrlSection ,
1212} from './testHelper.js' ;
1313
1414/** @typedef {import('..').ApiConsole } ApiConsole */
@@ -44,9 +44,8 @@ describe('API Console request', () => {
4444 describe ( 'Sections' , ( ) => {
4545 beforeEach ( async ( ) => {
4646 await navigationSelectEndpointMethod ( element , '/test-headers' , 'post' ) ;
47- await aTimeout ( 50 ) ;
4847 // @ts -ignore
49- documentationTryItButton ( element ) . click ( ) ;
48+ ( await documentationTryItButton ( element ) ) . click ( ) ;
5049 await aTimeout ( 50 ) ;
5150 } ) ;
5251
@@ -62,9 +61,8 @@ describe('API Console request', () => {
6261 describe ( 'Headers' , ( ) => {
6362 beforeEach ( async ( ) => {
6463 await navigationSelectEndpointMethod ( element , '/test-headers' , 'post' ) ;
65- await aTimeout ( 50 ) ;
6664 // @ts -ignore
67- documentationTryItButton ( element ) . click ( ) ;
65+ ( await documentationTryItButton ( element ) ) . click ( ) ;
6866 await aTimeout ( 50 ) ;
6967 } ) ;
7068
@@ -122,9 +120,8 @@ describe('API Console request', () => {
122120 describe ( 'Body' , ( ) => {
123121 beforeEach ( async ( ) => {
124122 await navigationSelectEndpointMethod ( element , '/test-headers' , 'post' ) ;
125- await aTimeout ( 100 ) ;
126123 // @ts -ignore
127- documentationTryItButton ( element ) . click ( ) ;
124+ ( await documentationTryItButton ( element ) ) . click ( ) ;
128125 await aTimeout ( 50 ) ;
129126 } ) ;
130127
@@ -163,9 +160,8 @@ describe('API Console request', () => {
163160
164161 beforeEach ( async ( ) => {
165162 await navigationSelectEndpointMethod ( element , '/test-custom-scheme' , 'get' ) ;
166- await aTimeout ( 50 ) ;
167163 // @ts -ignore
168- documentationTryItButton ( element ) . click ( ) ;
164+ ( await documentationTryItButton ( element ) ) . click ( ) ;
169165 await aTimeout ( 50 ) ;
170166 credentialsSection = requestCredentialsSection ( element ) ;
171167 } ) ;
@@ -229,9 +225,8 @@ describe('API Console request', () => {
229225
230226 beforeEach ( async ( ) => {
231227 await navigationSelectEndpointMethod ( element , '/test-oauth10-scheme' , 'get' ) ;
232- await aTimeout ( 70 ) ;
233228 // @ts -ignore
234- documentationTryItButton ( element ) . click ( ) ;
229+ ( await documentationTryItButton ( element ) ) . click ( ) ;
235230 await aTimeout ( 70 ) ;
236231 credentialsSection = requestCredentialsSection ( element ) ;
237232 } ) ;
@@ -280,9 +275,8 @@ describe('API Console request', () => {
280275
281276 beforeEach ( async ( ) => {
282277 await navigationSelectEndpointMethod ( element , '/test-oauth20-scheme' , 'get' ) ;
283- await aTimeout ( 50 ) ;
284278 // @ts -ignore
285- documentationTryItButton ( element ) . click ( ) ;
279+ ( await documentationTryItButton ( element ) ) . click ( ) ;
286280 await aTimeout ( 50 ) ;
287281 credentialsSection = requestCredentialsSection ( element ) ;
288282 } ) ;
@@ -324,9 +318,8 @@ describe('API Console request', () => {
324318
325319 beforeEach ( async ( ) => {
326320 await navigationSelectEndpointMethod ( element , '/test-basic-scheme' , 'get' ) ;
327- await aTimeout ( 50 ) ;
328321 // @ts -ignore
329- documentationTryItButton ( element ) . click ( ) ;
322+ ( await documentationTryItButton ( element ) ) . click ( ) ;
330323 await aTimeout ( 50 ) ;
331324 credentialsSection = requestCredentialsSection ( element ) ;
332325 } ) ;
@@ -387,9 +380,8 @@ describe('API Console request', () => {
387380
388381 beforeEach ( async ( ) => {
389382 await navigationSelectEndpointMethod ( element , '/test-digest-scheme' , 'get' ) ;
390- await aTimeout ( 100 ) ;
391383 // @ts -ignore
392- documentationTryItButton ( element ) . click ( ) ;
384+ ( await documentationTryItButton ( element ) ) . click ( ) ;
393385 await aTimeout ( 50 ) ;
394386 credentialsSection = requestCredentialsSection ( element ) ;
395387 } ) ;
@@ -468,9 +460,8 @@ describe('API Console request', () => {
468460
469461 beforeEach ( async ( ) => {
470462 await navigationSelectEndpointMethod ( element , '/test-pass-through-scheme' , 'get' ) ;
471- await aTimeout ( 100 ) ;
472463 // @ts -ignore
473- documentationTryItButton ( element ) . click ( ) ;
464+ ( await documentationTryItButton ( element ) ) . click ( ) ;
474465 await aTimeout ( 50 ) ;
475466 credentialsSection = requestCredentialsSection ( element ) ;
476467 } ) ;
@@ -489,7 +480,8 @@ describe('API Console request', () => {
489480 assert . equal ( authorizationMethod . getAttribute ( 'type' ) , 'pass through' ) ;
490481 } ) ;
491482
492- it ( 'should render scheme fields' , ( ) => {
483+ it ( 'should render scheme fields' , async ( ) => {
484+ await waitUntil ( ( ) => Boolean ( credentialsSection . shadowRoot . querySelector ( 'api-authorization-method' ) ) ) ;
493485 const authorizationMethod = credentialsSection . shadowRoot . querySelector ( 'api-authorization-method' ) ;
494486 assert . equal ( authorizationMethod . shadowRoot . querySelector ( '.subtitle' ) . innerText . trim ( ) , 'Scheme: passthrough' ) ;
495487 assert . exists ( authorizationMethod . shadowRoot . querySelector ( '.hint-icon' ) ) ;
@@ -539,9 +531,8 @@ describe('API Console request', () => {
539531 describe ( 'Required parameters' , ( ) => {
540532 beforeEach ( async ( ) => {
541533 await navigationSelectEndpointMethod ( element , '/test-query-parameters' , 'post' ) ;
542- await aTimeout ( 50 ) ;
543534 // @ts -ignore
544- documentationTryItButton ( element ) . click ( ) ;
535+ ( await documentationTryItButton ( element ) ) . click ( ) ;
545536 await aTimeout ( 50 ) ;
546537 requestPanel ( element ) . allowHideOptional = true ;
547538 await aTimeout ( 50 ) ;
@@ -608,9 +599,8 @@ describe('API Console request', () => {
608599 describe ( 'Optional parameters' , ( ) => {
609600 beforeEach ( async ( ) => {
610601 await navigationSelectEndpointMethod ( element , '/test-query-parameters' , 'put' ) ;
611- await aTimeout ( 50 ) ;
612602 // @ts -ignore
613- documentationTryItButton ( element ) . click ( ) ;
603+ ( await documentationTryItButton ( element ) ) . click ( ) ;
614604 await aTimeout ( 50 ) ;
615605 requestPanel ( element ) . allowHideOptional = true ;
616606 await aTimeout ( 50 ) ;
@@ -659,9 +649,8 @@ describe('API Console request', () => {
659649 describe ( 'allowHideOptional disabled' , ( ) => {
660650 beforeEach ( async ( ) => {
661651 await navigationSelectEndpointMethod ( element , '/test-query-parameters' , 'put' ) ;
662- await aTimeout ( 50 ) ;
663652 // @ts -ignore
664- documentationTryItButton ( element ) . click ( ) ;
653+ ( await documentationTryItButton ( element ) ) . click ( ) ;
665654 await aTimeout ( 50 ) ;
666655 } ) ;
667656
@@ -674,9 +663,8 @@ describe('API Console request', () => {
674663 describe ( 'No parameters' , ( ) => {
675664 beforeEach ( async ( ) => {
676665 await navigationSelectEndpointMethod ( element , '/test-custom-scheme' , 'get' ) ;
677- await aTimeout ( 50 ) ;
678666 // @ts -ignore
679- documentationTryItButton ( element ) . click ( ) ;
667+ ( await documentationTryItButton ( element ) ) . click ( ) ;
680668 await aTimeout ( 50 ) ;
681669 } ) ;
682670
0 commit comments