Kaynağa Gözat

test(server): Increase timeout on e2e setup function

Michael Bromley 7 yıl önce
ebeveyn
işleme
ce9508c49c

+ 2 - 1
server/e2e/administrator.e2e-spec.ts

@@ -13,6 +13,7 @@ import {
     UPDATE_ADMINISTRATOR,
 } from '../../admin-ui/src/app/data/definitions/administrator-definitions';
 
+import { TEST_SETUP_TIMEOUT_MS } from './config/test-config';
 import { TestClient } from './test-client';
 import { TestServer } from './test-server';
 
@@ -27,7 +28,7 @@ describe('Administrator resolver', () => {
             customerCount: 1,
         });
         await client.init();
-    }, 60000);
+    }, TEST_SETUP_TIMEOUT_MS);
 
     afterAll(async () => {
         await server.destroy();

+ 2 - 1
server/e2e/auth.e2e-spec.ts

@@ -21,6 +21,7 @@ import {
     UPDATE_PRODUCT,
 } from '../../admin-ui/src/app/data/definitions/product-definitions';
 
+import { TEST_SETUP_TIMEOUT_MS } from './config/test-config';
 import { TestClient } from './test-client';
 import { TestServer } from './test-server';
 
@@ -34,7 +35,7 @@ describe('Authorization & permissions', () => {
             customerCount: 1,
         });
         await client.init();
-    }, 60000);
+    }, TEST_SETUP_TIMEOUT_MS);
 
     afterAll(async () => {
         await server.destroy();

+ 6 - 1
server/e2e/config/test-config.ts

@@ -6,7 +6,12 @@ import { TestingAssetPreviewStrategy } from './testing-asset-preview-strategy';
 import { TestingAssetStorageStrategy } from './testing-asset-storage-strategy';
 import { TestingEntityIdStrategy } from './testing-entity-id-strategy';
 
-export const TEST_CONNECTION_NAME = undefined;
+/**
+ * We use a relatively long timeout on the initial beforeAll() function of the
+ * e2e tests because on the first run (and always in CI) the sqlite databases
+ * need to be generated, which can take a while.
+ */
+export const TEST_SETUP_TIMEOUT_MS = 120000;
 
 /**
  * Config settings used for e2e tests

+ 2 - 1
server/e2e/order.e2e-spec.ts

@@ -3,6 +3,7 @@ import gql from 'graphql-tag';
 import { Customer } from '../src/entity/customer/customer.entity';
 import { OrderLine } from '../src/entity/order-line/order-line.entity';
 
+import { TEST_SETUP_TIMEOUT_MS } from './config/test-config';
 import { TestClient } from './test-client';
 import { TestServer } from './test-server';
 
@@ -16,7 +17,7 @@ describe('Orders', () => {
             customerCount: 1,
         });
         await client.init();
-    }, 60000);
+    }, TEST_SETUP_TIMEOUT_MS);
 
     afterAll(async () => {
         await server.destroy();

+ 2 - 1
server/e2e/product.e2e-spec.ts

@@ -28,6 +28,7 @@ import {
     UPDATE_PRODUCT_VARIANTS,
 } from '../../admin-ui/src/app/data/definitions/product-definitions';
 
+import { TEST_SETUP_TIMEOUT_MS } from './config/test-config';
 import { TestClient } from './test-client';
 import { TestServer } from './test-server';
 
@@ -43,7 +44,7 @@ describe('Product resolver', () => {
             customerCount: 1,
         });
         await client.init();
-    }, 60000);
+    }, TEST_SETUP_TIMEOUT_MS);
 
     afterAll(async () => {
         await server.destroy();

+ 2 - 1
server/e2e/promotion.e2e-spec.ts

@@ -18,6 +18,7 @@ import {
 import { PromotionAction, PromotionOrderAction } from '../src/config/promotion/promotion-action';
 import { PromotionCondition } from '../src/config/promotion/promotion-condition';
 
+import { TEST_SETUP_TIMEOUT_MS } from './config/test-config';
 import { TestClient } from './test-client';
 import { TestServer } from './test-server';
 
@@ -49,7 +50,7 @@ describe('Promotion resolver', () => {
             },
         );
         await client.init();
-    }, 60000);
+    }, TEST_SETUP_TIMEOUT_MS);
 
     afterAll(async () => {
         await server.destroy();

+ 2 - 1
server/e2e/role.e2e-spec.ts

@@ -9,6 +9,7 @@ import {
     UPDATE_ROLE,
 } from '../../admin-ui/src/app/data/definitions/administrator-definitions';
 
+import { TEST_SETUP_TIMEOUT_MS } from './config/test-config';
 import { TestClient } from './test-client';
 import { TestServer } from './test-server';
 
@@ -24,7 +25,7 @@ describe('Role resolver', () => {
             customerCount: 1,
         });
         await client.init();
-    }, 60000);
+    }, TEST_SETUP_TIMEOUT_MS);
 
     afterAll(async () => {
         await server.destroy();

+ 1 - 2
server/mock-data/clear-all-tables.ts

@@ -1,6 +1,5 @@
-import { ConnectionOptions, createConnection, getSqljsManager } from 'typeorm';
+import { ConnectionOptions, createConnection } from 'typeorm';
 
-import { TEST_CONNECTION_NAME } from '../e2e/config/test-config';
 import { isTestEnvironment } from '../e2e/test-utils';
 
 // tslint:disable:no-console