File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed
Expand file tree Collapse file tree 3 files changed +11
-9
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 , Landscape } from "../../src/context/FrontendConfigContext" ;
23+ import { FrontendConfigProvider } from "../../src/context/FrontendConfigContext" ;
24+ import { AuthProviderOnboarding } from '../../src/context/AuthProviderOnboarding' ;
2425
2526// Augment the Cypress namespace to include type definitions for
2627// your custom command.
@@ -38,10 +39,7 @@ declare global {
3839
3940
4041Cypress . Commands . add ( 'mount' , ( component , options ) => {
41- return mount ( < ThemeProvider > < FrontendConfigProvider config = { {
42- "backendUrl" : "http://localhost:3000" ,
43- "landscape" : "DEV" as Landscape ,
44- "documentationBaseUrl" : "http://localhost:3000"
45- } } > { component } </ FrontendConfigProvider > </ ThemeProvider > , options ) ;
42+ return mount ( < ThemeProvider > < FrontendConfigProvider >
43+ < AuthProviderOnboarding > { component } </ AuthProviderOnboarding > </ FrontendConfigProvider > </ ThemeProvider > , options ) ;
4644} ) ;
4745
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' ;
34
45export enum Landscape {
56 Live = 'LIVE' ,
@@ -19,15 +20,16 @@ const FrontendConfigContext = createContext<FrontendConfigContextProps | null>(
1920 null ,
2021) ;
2122
22- const fetchPromise = fetch ( '/frontend-config.json' ) . then ( ( res ) => res . json ( ) ) ;
23+
24+ const fetchPromise = fetch ( isInTestingMode ? '/__cypress/src/frontend-config.json' : '/frontend-config.json' ) . then ( ( res ) => res . json ( ) ) ;
2325
2426interface FrontendConfigProviderProps {
2527 children : ReactNode ;
2628}
2729
2830export function FrontendConfigProvider ( {
29- children,
30- } : FrontendConfigProviderProps ) {
31+ children,
32+ } : FrontendConfigProviderProps ) {
3133 const config = use ( fetchPromise ) ;
3234 const docLinks = new DocLinkCreator ( config . documentationBaseUrl ) ;
3335 const value : FrontendConfigContextProps = {
Original file line number Diff line number Diff line change @@ -10,3 +10,5 @@ export const extractWorkspaceNameFromNamespace = (namespace: string) => {
1010export const projectnameToNamespace = ( projectname : string ) => {
1111 return `project-${ projectname } ` ;
1212} ;
13+
14+ export const isInTestingMode :Boolean = ! ! window . Cypress ;
You can’t perform that action at this time.
0 commit comments