@@ -5,23 +5,25 @@ import { expect, test } from '@playwright/test';
55import { CONFIG , createDoc , overrideConfig } from './utils-common' ;
66
77test . describe ( 'Config' , ( ) => {
8- test ( 'it checks that sentry is trying to init from config endpoint' , async ( {
9- page,
10- } ) => {
11- await overrideConfig ( page , {
12- SENTRY_DSN : 'https://sentry.io/123' ,
8+ if ( process . env . IS_INSTANCE !== 'true' ) {
9+ test ( 'it checks that sentry is trying to init from config endpoint' , async ( {
10+ page,
11+ } ) => {
12+ await overrideConfig ( page , {
13+ SENTRY_DSN : 'https://sentry.io/123' ,
14+ } ) ;
15+
16+ const invalidMsg = 'Invalid Sentry Dsn: https://sentry.io/123' ;
17+ const consoleMessage = page . waitForEvent ( 'console' , {
18+ timeout : 5000 ,
19+ predicate : ( msg ) => msg . text ( ) . includes ( invalidMsg ) ,
20+ } ) ;
21+
22+ await page . goto ( '/' ) ;
23+
24+ expect ( ( await consoleMessage ) . text ( ) ) . toContain ( invalidMsg ) ;
1325 } ) ;
14-
15- const invalidMsg = 'Invalid Sentry Dsn: https://sentry.io/123' ;
16- const consoleMessage = page . waitForEvent ( 'console' , {
17- timeout : 5000 ,
18- predicate : ( msg ) => msg . text ( ) . includes ( invalidMsg ) ,
19- } ) ;
20-
21- await page . goto ( '/' ) ;
22-
23- expect ( ( await consoleMessage ) . text ( ) ) . toContain ( invalidMsg ) ;
24- } ) ;
26+ }
2527
2628 test ( 'it checks that media server is configured from config endpoint' , async ( {
2729 page,
@@ -55,7 +57,7 @@ test.describe('Config', () => {
5557
5658 // Check src of image
5759 expect ( await image . getAttribute ( 'src' ) ) . toMatch (
58- / h t t p : \/ \/ l o c a l h o s t : 8 0 8 3 \/ m e d i a \ / .* \ /a t t a c h m e n t s \ / .* .p n g / ,
60+ new RegExp ( ` ${ process . env . MEDIA_BASE_URL } / media/.*? /attachments/.*? .png` ) ,
5961 ) ;
6062 } ) ;
6163
@@ -71,9 +73,9 @@ test.describe('Config', () => {
7173 . click ( ) ;
7274
7375 const webSocket = await page . waitForEvent ( 'websocket' , ( webSocket ) => {
74- return webSocket . url ( ) . includes ( 'ws://localhost:4444/collaboration/ws/' ) ;
76+ return webSocket . url ( ) . includes ( ` ${ process . env . COLLABORATION_WS_URL } ` ) ;
7577 } ) ;
76- expect ( webSocket . url ( ) ) . toContain ( 'ws://localhost:4444/collaboration/ws/' ) ;
78+ expect ( webSocket . url ( ) ) . toContain ( ` ${ process . env . COLLABORATION_WS_URL } ` ) ;
7779 } ) ;
7880
7981 test ( 'it checks that Crisp is trying to init from config endpoint' , async ( {
@@ -85,9 +87,8 @@ test.describe('Config', () => {
8587
8688 await page . goto ( '/' ) ;
8789
88- await expect (
89- page . locator ( '#crisp-chatbox' ) . getByText ( 'Invalid website' ) ,
90- ) . toBeVisible ( ) ;
90+ const crispElement = page . locator ( '#crisp-chatbox' ) ;
91+ await expect ( crispElement ) . toBeAttached ( ) ;
9192 } ) ;
9293
9394 test ( 'it checks FRONTEND_CSS_URL config' , async ( { page } ) => {
@@ -118,20 +119,22 @@ test.describe('Config', () => {
118119 ) . toBeAttached ( ) ;
119120 } ) ;
120121
121- test ( 'it checks the config api is called' , async ( { page } ) => {
122- const responsePromise = page . waitForResponse (
123- ( response ) =>
124- response . url ( ) . includes ( '/config/' ) && response . status ( ) === 200 ,
125- ) ;
122+ if ( process . env . IS_INSTANCE !== 'true' ) {
123+ test ( 'it checks the config api is called' , async ( { page } ) => {
124+ const responsePromise = page . waitForResponse (
125+ ( response ) =>
126+ response . url ( ) . includes ( '/config/' ) && response . status ( ) === 200 ,
127+ ) ;
126128
127- await page . goto ( '/' ) ;
129+ await page . goto ( '/' ) ;
128130
129- const response = await responsePromise ;
130- expect ( response . ok ( ) ) . toBeTruthy ( ) ;
131+ const response = await responsePromise ;
132+ expect ( response . ok ( ) ) . toBeTruthy ( ) ;
131133
132- const json = ( await response . json ( ) ) as typeof CONFIG ;
133- expect ( json ) . toStrictEqual ( CONFIG ) ;
134- } ) ;
134+ const json = ( await response . json ( ) ) as typeof CONFIG ;
135+ expect ( json ) . toStrictEqual ( CONFIG ) ;
136+ } ) ;
137+ }
135138} ) ;
136139
137140test . describe ( 'Config: Not logged' , ( ) => {
0 commit comments