@@ -33,6 +33,7 @@ import {
3333 V_P_PKG_PLAYGROUND_R ,
3434} from '@test-data/portal'
3535import { BASE_ORIGIN , SEARCH_TIMEOUT , TICKET_BASE_URL } from '@test-setup'
36+ import { isLocalHost } from '@services/utils'
3637
3738test . describe ( '11.1.1 Operations details REST API (Package)' , ( ) => {
3839
@@ -261,6 +262,7 @@ test.describe('11.1.1 Operations details REST API (Package)', () => {
261262 const { operationPage } = portalPage
262263 const accessToken = ( await getAuthDataFromPage ( page ) ) . token
263264 const testPackage = P_PK_PGND
265+ const testCustomServerHost = isLocalHost ( ) ? 'http://host.docker.internal:8081/api/v1' : `${ BASE_ORIGIN } /api/v1`
264266
265267 await portalPage . gotoOperation ( versionPlayground , GET_SYSTEM_INFO )
266268 await operationPage . toolbar . playgroundBtn . click ( )
@@ -300,7 +302,7 @@ test.describe('11.1.1 Operations details REST API (Package)', () => {
300302
301303 await test . step ( 'Add server 2 and select it' , async ( ) => {
302304 await operationPage . playgroundPanel . serverSlt . addCustomServerBtn . click ( )
303- await operationPage . playgroundPanel . addServerDialog . urlTxtFld . fill ( ` ${ BASE_ORIGIN } /api/v1` )
305+ await operationPage . playgroundPanel . addServerDialog . urlTxtFld . fill ( testCustomServerHost )
304306 await operationPage . playgroundPanel . addServerDialog . addBtn . click ( )
305307 await operationPage . playgroundPanel . serverSlt . click ( )
306308
@@ -311,22 +313,19 @@ test.describe('11.1.1 Operations details REST API (Package)', () => {
311313 } )
312314 } )
313315
314- //Playground doesn't work on localhost
315- if ( ! portalPage . url ( ) . includes ( 'localhost' ) ) {
316- await test . step ( 'Send request without token (negative)' , async ( ) => {
317- await operationPage . playgroundPanel . sendBtn . click ( )
316+ await test . step ( 'Send request without token (negative)' , async ( ) => {
317+ await operationPage . playgroundPanel . sendBtn . click ( )
318318
319- await expect ( operationPage . playgroundPanel ) . toContainText ( '"message": "Unauthorized",' )
320- } )
319+ await expect ( operationPage . playgroundPanel ) . toContainText ( '"message": "Unauthorized",' )
320+ } )
321321
322- await test . step ( 'Send request with token and filters ' , async ( ) => {
323- await operationPage . playgroundPanel . tokenTxtFld . fill ( accessToken )
322+ await test . step ( 'Send request with token' , async ( ) => {
323+ await operationPage . playgroundPanel . tokenTxtFld . fill ( accessToken )
324324
325- await operationPage . playgroundPanel . sendBtn . click ( )
325+ await operationPage . playgroundPanel . sendBtn . click ( )
326326
327- await expect ( operationPage . playgroundPanel ) . toContainText ( '"backendVersion"' )
328- } )
329- }
327+ await expect ( operationPage . playgroundPanel ) . toContainText ( '"backendVersion"' )
328+ } )
330329
331330 await test . step ( 'Close Playground' , async ( ) => {
332331 await operationPage . toolbar . playgroundBtn . click ( )
0 commit comments