@o3r/testing 10.3.0-prerelease.9 → 11.0.0-next.1
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/localization/localization-mock.d.ts +5 -4
- package/localization/localization-mock.d.ts.map +1 -1
- package/localization/localization-mock.js +5 -4
- package/localization/localization-mock.js.map +1 -1
- package/package.json +15 -15
- package/schematics/ng-add/fixture/index.d.ts +1 -2
- package/schematics/ng-add/fixture/index.d.ts.map +1 -1
- package/schematics/ng-add/fixture/index.js +9 -12
- package/schematics/ng-add/fixture/index.js.map +1 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +6 -4
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/playwright/index.d.ts.map +1 -1
- package/schematics/ng-add/playwright/index.js +1 -0
- package/schematics/ng-add/playwright/index.js.map +1 -1
- package/schematics/ng-add/playwright/templates/e2e-playwright/scenarios/__name@dasherize__.e2e-playwright-spec.ts +1 -1
- package/schematics/ng-add/templates/workspace/jest.config.ut.js.template +7 -5
- package/schematics/playwright/scenario/templates/__name@dasherize__.e2e-playwright-spec.ts +1 -1
- package/tools/protractor/fetch-manager/_fetch-manager.d.ts +1 -0
- package/tools/protractor/fetch-manager/_fetch-manager.d.ts.map +1 -0
- package/tools/protractor/fetch-manager/_fetch-manager.js +127 -0
- package/tools/protractor/fetch-manager/_fetch-manager.js.map +1 -0
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.d.ts +5 -0
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.d.ts.map +1 -0
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.js +157 -0
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.js.map +1 -0
|
@@ -18,10 +18,11 @@ export interface MockTranslations {
|
|
|
18
18
|
/**
|
|
19
19
|
* Function to get the list of modules required to test component using Localization module
|
|
20
20
|
* @param localizationConfiguration Localization configuration
|
|
21
|
-
* @param translations
|
|
22
|
-
* @param translationCompilerProvider
|
|
23
|
-
* @param mockPipe
|
|
24
|
-
* @
|
|
21
|
+
* @param translations Translations to use
|
|
22
|
+
* @param translationCompilerProvider Provider for translations compiler
|
|
23
|
+
* @param mockPipe Enable translation pipe mocking
|
|
24
|
+
* @param pipeWithPrefix Enable pipe with prefix
|
|
25
|
+
* @returns List of modules to import in the TestBed
|
|
25
26
|
*/
|
|
26
27
|
export declare function mockTranslationModules(localizationConfiguration?: Partial<LocalizationConfiguration>, translations?: MockTranslations, translationCompilerProvider?: Provider, mockPipe?: boolean, pipeWithPrefix?: boolean): ModuleWithProviders<LocalizationModule>[];
|
|
27
28
|
//# sourceMappingURL=localization-mock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization-mock.d.ts","sourceRoot":"","sources":["../../src/localization/localization-mock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAkB,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAA6B,MAAM,mBAAmB,CAAC;AAU7G,qBACa,iBAAkB,YAAW,aAAa;IAC9C,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS;CAGrD;AAED,qBACa,oBAAqB,YAAW,aAAa;IACjD,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS;CAGrD;AAED,qBAIa,2BAA2B;WACxB,OAAO,CAAC,cAAc,UAAQ,GAAG,mBAAmB,CAAC,2BAA2B,CAAC;CAMhG;AAED,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAC/B,CAAC,IAAI,EAAE,MAAM,GAAG;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED
|
|
1
|
+
{"version":3,"file":"localization-mock.d.ts","sourceRoot":"","sources":["../../src/localization/localization-mock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAkB,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAA6B,MAAM,mBAAmB,CAAC;AAU7G,qBACa,iBAAkB,YAAW,aAAa;IAC9C,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS;CAGrD;AAED,qBACa,oBAAqB,YAAW,aAAa;IACjD,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS;CAGrD;AAED,qBAIa,2BAA2B;WACxB,OAAO,CAAC,cAAc,UAAQ,GAAG,mBAAmB,CAAC,2BAA2B,CAAC;CAMhG;AAED,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAC/B,CAAC,IAAI,EAAE,MAAM,GAAG;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,yBAAyB,GAAE,OAAO,CAAC,yBAAyB,CAAoC,EAChG,YAAY,GAAE,gBAAqB,EACnC,2BAA2B,CAAC,EAAE,QAAQ,EACtC,QAAQ,UAAQ,EAChB,cAAc,UAAQ,GACrB,mBAAmB,CAAC,kBAAkB,CAAC,EAAE,CAc3C"}
|
|
@@ -68,10 +68,11 @@ exports.LocalizationDependencyMocks = LocalizationDependencyMocks;
|
|
|
68
68
|
/**
|
|
69
69
|
* Function to get the list of modules required to test component using Localization module
|
|
70
70
|
* @param localizationConfiguration Localization configuration
|
|
71
|
-
* @param translations
|
|
72
|
-
* @param translationCompilerProvider
|
|
73
|
-
* @param mockPipe
|
|
74
|
-
* @
|
|
71
|
+
* @param translations Translations to use
|
|
72
|
+
* @param translationCompilerProvider Provider for translations compiler
|
|
73
|
+
* @param mockPipe Enable translation pipe mocking
|
|
74
|
+
* @param pipeWithPrefix Enable pipe with prefix
|
|
75
|
+
* @returns List of modules to import in the TestBed
|
|
75
76
|
*/
|
|
76
77
|
function mockTranslationModules(localizationConfiguration, translations, translationCompilerProvider, mockPipe, pipeWithPrefix) {
|
|
77
78
|
if (localizationConfiguration === void 0) { localizationConfiguration = defaultLocalizationConfiguration; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization-mock.js","sourceRoot":"","sources":["../../src/localization/localization-mock.ts"],"names":[],"mappings":";;;;AAAA,sCAA6F;AAC7F,4CAAuE;AACvE,kDAA6G;AAC7G,6BAA0B;AAE1B,IAAM,gCAAgC,GAAuC;IAC3E,gBAAgB,EAAE,CAAC,IAAI,CAAC;IACxB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,EAAE;IACf,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAGF;IAAA;IAIA,CAAC;IAHQ,qCAAS,GAAhB;QAAiB,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAC7B,OAAO,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAf,CAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IAHU,iBAAiB;QAD7B,IAAA,WAAI,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;OACf,iBAAiB,CAI7B;IAAD,wBAAC;CAAA,AAJD,IAIC;AAJY,8CAAiB;AAO9B;IAAA;IAIA,CAAC;IAHQ,wCAAS,GAAhB;QAAiB,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAC7B,OAAO,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAf,CAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IAHU,oBAAoB;QADhC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sB;IAJtB,0CAAA,EAAA,4DAAgG;IAChG,6BAAA,EAAA,iBAAmC;IAEnC,yBAAA,EAAA,gBAAgB;IAChB,+BAAA,EAAA,sBAAsB;IAEtB;QACE,iCAAkB,CAAC,OAAO,CAAC,cAAM,OAAA,yBAAyB,EAAzB,CAAyB,CAAC;QAC3D,sBAAe,CAAC,OAAO,CAAC;YACtB,MAAM,EAAE;gBACN,OAAO,EAAE,sBAAe;gBACxB,QAAQ,EAAE;oBACR,cAAc,EAAE,UAAC,IAAY,IAAK,OAAA,IAAA,SAAE,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAtB,CAAsB;iBACzD;aACF;YACD,QAAQ,EAAE,2BAA2B;SACtC,CAAC;OACC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,2BAA2B,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QAC1E;AACJ,CAAC;AApBD,wDAoBC","sourcesContent":["import { ModuleWithProviders, NgModule, Pipe, PipeTransform, Provider } from '@angular/core';\nimport { TranslateLoader, TranslateModule } from '@ngx-translate/core';\nimport { LocalizationConfiguration, LocalizationModule, LocalizationTranslatePipe } from '@o3r/localization';\nimport { of } from 'rxjs';\n\nconst defaultLocalizationConfiguration: Partial<LocalizationConfiguration> = {\n supportedLocales: ['en'],\n language: 'en',\n endPointUrl: '',\n fallbackLanguage: 'en'\n};\n\n@Pipe({ name: 'translate' })\nexport class TranslatePipeMock implements PipeTransform {\n public transform(...args: any[]): string | undefined {\n return args && args.map((arg) => JSON.parse(arg)).join(', ');\n }\n}\n\n@Pipe({ name: 'o3rTranslate' })\nexport class O3rTranslatePipeMock implements PipeTransform {\n public transform(...args: any[]): string | undefined {\n return args && args.map((arg) => JSON.parse(arg)).join(', ');\n }\n}\n\n@NgModule({\n declarations: [TranslatePipeMock, O3rTranslatePipeMock],\n exports: [TranslatePipeMock, O3rTranslatePipeMock]\n})\nexport class LocalizationDependencyMocks {\n public static forTest(pipeWithPrefix = false): ModuleWithProviders<LocalizationDependencyMocks> {\n return {\n ngModule: LocalizationDependencyMocks,\n providers: [{ provide: LocalizationTranslatePipe, useClass: pipeWithPrefix ? O3rTranslatePipeMock : TranslatePipeMock }]\n };\n }\n}\n\n/** Mock to provide to the MockTranslation module */\nexport interface MockTranslations {\n [lang: string]: {\n [key: string]: any;\n };\n}\n\n/**\n * Function to get the list of modules required to test component using Localization module\n * @param localizationConfiguration Localization configuration\n * @param translations Translations to use\n * @param translationCompilerProvider Provider for translations compiler\n * @param mockPipe Enable translation pipe mocking\n * @param pipeWithPrefix Enable pipe with prefix\n * @returns List of modules to import in the TestBed\n */\nexport function mockTranslationModules(\n localizationConfiguration: Partial<LocalizationConfiguration> = defaultLocalizationConfiguration,\n translations: MockTranslations = {},\n translationCompilerProvider?: Provider,\n mockPipe = false,\n pipeWithPrefix = false\n): ModuleWithProviders<LocalizationModule>[] {\n return [\n LocalizationModule.forRoot(() => localizationConfiguration),\n TranslateModule.forRoot({\n loader: {\n provide: TranslateLoader,\n useValue: {\n getTranslation: (lang: string) => of(translations[lang])\n }\n },\n compiler: translationCompilerProvider\n }),\n ...(mockPipe ? [LocalizationDependencyMocks.forTest(pipeWithPrefix)] : [])\n ];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/testing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-next.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -101,11 +101,11 @@
|
|
|
101
101
|
"@angular/core": "~17.3.0",
|
|
102
102
|
"@angular/forms": "~17.3.0",
|
|
103
103
|
"@angular/platform-browser": "~17.3.0",
|
|
104
|
-
"@ngrx/store": "~17.
|
|
104
|
+
"@ngrx/store": "~17.2.0",
|
|
105
105
|
"@ngx-translate/core": "~15.0.0",
|
|
106
|
-
"@o3r/core": "^
|
|
107
|
-
"@o3r/localization": "^
|
|
108
|
-
"@o3r/schematics": "^
|
|
106
|
+
"@o3r/core": "^11.0.0-next.1",
|
|
107
|
+
"@o3r/localization": "^11.0.0-next.1",
|
|
108
|
+
"@o3r/schematics": "^11.0.0-next.1",
|
|
109
109
|
"@playwright/test": "~1.43.0",
|
|
110
110
|
"@schematics/angular": "~17.3.0",
|
|
111
111
|
"pixelmatch": "^5.2.1",
|
|
@@ -175,16 +175,16 @@
|
|
|
175
175
|
"@babel/core": "~7.24.0",
|
|
176
176
|
"@babel/preset-typescript": "~7.24.0",
|
|
177
177
|
"@compodoc/compodoc": "^1.1.19",
|
|
178
|
-
"@ngrx/store": "~17.
|
|
178
|
+
"@ngrx/store": "~17.2.0",
|
|
179
179
|
"@ngx-translate/core": "~15.0.0",
|
|
180
|
-
"@nx/eslint-plugin": "~18.
|
|
181
|
-
"@nx/jest": "~18.
|
|
182
|
-
"@o3r/build-helpers": "^
|
|
183
|
-
"@o3r/core": "^
|
|
184
|
-
"@o3r/eslint-plugin": "^
|
|
185
|
-
"@o3r/localization": "^
|
|
186
|
-
"@o3r/schematics": "^
|
|
187
|
-
"@o3r/test-helpers": "^
|
|
180
|
+
"@nx/eslint-plugin": "~18.3.0",
|
|
181
|
+
"@nx/jest": "~18.3.0",
|
|
182
|
+
"@o3r/build-helpers": "^11.0.0-next.1",
|
|
183
|
+
"@o3r/core": "^11.0.0-next.1",
|
|
184
|
+
"@o3r/eslint-plugin": "^11.0.0-next.1",
|
|
185
|
+
"@o3r/localization": "^11.0.0-next.1",
|
|
186
|
+
"@o3r/schematics": "^11.0.0-next.1",
|
|
187
|
+
"@o3r/test-helpers": "^11.0.0-next.1",
|
|
188
188
|
"@playwright/test": "~1.43.0",
|
|
189
189
|
"@schematics/angular": "~17.3.0",
|
|
190
190
|
"@stylistic/eslint-plugin-ts": "^1.5.4",
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
"jest-junit": "~16.0.0",
|
|
209
209
|
"jest-preset-angular": "~14.0.3",
|
|
210
210
|
"jsonc-eslint-parser": "~2.4.0",
|
|
211
|
-
"nx": "~18.
|
|
211
|
+
"nx": "~18.3.0",
|
|
212
212
|
"pid-from-port": "^1.1.3",
|
|
213
213
|
"pixelmatch": "^5.2.1",
|
|
214
214
|
"pngjs": "^7.0.0",
|
|
@@ -3,11 +3,10 @@ import { Rule } from '@angular-devkit/schematics';
|
|
|
3
3
|
* Add fixture configuration
|
|
4
4
|
* @param options @see RuleFactory.options
|
|
5
5
|
* @param options.projectName
|
|
6
|
-
* @param registerUnitTestFixturePaths should add path mapping for unit test fixtures
|
|
7
6
|
* @param options.testingFramework
|
|
8
7
|
*/
|
|
9
8
|
export declare function updateFixtureConfig(options: {
|
|
10
9
|
projectName?: string | null | undefined;
|
|
11
10
|
testingFramework?: string | null | undefined;
|
|
12
|
-
}
|
|
11
|
+
}): Rule;
|
|
13
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/fixture/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,IAAI,EAA0B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/fixture/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAKjF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GAAG,IAAI,CAyF5I"}
|
|
@@ -8,10 +8,9 @@ const ts = require("typescript");
|
|
|
8
8
|
* Add fixture configuration
|
|
9
9
|
* @param options @see RuleFactory.options
|
|
10
10
|
* @param options.projectName
|
|
11
|
-
* @param registerUnitTestFixturePaths should add path mapping for unit test fixtures
|
|
12
11
|
* @param options.testingFramework
|
|
13
12
|
*/
|
|
14
|
-
function updateFixtureConfig(options
|
|
13
|
+
function updateFixtureConfig(options) {
|
|
15
14
|
const oldPaths = ['@otter/testing/core', '@otter/testing/core/*'];
|
|
16
15
|
/**
|
|
17
16
|
* Update test tsconfig
|
|
@@ -25,10 +24,10 @@ function updateFixtureConfig(options, registerUnitTestFixturePaths) {
|
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
26
|
const testTarget = workspaceProject.architect && workspaceProject.architect.test;
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const tsconfigFile =
|
|
31
|
-
tsconfigFile.compilerOptions
|
|
27
|
+
const tsconfigPath = testTarget && testTarget.options && testTarget.options.tsConfig;
|
|
28
|
+
if (tsconfigPath && tree.exists(tsconfigPath)) {
|
|
29
|
+
const tsconfigFile = tree.readJson(tsconfigPath);
|
|
30
|
+
tsconfigFile.compilerOptions ||= {};
|
|
32
31
|
const tsconfigCompilerOptions = tsconfigFile.compilerOptions;
|
|
33
32
|
tsconfigCompilerOptions.lib = [...(tsconfigCompilerOptions.lib || []),
|
|
34
33
|
'dom',
|
|
@@ -46,10 +45,13 @@ function updateFixtureConfig(options, registerUnitTestFixturePaths) {
|
|
|
46
45
|
if (tsconfigCompilerOptions.types.indexOf('jest') === -1) {
|
|
47
46
|
tsconfigCompilerOptions.types.push('jest');
|
|
48
47
|
}
|
|
48
|
+
tsconfigCompilerOptions.types = tsconfigCompilerOptions.types.filter((tsType) => tsType !== 'jasmine');
|
|
49
49
|
}
|
|
50
50
|
tsconfigCompilerOptions.esModuleInterop = true;
|
|
51
51
|
tsconfigCompilerOptions.outDir = 'test';
|
|
52
|
-
|
|
52
|
+
tsconfigFile.include ||= [];
|
|
53
|
+
tsconfigFile.include.concat(['**/fixture/', '**/*.fixture.ts', '**/fixtures.ts']);
|
|
54
|
+
tree.overwrite(tsconfigPath, JSON.stringify(tsconfigFile, null, 2));
|
|
53
55
|
}
|
|
54
56
|
return;
|
|
55
57
|
};
|
|
@@ -78,11 +80,6 @@ function updateFixtureConfig(options, registerUnitTestFixturePaths) {
|
|
|
78
80
|
}
|
|
79
81
|
return acc;
|
|
80
82
|
}, {});
|
|
81
|
-
if (registerUnitTestFixturePaths) {
|
|
82
|
-
configWithPath.content.compilerOptions.baseUrl ||= '.';
|
|
83
|
-
configWithPath.content.compilerOptions.paths['@o3r/testing/core'] = ['node_modules/@o3r/testing/core/angular'];
|
|
84
|
-
configWithPath.content.compilerOptions.paths['@o3r/testing/core/*'] = ['node_modules/@o3r/testing/core/angular/*'];
|
|
85
|
-
}
|
|
86
83
|
tree.overwrite(configWithPath.tsconfig, JSON.stringify(configWithPath.content, null, 2));
|
|
87
84
|
return tree;
|
|
88
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../schematics/ng-add/fixture/index.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,2DAAiF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../schematics/ng-add/fixture/index.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,2DAAiF;AAGjF,iCAAiC;AAEjC;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,OAAkG;IAEpI,MAAM,QAAQ,GAAG,CAAC,qBAAqB,EAAE,uBAAuB,CAAC,CAAC;IAClE;;;;OAIG;IACH,MAAM,kBAAkB,GAAS,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/E,MAAM,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,GAAG,2CAAa,iBAAiB,EAAC,CAAC;QACjF,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEnH,IAAI,CA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I,CAAC;QACd,CAAC;QAED,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;QAExG,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAA0B,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACtK,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBACjC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACnB,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAEzF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,OAAO,IAAA,kBAAK,EAAC,CAAC,kBAAkB,EAAE,iCAAiC,CAAC,CAAC,CAAC;AACxE,CAAC;AAzFD,kDAyFC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2E,IAAI,EAAyC,MAAM,4BAA4B,CAAC;AAoBlK,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2E,IAAI,EAAyC,MAAM,4BAA4B,CAAC;AAoBlK,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAkJ5E;;;GAGG;AACH,eAAO,MAAM,KAAK,0CAAiD,CAAC"}
|
|
@@ -13,7 +13,10 @@ const devDependenciesToInstall = [
|
|
|
13
13
|
'pixelmatch',
|
|
14
14
|
'pngjs',
|
|
15
15
|
'jest',
|
|
16
|
-
'jest-
|
|
16
|
+
'jest-environment-jsdom',
|
|
17
|
+
'jest-preset-angular',
|
|
18
|
+
'ts-jest',
|
|
19
|
+
'@types/jest'
|
|
17
20
|
];
|
|
18
21
|
/**
|
|
19
22
|
* Add Otter testing to an Angular Project
|
|
@@ -72,7 +75,7 @@ function ngAddFn(options) {
|
|
|
72
75
|
options.enablePlaywright :
|
|
73
76
|
await (0, prompt_1.askConfirmation)('Do you want to setup Playwright test framework for E2E?', true);
|
|
74
77
|
const rules = [
|
|
75
|
-
(0, fixture_1.updateFixtureConfig)(options
|
|
78
|
+
(0, fixture_1.updateFixtureConfig)(options),
|
|
76
79
|
(0, schematics_2.removePackages)(['@otter/testing']),
|
|
77
80
|
(0, schematics_2.addVsCodeRecommendations)(['Orta.vscode-jest']),
|
|
78
81
|
installPlaywright ? (0, playwright_1.updatePlaywright)(options, dependencies) : schematics_1.noop,
|
|
@@ -115,8 +118,7 @@ function ngAddFn(options) {
|
|
|
115
118
|
]), schematics_1.MergeStrategy.Overwrite);
|
|
116
119
|
const jestConfigFilesForWorkspace = () => (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates/workspace'), [
|
|
117
120
|
(0, schematics_1.template)({
|
|
118
|
-
...options
|
|
119
|
-
rootRelativePath
|
|
121
|
+
...options
|
|
120
122
|
}),
|
|
121
123
|
(0, schematics_1.move)(tree.root.path),
|
|
122
124
|
(0, schematics_1.renameTemplateFiles)()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAAkK;AAClK,gDAayB;AACzB,8DAAoE;AACpE,2EAA8E;AAC9E,8BAA8B;AAC9B,kCAAkC;AAGlC,uCAAgD;AAChD,6CAAgD;AAEhD,MAAM,wBAAwB,GAAG;IAC/B,YAAY;IACZ,OAAO;IACP,MAAM;IACN,qBAAqB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAAkK;AAClK,gDAayB;AACzB,8DAAoE;AACpE,2EAA8E;AAC9E,8BAA8B;AAC9B,kCAAkC;AAGlC,uCAAgD;AAChD,6CAAgD;AAEhD,MAAM,wBAAwB,GAAG;IAC/B,YAAY;IACZ,OAAO;IACP,MAAM;IACN,wBAAwB;IACxB,qBAAqB;IACrB,SAAS;IACT,aAAa;CACd,CAAC;AAEF;;;GAGG;AACH,SAAS,OAAO,CAAC,OAA8B;IAC7C,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,IAAI,CAAC;YACH,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;YAChF,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAgB,CAAC;YAC3G,MAAM,QAAQ,GAAG,IAAA,2BAAc,EAAC,mBAAmB,CAAC,CAAC;YACrD,MAAM,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,+BAAkB,EAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACnH,MAAM,gBAAgB,GAAG,gBAAgB,EAAE,IAAI,IAAI,GAAG,CAAC;YACvD,MAAM,WAAW,GAAG,gB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O;yBACX,CAAC;wBACF,IAAA,iBAAI,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;wBACpB,IAAA,gCAAmB,GAAE;qBACtB,CAAC,EAAE,0BAAa,CAAC,OAAO,CAAC,CAAC;oBAC3B,KAAK,CAAC,IAAI,CACR,yBAAyB,EACzB,2BAA2B,CAC5B,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,wBAAW,CAAC,gDAAgD,OAAO,CAAC,WAAW,IAAI,EAAE,EAAE,CAAC,CAAC;gBACrG,CAAC;YACH,CAAC;YAGD,OAAO,GAAG,EAAE,CAAC,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;;+GAEoF,CAAC,CAAC;YAC3G,MAAM,IAAI,wBAAW,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACU,QAAA,KAAK,GAAG,IAAA,kDAAqC,EAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/playwright/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA8D,IAAI,EAAyC,MAAM,4BAA4B,CAAC;AACrJ,OAAO,EACL,KAAK,eAAe,EAEpB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAMzB;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/playwright/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA8D,IAAI,EAAyC,MAAM,4BAA4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AAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,iBAAiB;QACjB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC;YAC9F,MAAM,IAAI,GAAG,aAAa,CAAC;YAC3B,MAAM,YAAY,GAAG,cAAO,CAAC,UAAU,CAAC,cAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YAChE,MAAM,MAAM,GAAG,WAAW,CAAC;YAC3B,MAAM,UAAU,GAAG,cAAO,CAAC,UAAU,CAAC,cAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YAEhE,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,wBAAwB,CAAC,EAAE;gBAC1D,IAAA,qBAAQ,EAAC;oBACP,GAAG,cAAO;oBACV,IAAI;oBACJ,YAAY;oBACZ,MAAM;oBACN,UAAU;iBACX,CAAC;gBACF,IAAA,gCAAmB,GAAE;gBACrB,IAAA,iBAAI,EAAC,gBAAgB,CAAC;aACvB,CAAC,CAAC;YAEH,OAAO,IAAA,sBAAS,EAAC,cAAc,EAAE,0BAAa,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3E,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AArED,4CAqEC"}
|
|
@@ -6,7 +6,7 @@ export class <%= classify(scenarioName) %> extends BaseScenario {
|
|
|
6
6
|
test.describe.serial('Empty <%= classify(scenarioName) %> tests', () => {
|
|
7
7
|
test('Empty test', async ({ page }) => {
|
|
8
8
|
await page.goto(this.targetUrl);
|
|
9
|
-
await expect(page
|
|
9
|
+
await expect(page.locator('body')).toBeAttached();
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
12
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const { relative } = require('node:path');
|
|
1
|
+
const { join, relative } = require('node:path');
|
|
2
2
|
const { pathsToModuleNameMapper } = require('ts-jest');
|
|
3
|
-
// In the following statement, replace
|
|
3
|
+
// In the following statement, replace `./tsconfig.json` with the path to your `tsconfig` file
|
|
4
4
|
// which contains the path mapping (ie the `compilerOptions.paths` option):
|
|
5
|
-
const { compilerOptions } = require('
|
|
5
|
+
const { compilerOptions } = require('./tsconfig.json');
|
|
6
6
|
|
|
7
7
|
globalThis.ngJest = {
|
|
8
8
|
skipNgcc: true
|
|
@@ -14,11 +14,13 @@ globalThis.ngJest = {
|
|
|
14
14
|
* @returns {import('ts-jest/dist/types').JestConfigWithTsJest}
|
|
15
15
|
*/
|
|
16
16
|
module.exports.getJestProjectConfig = (rootDir, isAngularSetup) => {
|
|
17
|
-
const relativePath = relative(rootDir,
|
|
18
|
-
const moduleNameMapper = Object.entries(pathsToModuleNameMapper(compilerOptions.paths)).reduce((acc, [moduleName, path]) => {
|
|
17
|
+
const relativePath = relative(rootDir, __dirname);
|
|
18
|
+
const moduleNameMapper = Object.entries(pathsToModuleNameMapper(compilerOptions.paths || {})).reduce((acc, [moduleName, path]) => {
|
|
19
19
|
acc[moduleName] = `<rootDir>/${relativePath}/${path}`;
|
|
20
20
|
return acc;
|
|
21
21
|
}, {});
|
|
22
|
+
moduleNameMapper['^@o3r/testing/core$'] = [require.resolve('@o3r/testing/core/angular')];
|
|
23
|
+
moduleNameMapper['^@o3r/testing/core/(.*)'] = [join(require.resolve('@o3r/testing/core/angular'), '$1')];
|
|
22
24
|
return {
|
|
23
25
|
preset: 'ts-jest',
|
|
24
26
|
setupFilesAfterEnv: ['<rootDir>/testing/setup-jest.ts'],
|
|
@@ -6,7 +6,7 @@ export class <%= classify(scenarioName) %> extends BaseScenario {
|
|
|
6
6
|
test.describe.serial('Empty <%= classify(scenarioName) %> tests', () => {
|
|
7
7
|
test('Empty test', async ({ page }) => {
|
|
8
8
|
await page.goto(this.targetUrl);
|
|
9
|
-
await expect(page
|
|
9
|
+
await expect(page.locator('body')).toBeAttached();
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
12
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=_fetch-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_fetch-manager.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/fetch-manager/_fetch-manager.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Note: This file is not part of the running script, it is injected in the browser while running e2e tests.
|
|
4
|
+
*/
|
|
5
|
+
(function () {
|
|
6
|
+
var MAX_WAITING_TIME_FOR_FETCH = 45 * 1000; // 45 seconds
|
|
7
|
+
var fetchManager = /** @class */ (function () {
|
|
8
|
+
function FetchManager() {
|
|
9
|
+
this.nbCurrentFetch = 0;
|
|
10
|
+
}
|
|
11
|
+
FetchManager.prototype.interceptor = function (ref, nativeFetch) {
|
|
12
|
+
var args = [];
|
|
13
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
14
|
+
args[_i - 2] = arguments[_i];
|
|
15
|
+
}
|
|
16
|
+
var promise = Promise.resolve(args);
|
|
17
|
+
promise = promise.then(function () {
|
|
18
|
+
ref.nbCurrentFetch++;
|
|
19
|
+
return [args[0], args[1]];
|
|
20
|
+
}, function (error) {
|
|
21
|
+
return Promise.reject(error);
|
|
22
|
+
});
|
|
23
|
+
promise = promise.then(function () { return nativeFetch.apply(void 0, args); });
|
|
24
|
+
promise = promise.then(function (response) {
|
|
25
|
+
ref.nbCurrentFetch--;
|
|
26
|
+
return response;
|
|
27
|
+
}, function (error) {
|
|
28
|
+
ref.nbCurrentFetch--;
|
|
29
|
+
return Promise.reject(error);
|
|
30
|
+
});
|
|
31
|
+
return promise;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Register the fetchs events to count the number of pending fetchs.
|
|
35
|
+
*/
|
|
36
|
+
FetchManager.prototype.registerFetchInterceptor = function () {
|
|
37
|
+
var _this = this;
|
|
38
|
+
var nativeFetch = window.fetch;
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
40
|
+
var that = this;
|
|
41
|
+
Object.assign(window, { fetch: function () {
|
|
42
|
+
var args = [];
|
|
43
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
44
|
+
args[_i] = arguments[_i];
|
|
45
|
+
}
|
|
46
|
+
return _this.interceptor.apply(_this, __spreadArray([that, nativeFetch], args, false));
|
|
47
|
+
} });
|
|
48
|
+
};
|
|
49
|
+
FetchManager.prototype.unregisterFetchInterceptor = function () {
|
|
50
|
+
Object.assign(window, { fetch: this.windowFetch });
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Returns the single instance of FetchManager
|
|
54
|
+
*/
|
|
55
|
+
FetchManager.getInstance = function () {
|
|
56
|
+
return this._instance || (this._instance = new this());
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Initialize the fetch manager
|
|
60
|
+
*/
|
|
61
|
+
FetchManager.prototype.init = function () {
|
|
62
|
+
this.nbCurrentFetch = 0;
|
|
63
|
+
this.registerFetchInterceptor();
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
FetchManager.prototype.stop = function () {
|
|
69
|
+
this.nbCurrentFetch = 0;
|
|
70
|
+
this.unregisterFetchInterceptor();
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Get the number of active fetchs on the page.
|
|
74
|
+
*/
|
|
75
|
+
FetchManager.prototype.getPendingFetchs = function () {
|
|
76
|
+
return this.nbCurrentFetch;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* This function waits for all fetchs calls to be resolved and the page to be stable to call the callback.
|
|
80
|
+
* It permits to easily run synchronous tests with protractor.
|
|
81
|
+
* This is very usefull in the case of Otter calls to backend because protractor synchronization manager do not care
|
|
82
|
+
* about fetchs calls. As a consequence, the `waitForAngular` method will not work.
|
|
83
|
+
* @param callback : Callback called when all the fetchs are finished and the page is stable.
|
|
84
|
+
* @param timeoutInterval : Interval in milliseconds between two checks of the number of pending fetchs
|
|
85
|
+
*/
|
|
86
|
+
FetchManager.prototype.waitForFetchs = function (callback, timeoutInterval) {
|
|
87
|
+
var _this = this;
|
|
88
|
+
if (timeoutInterval === void 0) { timeoutInterval = 100; }
|
|
89
|
+
var interval;
|
|
90
|
+
var timeout;
|
|
91
|
+
if (!this.getPendingFetchs()) {
|
|
92
|
+
callback();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
var cancelPolling = function () {
|
|
96
|
+
if (interval) {
|
|
97
|
+
clearInterval(interval);
|
|
98
|
+
interval = undefined;
|
|
99
|
+
}
|
|
100
|
+
if (timeout) {
|
|
101
|
+
clearTimeout(timeout);
|
|
102
|
+
timeout = undefined;
|
|
103
|
+
}
|
|
104
|
+
// Handle polling result
|
|
105
|
+
if (_this.getPendingFetchs() > 0) {
|
|
106
|
+
// Error case will just log in console
|
|
107
|
+
// and allow to continue as o3r elements might be checking fetchManager
|
|
108
|
+
// concurrently
|
|
109
|
+
_this.nbCurrentFetch = 0;
|
|
110
|
+
callback();
|
|
111
|
+
throw new Error('Fetch timeout. Please check network requests.');
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
callback();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var polling = function () { return _this.getPendingFetchs() > 0 || cancelPolling(); };
|
|
118
|
+
interval = setInterval(polling, timeoutInterval);
|
|
119
|
+
timeout = setTimeout(cancelPolling, MAX_WAITING_TIME_FOR_FETCH);
|
|
120
|
+
};
|
|
121
|
+
return FetchManager;
|
|
122
|
+
}());
|
|
123
|
+
if (!('fetchManager' in window)) {
|
|
124
|
+
Object.assign(window, { fetchManager: fetchManager });
|
|
125
|
+
}
|
|
126
|
+
})();
|
|
127
|
+
//# sourceMappingURL=_fetch-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_fetch-manager.js","sourceRoot":"","sources":["../../../../src/tools/protractor/fetch-manager/_fetch-manager.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,CAAC;IAUC,IAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;IAE3D,IAAM,YAAY;QAMhB;YAHQ,mBAAc,GAAG,CAAC,CAAC;QAGJ,CAAC;QAEhB,kCAAW,GAAnB,UAAoB,GAAiB,EAAE,WAAgB;YAAE,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,6BAAc;;YACrE,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO,GAAG,OAAO,CAAC,IAAI,CACpB;gBACE,GAAG,CAAC,cAAc,EAAE,CAAC;gBACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC,EACD,UAAC,KAAK;gBACJ,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;YACL,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,cAAM,OAAA,WAAW,eAAI,IAAI,GAAnB,CAAoB,CAAC,CAAC;YACnD,OAAO,GAAG,OAAO,CAAC,IAAI,CACpB,UAAC,QAAQ;gBACP,GAAG,CAAC,cAAc,EAAE,CAAC;gBACrB,OAAO,QAAQ,CAAC;YAClB,CAAC,EACD,UAAC,KAAK;gBACJ,GAAG,CAAC,cAAc,EAAE,CAAC;gBACrB,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;YACL,OAAO,OAAO,CAAC;QACjB,CAAC;QAED;;WAEG;QACK,+CAAwB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C;YAED,IAAM,aAAa,GAAG;gBACpB,IAAI,QAAQ,EAAE,CAAC;oBACb,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACxB,QAAQ,GAAG,SAAS,CAAC;gBACvB,CAAC;gBAED,IAAI,OAAO,EAAE,CAAC;oBACZ,YAAY,CAAC,OAAO,CAAC,CAAC;oBACtB,OAAO,GAAG,SAAS,CAAC;gBACtB,CAAC;gBAED,wBAAwB;gBACxB,IAAI,KAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,EAAE,CAAC;oBAChC,sCAAsC;oBACtC,uEAAuE;oBACvE,eAAe;oBACf,KAAI,CAAC,cAAc,GAAG,CAAC,CAAC;oBACxB,QAAQ,EAAE,CAAC;oBAEX,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;gBACnE,CAAC;qBAAM,CAAC;oBACN,QAAQ,EAAE,CAAC;gBACb,CAAC;YACH,CAAC,CAAC;YAEF,IAAM,OAAO,GAAG,cAAM,OAAA,KAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,IAAI,aAAa,EAAE,EAA9C,CAA8C,CAAC;YAErE,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;YACjD,OAAO,GAAG,UAAU,CAAC,aAAa,EAAE,0BAA0B,CAAC,CAAC;QAClE,CAAC;QACH,mBAAC;IAAD,CAAC,AA1HoB,GA0HpB,CAAC;IAEF,IAAI,CAAC,CAAC,cAAc,IAAI,MAAM,CAAC,EAAE,CAAC;QAChC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,YAAY,cAAA,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_post-message-interceptor.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/_post-message-interceptor.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Note: This file is not part of the running script, it is injected in the browser while running e2e tests.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// TODO: Move to PollyJS when the winter comes
|
|
7
|
+
(function () {
|
|
8
|
+
/**
|
|
9
|
+
* PostMessageInterceptor permits to intercept calls to postMessage.
|
|
10
|
+
*/
|
|
11
|
+
var postMessageInterceptor = /** @class */ (function () {
|
|
12
|
+
function PostMessageInterceptor() {
|
|
13
|
+
this.lastCalls = [];
|
|
14
|
+
this.listening = false;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Logs a message in the console
|
|
18
|
+
* @param message
|
|
19
|
+
* @param {...any} args
|
|
20
|
+
*/
|
|
21
|
+
PostMessageInterceptor.prototype.log = function (message) {
|
|
22
|
+
var args = [];
|
|
23
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
24
|
+
args[_i - 1] = arguments[_i];
|
|
25
|
+
}
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.log.apply(console, __spreadArray(["#postMessageInterceptor: ".concat(message)], args, false));
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Intercepts the native postMessage call
|
|
31
|
+
* @param ref Singleton instance of the interceptor
|
|
32
|
+
* @param nativeMethod native postMessage method
|
|
33
|
+
* @param args all the args passed to the postMessage
|
|
34
|
+
*/
|
|
35
|
+
PostMessageInterceptor.prototype.interceptor = function (ref, nativeMethod) {
|
|
36
|
+
var args = [];
|
|
37
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
38
|
+
args[_i - 2] = arguments[_i];
|
|
39
|
+
}
|
|
40
|
+
this.log('Intercepted', args);
|
|
41
|
+
var postCall = {
|
|
42
|
+
data: args[0],
|
|
43
|
+
targetOrigin: args[1],
|
|
44
|
+
timestamp: new Date()
|
|
45
|
+
};
|
|
46
|
+
if (ref.listening) {
|
|
47
|
+
if (ref.conditionFn && !ref.conditionFn(postCall)) {
|
|
48
|
+
this.log('Intercepted message does not pass the condition');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
ref.lastCalls.push(postCall);
|
|
52
|
+
this.log('Last call count', ref.lastCalls.length);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.log('Not listening');
|
|
56
|
+
}
|
|
57
|
+
nativeMethod.apply(void 0, args);
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Register the interceptor in the window object
|
|
61
|
+
*/
|
|
62
|
+
PostMessageInterceptor.prototype.registerFetchInterceptor = function () {
|
|
63
|
+
var _this = this;
|
|
64
|
+
var nativeMethod = window.postMessage;
|
|
65
|
+
this.nativeMethod = nativeMethod;
|
|
66
|
+
Object.assign(window, { postMessage: function () {
|
|
67
|
+
var args = [];
|
|
68
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
69
|
+
args[_i] = arguments[_i];
|
|
70
|
+
}
|
|
71
|
+
return _this.interceptor.apply(_this, __spreadArray([_this, nativeMethod], args, false));
|
|
72
|
+
} });
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Unregister the interceptor from the window object
|
|
76
|
+
*/
|
|
77
|
+
PostMessageInterceptor.prototype.unregisterFetchInterceptor = function () {
|
|
78
|
+
Object.assign(window, { postMessage: this.nativeMethod });
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Returns the singleton instance of the interceptor
|
|
82
|
+
*/
|
|
83
|
+
PostMessageInterceptor.getInstance = function () {
|
|
84
|
+
return this._instance || (this._instance = new this());
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Initialize the interceptor
|
|
88
|
+
*/
|
|
89
|
+
PostMessageInterceptor.prototype.init = function () {
|
|
90
|
+
this.reset();
|
|
91
|
+
this.log('Init');
|
|
92
|
+
this.registerFetchInterceptor();
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Stops the interceptor
|
|
96
|
+
*/
|
|
97
|
+
PostMessageInterceptor.prototype.stop = function () {
|
|
98
|
+
this.reset();
|
|
99
|
+
this.log('Stop');
|
|
100
|
+
this.unregisterFetchInterceptor();
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Resets the stack of lastCalls
|
|
104
|
+
*/
|
|
105
|
+
PostMessageInterceptor.prototype.reset = function () {
|
|
106
|
+
this.lastCalls = [];
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Starts listening and saving postMessages
|
|
110
|
+
* @param conditionFnString The function string to be used as condition checker
|
|
111
|
+
*/
|
|
112
|
+
PostMessageInterceptor.prototype.listen = function (conditionFnString) {
|
|
113
|
+
this.listening = false;
|
|
114
|
+
this.reset();
|
|
115
|
+
if (conditionFnString) {
|
|
116
|
+
// eslint-disable-next-line no-eval
|
|
117
|
+
this.conditionFn = eval(conditionFnString);
|
|
118
|
+
}
|
|
119
|
+
this.listening = true;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Stops listening
|
|
123
|
+
* NOTE: It resets the interceptor and clears the conditionFn (if any)
|
|
124
|
+
*/
|
|
125
|
+
PostMessageInterceptor.prototype.stopListening = function () {
|
|
126
|
+
this.listening = false;
|
|
127
|
+
this.reset();
|
|
128
|
+
this.conditionFn = undefined;
|
|
129
|
+
this.listening = true;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Get the messages stack
|
|
133
|
+
* @param timeoutInterval the interval, in ms, between each check
|
|
134
|
+
* @param retries number of tentatives if fail
|
|
135
|
+
* @param callback
|
|
136
|
+
*/
|
|
137
|
+
PostMessageInterceptor.prototype.getMessages = function (timeoutInterval, retries, callback) {
|
|
138
|
+
var _this = this;
|
|
139
|
+
var activeMessageWatch = function (remainingRetries) {
|
|
140
|
+
if (remainingRetries === 0 || _this.lastCalls.length > 0) {
|
|
141
|
+
var copyCalls = _this.lastCalls.slice();
|
|
142
|
+
_this.reset();
|
|
143
|
+
callback(copyCalls);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
else if (remainingRetries > 0) {
|
|
147
|
+
remainingRetries--;
|
|
148
|
+
}
|
|
149
|
+
setTimeout(function () { return activeMessageWatch(remainingRetries); }, timeoutInterval);
|
|
150
|
+
};
|
|
151
|
+
activeMessageWatch(retries);
|
|
152
|
+
};
|
|
153
|
+
return PostMessageInterceptor;
|
|
154
|
+
}());
|
|
155
|
+
Object.assign(window, { postMessageInterceptor: postMessageInterceptor });
|
|
156
|
+
})();
|
|
157
|
+
//# sourceMappingURL=_post-message-interceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_post-message-interceptor.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/_post-message-interceptor.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAIH,8CAA8C;AAC9C,CAAC;IACC;;OAEG;IACH,IAAM,sBAAsB;QAQ1B;YACE,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;QAED;;;;WAIG;QACK,oCAAG,GAAX,UAAY,OAAe;YAAE,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,6BAAc;;YACzC,sCAAsC;YACtC,OAAO,CAAC,GAAG,OAAX,OAAO,iBAAK,mCAA4B,OAAO,CAAE,GAAK,IAAI,UAAE;QAC9D,CAAC;QAED;;;;;WAKG;QACK,4CAAW,GAAnB,UAAoB,GAA2B,EAAE,YAAiB;YAAE,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,6BAAc;;YAChF,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YAC9B,IAAM,QAAQ,GAAoB;gBAChC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;gBACb,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;gBACrB,SAAS,EAAE,IAAI,IAAI,EA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