@genesislcap/foundation-testing 14.30.3 → 14.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -56,71 +56,58 @@ If your test spans more than one file or is more of an end-to-end test, you may
56
56
  │ └── baseline.e2e.ts
57
57
  │ └── unit
58
58
  │ └── baseline.test.ts
59
- ├── jsdom.setup.ts
60
59
  ├── package.json
61
60
  └── playwright.config.ts
62
61
  ```
63
62
 
64
- The contents of your package's `jsdom.setup.ts` may simply be:
63
+ The contents of your package's `playwright.config.ts` may include:
65
64
 
66
- ```typescript
67
- export * from '@genesislcap/foundation-testing/jsdom';
65
+ ```ts
66
+ export { configDefaults as default } from '@genesislcap/foundation-testing/e2e';
68
67
  ```
69
68
 
70
- The contents of your package's `playwright.config.ts` may include:
69
+ If you need to customise configuration, you can do it as follows:
71
70
 
72
- ```typescript
73
- import { PlaywrightTestConfig } from '@playwright/test';
74
- const config: PlaywrightTestConfig = {
75
- testMatch: '**/*.e2e.ts',
76
- globalSetup: '@genesislcap/foundation-testing/playwright', // returns teardown
77
- projects: [
78
- {
79
- name: 'Chrome Stable',
80
- use: {
81
- browserName: 'chromium',
82
- channel: 'chrome',
83
- },
84
- },
85
- ],
71
+ ```ts
72
+ import { configDefaults } from '@genesislcap/foundation-testing/e2e';
73
+
74
+ export default {
75
+ ...configDefaults,
76
+ // Any custom configuration here e.g. disabling the web server:
77
+ webServer: undefined,
86
78
  };
87
- export default config;
88
79
  ```
89
80
 
90
- ## Test Scripts
81
+ If you need to customise JSDOM, you can create `jsdom.setup.ts` file in your package directory:
91
82
 
92
- The test related scripts to add to your package's `package.json` file may include:
93
-
94
- ```
95
- "test": "npm run test:unit && npm run test:e2e",
96
- "test:coverage": "c8 --include=src npm run test:unit",
97
- "test:coverage:report": "npm run test:coverage && c8 report --reporter=text-lcov > coverage.lcov",
98
- "test:coverage:report:nyc": "npm run test:unit:browser -- --cov && npx nyc report --reporter=html",
99
- "test:e2e": "npx playwright test --config=./playwright.config.ts",
100
- "test:e2e:debug": "npm run test:e2e -- --debug",
101
- "test:unit": "npm run test:unit:node",
102
- "test:unit:browser": "playwright-test \"./**/*.test.ts\" --runner uvu",
103
- "test:unit:browser:watch": "npm run test:unit:browser -- -w -d",
104
- "test:unit:node": "npm run test:unit:node:src && npm run test:unit:node:test",
105
- "test:unit:node:src": "uvu -r tsm -r esm -r ./jsdom.setup.ts ./src \".*.test.ts\"",
106
- "test:unit:node:test": "uvu -r tsm -r esm -r ./jsdom.setup.ts ./test/unit \".*.test.ts\"",
107
- "test:unit:watch": "watchlist src test -- npm run test:unit"
83
+ ```ts
84
+ // custom code
85
+ export * from '@genesislcap/foundation-testing/jsdom';
108
86
  ```
109
87
 
110
- To provide the dev dependencies for these test scripts you would need to install:
88
+ ## Test Scripts
89
+
90
+ The test related scripts to add to your package's `package.json` file may include:
111
91
 
112
92
  ```
113
- @playwright/test playwright-test c8 esm jsdom tsm uvu watchlist
93
+ "test": "genx test",
94
+ "test:coverage": "genx test --coverage",
95
+ "test:coverage:browser": "genx test --coverage --browser",
96
+ "test:e2e": "genx test --e2e",
97
+ "test:e2e:debug": "genx test --e2e --debug",
98
+ "test:e2e:ui": "genx test --e2e --interactive",
99
+ "test:unit:browser": "genx test --browser",
100
+ "test:unit:browser:watch": "genx test --browser --watch",
101
+ "test:unit:watch": "genx test --watch",
102
+ "test:debug": "genx test --debug"
114
103
  ```
115
104
 
116
- _We are working on enhancing the `genx` cli to abstract test running, so you can offload this setup and tasks._
117
-
118
105
  ## Testing Logic
119
106
 
