Skip to content

The open alternative to Salesforce, designed for AI.

Type the e2e window env and assert on workflow creation errors (#26730)

Félix Malfait19bb8009e0b4
diff --git a/packages/twenty-e2e-testing/lib/requests/post-backend-graphql.ts b/packages/twenty-e2e-testing/lib/requests/post-backend-graphql.ts
index bf364b76cf6..7cd713dd63d 100644
--- a/packages/twenty-e2e-testing/lib/requests/post-backend-graphql.ts
+++ b/packages/twenty-e2e-testing/lib/requests/post-backend-graphql.ts
@@ -8,9 +8,11 @@ export type BackendGraphQLResponse<TData> = {
};
};
-type WindowWithTwentyEnv = Window & {
- _env_?: { REACT_APP_SERVER_BASE_URL?: string };
-};
+declare global {
+ interface Window {
+ _env_?: { REACT_APP_SERVER_BASE_URL?: string };
+ }
+}
// Sent from inside the page so it carries the same workspace origin and
// session cookie as the app's own requests. The cookie is scoped to the
@@ -24,8 +26,7 @@ export const postBackendGraphQL = <TData>({
}): Promise<BackendGraphQLResponse<TData>> =>
page.evaluate(async (requestBody): Promise<BackendGraphQLResponse<TData>> => {
const serverBaseUrl =
- (window as WindowWithTwentyEnv)._env_?.REACT_APP_SERVER_BASE_URL ||
- window.location.origin;
+ window._env_?.REACT_APP_SERVER_BASE_URL || window.location.origin;
const response = await fetch(`${serverBaseUrl}/graphql`, {
method: 'POST',
diff --git a/packages/twenty-e2e-testing/tests/workflow-creation.spec.ts b/packages/twenty-e2e-testing/tests/workflow-creation.spec.ts
index 7626c26d2a7..953b133ef96 100644
--- a/packages/twenty-e2e-testing/tests/workflow-creation.spec.ts
+++ b/packages/twenty-e2e-testing/tests/workflow-creation.spec.ts
@@ -35,6 +35,7 @@ test('Create workflow', async ({ page }) => {
]);
const body = await createWorkflowResponse.json();
+ expect(body.errors).toBeUndefined();
const newWorkflowId = body.data.createWorkflow.id;
try {