Skip to content

Commit

Permalink
enable e2e mode dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
yandzee authored and geakstr committed Feb 21, 2024
1 parent 3ea1255 commit 4369c5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
6 changes: 0 additions & 6 deletions .github/cilium-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ hubble:
value: /var/log/hubble-ui-testing/log_files
- name: CORS_ENABLED
value: 'true'
frontend:
extraEnv:
- name: E2E_TEST_MODE
value: 'true'
- name: NODE_ENV
value: 'e2e'
ingress:
enabled: true
className: nginx
Expand Down
11 changes: 8 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,18 @@ const run = async () => {
};

const app = new Application(env, router, store, dataLayer, uiLayer, renderFn);

router.onInitialized(() => {
e2e.attributes.setEnabled(router.mockModeParam != null);
});

app
.onBeforeMount(_app => {
const env = app.environment;
e2e.attributes.setEnabled(env.isDev || env.isTesting);
uiLayer.onBeforeMount();
})
.onMounted(app => app.uiLayer.onMounted())
.onMounted(app => {
app.uiLayer.onMounted();
})
.mount('#app');
};

Expand Down
4 changes: 4 additions & 0 deletions src/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export class Router extends EventEmitter<Handlers> {
this.setupEventHandlers();
}

public get mockModeParam() {
return this.searchParams.get('e2e');
}

public get isInMemory() {
return this.kind === RouterKind.Memory;
}
Expand Down

0 comments on commit 4369c5e

Please sign in to comment.