120
107
  The `logic.test.ts` will likely leverage `createLogicSuite`, which is used to test function output given certain input
121
108
  arguments. Based on user feedback, these arguments are now passed as an array by convention:
122
109
 
123
- ```typescript
110
+ ```ts
124
111
  // logic.test.ts
125
112
  import { createLogicSuite } from '@genesislcap/foundation-testing';
126
113
  import { myFunction } from './logic';
@@ -149,7 +136,7 @@ The `component.test.ts` or any test which directly or in-directly makes use of t
149
136
  `createComponentSuite`. Apart from setting up and tearing down your element fixture with a wrapping design system and DI
150
137
  container, this util also allows you to provide DI container mocks, which will be required for certain testing flows.
151
138
 
152
- ```typescript
139
+ ```ts
153
140
  // component.test.ts
154
141
  import { Connect } from '@genesislcap/foundation-comms';
155
142
  import { ConnectMock } from '@genesislcap/foundation-comms/testing';
@@ -237,9 +224,8 @@ Suite.run();
237
224
 
238
225
  The `baseline.e2e.ts` will leverage `playwright`, and test cases will have access to the fixtures provided during setup.
239
226
 
240
- ```typescript
241
- import { expect } from '@playwright/test';
242
- import { test } from '@genesislcap/foundation-testing/e2e';
227
+ ```ts
228
+ import { test, expect } from '@genesislcap/foundation-testing/e2e';
243
229
 
