File tree Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ import { ThemeProvider } from '@ui5/webcomponents-react';
2020import { mount } from 'cypress/react' ;
2121// Import commands.js using ES2015 syntax:
2222import './commands' ;
23- import { FrontendConfigProvider } from '../../src/context/FrontendConfigContext' ;
23+ import { FrontendConfigContext } from '../../src/context/FrontendConfigContext' ;
24+ import { mockedFrontendConfig } from '../../src/utils/testing' ;
2425
2526// Augment the Cypress namespace to include type definitions for
2627// your custom command.
@@ -38,9 +39,9 @@ declare global {
3839
3940Cypress . Commands . add ( 'mount' , ( component , options ) => {
4041 return mount ( < ThemeProvider >
41- < FrontendConfigProvider >
42- { component }
43- </ FrontendConfigProvider >
42+ < FrontendConfigContext value = { mockedFrontendConfig } >
43+ { component }
44+ </ FrontendConfigContext >
4445 </ ThemeProvider > , options ) ;
4546} ) ;
4647
Original file line number Diff line number Diff line change 11import { ReactNode , createContext , use } from 'react' ;
22import { DocLinkCreator } from '../lib/shared/links' ;
3- import { isInTestingMode } from '../utils' ;
43
54export enum Landscape {
65 Live = 'LIVE' ,
76 Canary = 'CANARY' ,
87 Staging = 'STAGING' ,
98 Development = 'DEV' ,
9+ Local = 'LOCAL' ,
1010}
1111
1212interface FrontendConfigContextProps {
@@ -16,12 +16,12 @@ interface FrontendConfigContextProps {
1616 links : DocLinkCreator ;
1717}
1818
19- const FrontendConfigContext = createContext < FrontendConfigContextProps | null > (
19+ export const FrontendConfigContext = createContext < FrontendConfigContextProps | null > (
2020 null ,
2121) ;
2222
2323
24- const fetchPromise = fetch ( isInTestingMode ? '/__cypress/src/frontend-config.json' : '/frontend-config.json' ) . then ( ( res ) => res . json ( ) ) ;
24+ const fetchPromise = fetch ( '/frontend-config.json' ) . then ( ( res ) => res . json ( ) ) ;
2525
2626interface FrontendConfigProviderProps {
2727 children : ReactNode ;
Original file line number Diff line number Diff line change @@ -11,4 +11,3 @@ export const projectnameToNamespace = (projectname: string) => {
1111 return `project-${ projectname } ` ;
1212} ;
1313
14- export const isInTestingMode :Boolean = ! ! window . Cypress ;
Original file line number Diff line number Diff line change 1+ import { DocLinkCreator } from '../lib/shared/links.ts' ;
2+ import { Landscape } from '../context/FrontendConfigContext.tsx' ;
3+
4+ export const isInTestingMode : Boolean = ! ! window . Cypress ;
5+ const documentationBaseUrl = 'http://localhost:3000' ;
6+ export const mockedFrontendConfig = {
7+ backendUrl : 'http://localhost:3000' ,
8+ landscape : Landscape . Local ,
9+ documentationBaseUrl : 'http://localhost:3000' ,
10+ links : new DocLinkCreator ( documentationBaseUrl ) ,
11+ } ;
You can’t perform that action at this time.
0 commit comments