244
230
  test('baseline test', async ({ page }) => {
245
231
  await page.goto('https://playwright.dev/');
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/playwright/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,oBA0B5B,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/playwright/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,oBAmC5B,CAAC"}
@@ -1,12 +1,25 @@
1
- import { FullConfig } from '@playwright/test';
1
+ import type { FullConfig } from '@playwright/test';
2
2
  /**
3
3
  * @param config - A playwright configuration object.
4
4
  * @returns A teardown function.
5
5
  *
6
6
  * @public
7
- * @remarks
8
- * This is just an example playwright setup that returns a noddy teardown. In reality, you will likely create a custom
9
- * setup / page for your e2e tests depending on the needs of your app or micro frontend.
7
+ * @example
8
+ * An example demonstrating use of environment variables and temporary folder:
9
+ * ```
10
+ * import rimraf from 'rimraf';
11
+ *
12
+ * async function setup(config: FullConfig) {
13
+ * process.env.FOO = 'some data';
14
+ * process.env.BAR = JSON.stringify({ some: 'data' });
15
+ * return async function teardown() {
16
+ * delete process.env.FOO;
17
+ * delete process.env.BAR;
18
+ * const tmpDirPath = path.join(os.tmpdir(), 'tmp-folder');
19
+ * rimraf(tmpDirPath, console.log);
20
+ * };
21
+ * }
22
+ * ```
10
23
  */
11
24
  declare function setup(config: FullConfig): Promise<() => Promise<void>>;
12
25
  export default setup;
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/playwright/setup.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C;;;;;;;;GAQG;AACH,iBAAe,KAAK,CAAC,MAAM,EAAE,UAAU,gCAStC;AAED,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/playwright/setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iBAAe,KAAK,CAAC,MAAM,EAAE,UAAU,gCAEtC;AAED,eAAe,KAAK,CAAC"}
@@ -1,4 +1,9 @@
1
- import { Browser } from '@playwright/test';
1
+ import type { Browser } from '@playwright/test';
2
+ export { expect } from '@playwright/test';
3
+ export { test as base } from '@playwright/test';
4
+ export type { Page, Locator } from '@playwright/test';
5
+ export { playAudit } from 'playwright-lighthouse';
6
+ export type { PlaywrightTestConfig } from '@playwright/test';
2
7
  /**
3
8
  * @public
4
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/playwright/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA0B,MAAM,kBAAkB,CAAC;AAGnE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC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AM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AASF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAMpC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,EAAE,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,6PAmBf,CAAC"}
@@ -2,6 +2,7 @@ import type { FoundationElement, FoundationElementDefinition, FoundationElementR
2
2
  import { Container, DesignSystem } from '@microsoft/fast-foundation';
3
3
  import { Fixture } from '../component';
4
4
  import { assert, uvu } from '../uvu';
5
+ export { default as sinon } from 'sinon';
5
6
  /**
6
7
  * @public
7
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../../src/suite/suite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,EACzB,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAM,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,EAA0C,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAS,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CACrB,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CAAC,EAAO,GACtC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAyDtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,GAAG,YAAY,EACtD,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,QAAQ,GACjB,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CASpB"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Shared tsm config for apps to import and use in their tsm.js files.
3
+ *
4
+ * @example
5
+ * ```js
6
+ * const config = require('@genesislcap/foundation-testing/tsm');
7
+ *
8
+ * module.exports = config;
9
+ * ```
10
+ *
11
+ * @public
12
+ */
13
+ declare const config: {
14
+ '.css': {
15
+ loader: string;
16
+ };
17
+ '.svg': {
18
+ loader: string;
19
+ };
20
+ '.jpg': {
21
+ loader: string;
22
+ };
23
+ '.png': {
24
+ loader: string;
25
+ };
26
+ };
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tsm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,MAAM;;;;;;;;;;;;;CAaX,CAAC"}
@@ -19,8 +19,8 @@ export const configDefaults = {
19
19
  */
20
20
  // config: {
21
21
  // API_HOST: 'wss://dev-foundation1/gwf/',
22
- // DEFAULT_USER: 'Derek',
23
- // DEFAULT_PASSWORD: 'Paul',
22
+ // DEFAULT_USER: process.env.DEFAULT_USER,
23
+ // DEFAULT_PASSWORD: process.env.DEFAULT_PASSWORD,
24
24
  // PORT: 5030,
25
25
  // },
26
26
  },
@@ -28,4 +28,13 @@ export const configDefaults = {
28
28
  ],
29
29
  testMatch: '**/*.e2e.ts',
30
30
  timeout: 60000,
31
+ webServer: {
32
+ command: 'npm run dev:no-open',
33
+ url: `http://localhost:${process.env.PORT}`,
34
+ timeout: 120000,
35
+ reuseExistingServer: !process.env.CI,
36
+ },
37
+ use: {
38
+ baseURL: `http://localhost:${process.env.PORT}`,
39
+ },
31
40
  };
@@ -1,27 +1,30 @@
1
1
  import { __awaiter } from "tslib";
2
- import os from 'os';
3
- import path from 'path';
4
- import rimraf from 'rimraf';
5
2
  /**
6
3
  * @param config - A playwright configuration object.
7
4
  * @returns A teardown function.
8
5
  *
9
6
  * @public
10
- * @remarks
11
- * This is just an example playwright setup that returns a noddy teardown. In reality, you will likely create a custom
12
- * setup / page for your e2e tests depending on the needs of your app or micro frontend.
7
+ * @example
8
+ * An example demonstrating use of environment variables and temporary folder:
9
+ * ```
10
+ * import rimraf from 'rimraf';
11
+ *
12
+ * async function setup(config: FullConfig) {
13
+ * process.env.FOO = 'some data';
14
+ * process.env.BAR = JSON.stringify({ some: 'data' });
15
+ * return async function teardown() {
16
+ * delete process.env.FOO;
17
+ * delete process.env.BAR;
18
+ * const tmpDirPath = path.join(os.tmpdir(), 'tmp-folder');
19
+ * rimraf(tmpDirPath, console.log);
20
+ * };
21
+ * }
22
+ * ```
13
23
  */
14
24
  function setup(config) {
15
25
  return __awaiter(this, void 0, void 0, function* () {
16
- process.env.FOO = 'some data';
17
- process.env.BAR = JSON.stringify({ some: 'data' });
18
26
  return function teardown() {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- delete process.env.FOO;
21
- delete process.env.BAR;
22
- const tmpDirPath = path.join(os.tmpdir(), 'pw');
23
- rimraf(tmpDirPath, console.log);
24
- });
27
+ return __awaiter(this, void 0, void 0, function* () { });
25
28
  };
26
29
  });
27
30
  }
@@ -1,6 +1,9 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { chromium, test as base } from '@playwright/test';
3
3
  import { getPort } from 'portfinder-sync';
4
+ export { expect } from '@playwright/test';
5
+ export { test as base } from '@playwright/test';
6
+ export { playAudit } from 'playwright-lighthouse';
4
7
  const defaultPackageConfig = {
5
8
  API_HOST: 'wss://public-foundation.genesislab.global/gwf/',
6
9
  DEFAULT_USER: 'JohnDoe',
@@ -3,6 +3,7 @@ import { DesignSystem, DI } from '@microsoft/fast-foundation';
3
3
  import { fixture as FASTFixture } from '../component';
4
4
  import { logger } from '../utils';
5
5
  import { assert, suite } from '../uvu';
6
+ export { default as sinon } from 'sinon';
6
7
  /**
7
8
  * Assert a set of test cases.
8
9
  * @param fn - The function to test.
@@ -11,18 +11,17 @@
11
11
  * @public
12
12
  */
13
13
  const config = {
14
- '.css': {
15
- loader: 'text',
16
- },
17
- '.svg': {
18
- loader: 'dataurl',
19
- },
20
- '.jpg': {
21
- loader: 'dataurl',
22
- },
23
- '.png': {
24
- loader: 'dataurl',
25
- },
14
+ '.css': {
15
+ loader: 'text',
16
+ },
17
+ '.svg': {
18
+ loader: 'dataurl',
19
+ },
20
+ '.jpg': {
21
+ loader: 'dataurl',
22
+ },
23
+ '.png': {
24
+ loader: 'dataurl',
25
+ },
26
26
  };
27
-
28
27
  module.exports = config;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-testing",
3
3
  "description": "Genesis Foundation Testing",
4
- "version": "14.30.3",
4
+ "version": "14.31.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -27,48 +27,34 @@
27
27
  "default": "./dist/esm/playwright/setup.js"
28
28
  },
29
29
  "./package.json": "./package.json",
30
- "./tsm": "./tsm.js"
30
+ "./tsm": "./dist/esm/tsm/index.js"
31
31
  },
32
32
  "config": {
33
33
  "PORT": 3050
34
34
  },
35
35
  "scripts": {
36
- "build": "genx build",
37
- "build:rollup": "genx build -b rollup",
38
- "build:rollup:stats": "genx analyze -b rollup",
39
- "build:webpack": "genx build -b webpack",
40
- "build:webpack:stats": "genx analyze -b webpack",
41
- "clean": "genx clean",
42
- "dev": "npm run dev:tsc",
43
- "dev:rollup": "genx dev -b rollup",
44
- "dev:tsc": "genx dev",
45
- "dev:webpack": "genx dev -b webpack",
46
- "serve": "genx serve"
36
+ "build": "npm run clean && tsc -b ./tsconfig.json",
37
+ "clean": "rimraf dist tsconfig.tsbuildinfo",
38
+ "dev": "tsc -b ./tsconfig.json -w"
47
39
  },
48
40
  "devDependencies": {
49
- "@genesislcap/genx": "^14.30.3",
50
- "@playwright/test": "^1.18.1",
51
41
  "@types/sinon": "^10.0.13",
52
- "analytics": "^0.8.0",
53
- "c8": "^7.11.0",
54
- "esm": "^3.2.25",
55
- "jsdom": "^19.0.0",
56
- "lighthouse": "^9.6.8",
57
- "playwright-lighthouse": "^2.2.2",
58
- "playwright-test": "^8.4.0",
59
- "tsm": "^2.2.1",
60
- "typescript": "^4.5.5",
61
- "uvu": "0.5.4",
62
- "watchlist": "^0.3.1"
42
+ "rimraf": "^3.0.2",
43
+ "typescript": "^4.5.5"
63
44
  },
64
45
  "dependencies": {
65
- "@genesislcap/foundation-utils": "^14.30.3",
46
+ "@genesislcap/foundation-utils": "^14.31.0",
66
47
  "@microsoft/fast-element": "^1.7.0",
67
48
  "@microsoft/fast-foundation": "^2.33.2",
49
+ "@playwright/test": "^1.18.1",
50
+ "jsdom": "^19.0.0",
51
+ "lighthouse": "^9.6.8",
52
+ "playwright-lighthouse": "^2.2.2",
68
53
  "portfinder-sync": "^0.0.2",
69
- "rimraf": "^3.0.2",
70
54
  "sinon": "15.0.1",
71
- "tslib": "^2.3.1"
55
+ "tslib": "^2.3.1",
56
+ "tsm": "^2.2.1",
57
+ "uvu": "0.5.4"
72
58
  },
73
59
  "repository": {
74
60
  "type": "git",
@@ -78,5 +64,5 @@
78
64
  "publishConfig": {
79
65
  "access": "public"
80
66
  },
81
- "gitHead": "5f2858b6708b64c5ed6378fc54e09629539a563a"
67
+ "gitHead": "2eac7177426f939beb5bcd3b78baf98f25f0e630"
82
68
  }