@jahia/cypress 8.2.1 → 8.3.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/docs/jfaker.md DELETED
@@ -1,447 +0,0 @@
1
- # jFaker - Fake Data Generation Module
2
-
3
- ## Overview
4
-
5
- The `jfaker` module is a flexible fake data generation utility for Cypress testing that combines the power of [Faker.js](https://fakerjs.dev/) with security-focused injection payload generation. It provides a unified API to generate both realistic test data and security testing payloads (XSS, SQL injection, etc.) through a dynamic proxy-based interface.
6
-
7
- ## Key Features
8
-
9
- - **Faker.js Integration**: Full access to all `Faker.js` methods for generating realistic test data
10
- - **Security Injection Payloads**: Built-in support for common injection attack vectors (XSS, SQL, etc.)
11
- - **Global Type Management**: Set a global data type that automatically overrides faker calls with injection data
12
- - **Flexible Configuration**: Control generation behavior with options like length, provider, and overridability
13
- - **Dynamic API**: Chain method calls naturally (e.g., `jfaker.person.firstName()`)
14
- - **String Escaping**: Built-in utility to escape special characters for safe usage
15
-
16
- ## Installation
17
-
18
- The module is automatically available when using the jahia-cypress package:
19
-
20
- ```typescript
21
- import {jfaker} from '@jahia/cypress';
22
- ```
23
-
24
- ## API Reference
25
-
26
- ### Data Generation Methods
27
-
28
- #### Faker.js Methods
29
-
30
- All `Faker.js` methods are available through the dynamic proxy. See [Faker.js API documentation](https://fakerjs.dev/api/) for the complete list.
31
-
32
- **Basic Usage:**
33
- ```typescript
34
- jfaker.person.firstName() // Returns: "John"
35
- jfaker.person.lastName() // Returns: "Doe"
36
- jfaker.internet.email() // Returns: "john.doe@example.com"
37
- jfaker.location.city() // Returns: "New York"
38
- jfaker.company.name() // Returns: "Acme Corporation"
39
- jfaker.lorem.sentence() // Returns: "Lorem ipsum dolor sit amet."
40
- ```
41
-
42
- **With Options:**
43
- ```typescript
44
- jfaker.internet.email({provider: 'example.com'}) // Returns: "user@example.com"
45
- jfaker.string.alpha({length: 10}) // Returns: 10-character string
46
- jfaker.number.int({min: 1, max: 100}) // Returns: random number 1-100
47
- jfaker.lorem.word({length: {min: 5, max: 10}}) // Returns: word with 5-10 chars
48
- ```
49
-
50
- #### Injection Payload Methods
51
-
52
- Generate security testing payloads for various attack vectors:
53
-
54
- - **`.xss()`** - Cross-Site Scripting (XSS) payloads
55
- - **`.sql()`** - SQL injection payloads
56
- - **`.chars()`** - Random special characters
57
- - **`.htmlentities()`** - HTML entities
58
- - **`.numbers()`** - Number-based edge cases and payloads
59
-
60
- **Basic Usage:**
61
- ```typescript
62
- // Default behavior (no length specified): 2-5 random items joined
63
- jfaker.xss() // Returns: random XSS payload
64
- jfaker.sql() // Returns: random SQL injection payload
65
- ```
66
-
67
- **With Length Control:**
68
- ```typescript
69
- // Generate specific length (characters will be randomly selected and joined)
70
- jfaker.xss({length: 100}) // Returns: XSS payload exactly 100 chars long
71
- jfaker.sql({length: 50}) // Returns: SQL payload exactly 50 chars long
72
-
73
- // Use all available payloads for the type
74
- jfaker.xss({length: -1}) // Returns: all XSS payloads joined together
75
- jfaker.sql({length: -1}) // Returns: all SQL payloads joined together
76
- ```
77
-
78
- ### Utility Methods
79
-
80
- #### `setDataType(type: string): void`
81
-
82
- Sets the global data type for all subsequent jfaker calls. When set to an injection type, all faker method calls will return injection data instead.
83
-
84
- **Parameters:**
85
- - `type`: One of `'faker'`, `'xss'`, `'sql'`, `'chars'`, `'htmlentities'`, or `'numbers'`
86
-
87
- **Usage:**
88
- ```typescript
89
- // Set to generate XSS payloads by default
90
- jfaker.setDataType('xss');
91
-
92
- // Now all calls return XSS data (unless safe: true is used)
93
- jfaker.person.firstName(); // Returns: XSS payload, not a real name
94
- jfaker.internet.email(); // Returns: XSS payload, not a real email
95
-
96
- // Reset to normal faker behavior
97
- jfaker.setDataType('faker');
98
- jfaker.person.firstName(); // Returns: "John" (normal faker data)
99
- ```
100
-
101
- **CI/CD Integration:**
102
-
103
- The data type can also be set via the `JAHIA_CYPRESS_INJECTION_TYPE` environment variable from your CI/CD pipeline:
104
-
105
- ```bash
106
- # Run tests with XSS injection data
107
- JAHIA_CYPRESS_INJECTION_TYPE=xss
108
-
109
- # Run tests with SQL injection data
110
- JAHIA_CYPRESS_INJECTION_TYPE=sql
111
- ```
112
-
113
- #### `getDataType(): string`
114
-
115
- Retrieves the current global data type.
116
-
117
- **Returns:** The current data type (defaults to `'faker'` if not set)
118
-
119
- **Usage:**
120
- ```typescript
121
- jfaker.setDataType('xss');
122
- console.log(jfaker.getDataType()); // Outputs: "xss"
123
- ```
124
-
125
- #### `escape(str: string): string`
126
-
127
- Escapes special characters in a string to prevent issues when used in HTML or JavaScript contexts. E.g.: say, page properly handles xss injections and displays them escaped. In this case, it makes sense to validate these using `escape()` funtion.
128
-
129
- **Parameters:**
130
- - `str`: String to escape
131
-
132
- **Returns:** Escaped string
133
-
134
- **Usage:**
135
- ```typescript
136
- jfaker.escape('Hello "World"'); // Returns: 'Hello \"World\"'
137
- jfaker.escape('Line1\nLine2'); // Returns: 'Line1\\nLine2'
138
- jfaker.escape('Tab\there'); // Returns: 'Tab\\there'
139
- ```
140
-
141
- ## Advanced Usage
142
-
143
- ### Safe Option
144
-
145
- When a global injection type is overridden, you can force specific calls to keep using `Faker.js` data by setting `safe: true`.
146
-
147
- ```typescript
148
- // Set global type to XSS
149
- jfaker.setDataType('xss');
150
-
151
- // This returns XSS payload
152
- jfaker.person.firstName();
153
-
154
- // This forces Faker.js data generation (overrides global setting)
155
- // Call down below always returns human-readable first name, e.g.: "John"
156
- jfaker.person.firstName({safe: true});
157
-
158
- // Combining with other options
159
- // Call down below always returns human-readable email,
160
- // e.g. "user@example.com" (faker data with provider option)
161
- jfaker.internet.email({
162
- provider: 'example.com',
163
- safe: true
164
- });
165
- ```
166
-
167
- ### Options Summary
168
-
169
- | Option | Type | Injection Methods | Faker Methods | Description |
170
- |--------------------|------|-------------------|---------------|----------------------------------------------------------------------------------------------------|
171
- | `length` | `number` | ✅ | ✅* | For injections: exact character length (-1 = all payloads). For faker: passed to the faker method. |
172
- | `safe` | `boolean` | ❌ | ✅ | When `true`, forces to use `Faker.js` data even when global type is overridden (set to injection). |
173
- | *any faker option* | various | ❌ | ✅ | Any option supported by the specific Faker.js method (e.g., `provider`, `min`, `max`). |
174
-
175
- \* Many Faker.js methods accept a `length` option, such as `jfaker.string.alpha({length: 10})`.
176
-
177
- ## Usage Examples
178
-
179
- ### Example 1: Form Testing with Realistic Data
180
-
181
- ```typescript
182
- describe('User Registration Form', () => {
183
- it('should register a new user', () => {
184
- cy.visit('/register');
185
-
186
- cy.get('#firstName').type(jfaker.person.firstName());
187
- cy.get('#lastName').type(jfaker.person.lastName());
188
- cy.get('#email').type(jfaker.internet.email({provider: 'testdomain.com'}));
189
- cy.get('#phone').type(jfaker.phone.number());
190
- cy.get('#company').type(jfaker.company.name());
191
- cy.get('#city').type(jfaker.location.city());
192
-
193
- cy.get('#submit').click();
194
- cy.contains('Registration successful').should('be.visible');
195
- });
196
- });
197
- ```
198
-
199
- ### Example 2: Security Testing with Injection Payloads
200
-
201
- ```typescript
202
- describe('Input Validation - XSS Protection', () => {
203
- it('should sanitize XSS payloads in username field', () => {
204
- cy.visit('/profile');
205
-
206
- const xssPayload = jfaker.xss({length: 50});
207
-
208
- cy.get('#username').type(xssPayload, {
209
- parseSpecialCharSequences: false // Important!
210
- });
211
-
212
- cy.get('#save').click();
213
-
214
- // Verify the payload is escaped/sanitized
215
- cy.get('#username-display').invoke('text').then(text => {
216
- expect(text).not.to.include('<script>');
217
- });
218
- });
219
- });
220
- ```
221
-
222
- ### Example 3: Global Injection Testing
223
-
224
- ```typescript
225
- describe('Security Test Suite - SQL Injection', () => {
226
- before(() => {
227
- // Set global type to SQL injection for the entire suite
228
- jfaker.setDataType('sql');
229
- });
230
-
231
- after(() => {
232
- // Reset to faker after tests
233
- jfaker.setDataType('faker');
234
- });
235
-
236
- it('should protect search from SQL injection', () => {
237
- cy.visit('/search');
238
-
239
- // This returns SQL injection payload due to global setting
240
- const searchTerm = jfaker.lorem.word();
241
-
242
- cy.get('#search').type(searchTerm, {parseSpecialCharSequences: false});
243
- cy.get('#search-btn').click();
244
- cy.contains('No results found').should('be.visible');
245
- });
246
-
247
- it('should use faker data when explicitly needed', () => {
248
- cy.visit('/search');
249
-
250
- // Force to use Faker.js data for this specific call
251
- const normalSearch = jfaker.lorem.word({safe: true});
252
-
253
- cy.get('#search').type(normalSearch);
254
- cy.get('#search-btn').click();
255
- // Test with normal search term...
256
- });
257
- });
258
- ```
259
-
260
- ### Example 4: Comprehensive Input Fuzzing
261
-
262
- ```typescript
263
- describe('Input Field Robustness', () => {
264
- const injectionTypes = ['xss', 'sql', 'chars', 'htmlentities', 'numbers'];
265
-
266
- injectionTypes.forEach(type => {
267
- it(`should handle ${type} injection payloads`, () => {
268
- cy.visit('/form');
269
-
270
- const payload = jfaker[type]();
271
-
272
- cy.get('#input-field').type(payload, {
273
- parseSpecialCharSequences: false
274
- });
275
-
276
- cy.get('#submit').click();
277
-
278
- // Verify no errors or security issues
279
- cy.get('.error-message').should('not.exist');
280
- });
281
- });
282
- });
283
- ```
284
-
285
- ### Example 5: Dynamic Test Data Creation
286
-
287
- ```typescript
288
- describe('User Creation', () => {
289
- it('should create multiple users with unique data', () => {
290
- for (let i = 0; i < 5; i++) {
291
- const user = {
292
- firstName: jfaker.person.firstName(),
293
- lastName: jfaker.person.lastName(),
294
- email: jfaker.internet.email(),
295
- username: jfaker.internet.userName(),
296
- password: jfaker.internet.password({length: 12}),
297
- bio: jfaker.lorem.paragraph(),
298
- age: jfaker.number.int({min: 18, max: 80})
299
- };
300
-
301
- cy.request('POST', '/api/users', user).then(response => {
302
- expect(response.status).to.eq(201);
303
- });
304
- }
305
- });
306
- });
307
- ```
308
-
309
- ### Data Persistence
310
-
311
- The global data type is stored in Cypress environment variables (`JAHIA_CYPRESS_INJECTION_TYPE`), which means:
312
- - It persists across specs within a test run
313
- - It can be set from CI/CD pipelines as an environment variable
314
- - It's cleared when Cypress restarts
315
-
316
- ## Best Practices
317
-
318
- 1. **Reset Global Type**: Always reset the global data type after your test suite if you've changed it and other suites are expected to run afterwards:
319
- ```typescript
320
- after(() => {
321
- jfaker.setDataType('faker');
322
- });
323
- ```
324
-
325
- 2. **Use Descriptive Variables**: Store generated data in descriptive variables for better test readability:
326
- ```typescript
327
- const userEmail = jfaker.internet.email({provider: 'test.com'});
328
- const xssPayload = jfaker.xss({length: 100});
329
- ```
330
-
331
- 3. **Security Testing using existing tests codebase**: Use `jfaker` within your tests instead of hardcoded strings or direct `Faker.js` calls. In this case, the same codebase can be used for e2e as well as for injections testing by means of passing specific injections type from CI/CD or runtime (when injections type is not explicitly set, `Faker.js` is used by default). Use `safe: true` for values which should always return `Faker.js` entities.
332
-
333
- 4. **CI/CD Integration**: Use environment variables to run the same test suite with different data types:
334
- ```bash
335
- # Security tests with XSS
336
- JAHIA_CYPRESS_INJECTION_TYPE=xss npm run cypress:run
337
-
338
- # Security tests with SQL injection
339
- JAHIA_CYPRESS_INJECTION_TYPE=sql npm run cypress:run
340
- ```
341
-
342
- ## Technical Details
343
-
344
- ### Architecture
345
-
346
- The module uses a `DeepApi` class that implements a Proxy-based architecture:
347
- - **Property access** creates a deeper proxy, building a path (e.g., `person.firstName`)
348
- - **Function calls** execute the handler with the accumulated path and arguments
349
- - This enables the dynamic, chainable API without pre-defining all possible methods
350
-
351
- ### Injection Data Sources
352
-
353
- Injection payloads are imported from TypeScript files in the `src/injections/` directory:
354
- - `xss-data.ts` - XSS attack vectors
355
- - `sql-data.ts` - SQL injection patterns
356
- - `chars-data.ts` - Special characters
357
- - `htmlentities-data.ts` - HTML entity variations
358
- - `numbers-data.ts` - Numeric edge cases
359
-
360
- ### Length Handling for Injections
361
-
362
- - **Undefined length**: Picks 2-5 random items from the payload array and joins them
363
- - **Positive length**: Concatenates random items until reaching the specified character count, then trims to exact length
364
- - **Length = -1**: Returns all available payloads for that type joined together
365
-
366
- ## IMPORTANT: Cypress `.type()` Command
367
-
368
- ### Why this matters
369
-
370
- Cypress `type()` treats sequences such as `{enter}` and characters such as `{` or `}` as special commands.
371
- That is a problem for injection payloads, because many payloads contain those same characters and should be typed literally.
372
-
373
- ### What `jahia-cypress` does automatically
374
-
375
- To reduce the need to set `parseSpecialCharSequences` everywhere, `jahia-cypress` overwrites Cypress `type()` with this rule:
376
-
377
- - If `jfaker.getDataType() !== 'faker'` at the time of the `type()` call, `parseSpecialCharSequences` is automatically set to `false`.
378
- - If `jfaker.getDataType() === 'faker'`, Cypress keeps its default behavior.
379
-
380
- This covers most common cases.
381
-
382
- ### When you still need to set it explicitly
383
-
384
- You should still pass `parseSpecialCharSequences` yourself in these edge cases:
385
-
386
- 1. **You want Cypress command sequences to work even though the global `jfaker` type is an injection type.**
387
- Use `parseSpecialCharSequences: true`.
388
- 2. **You use a direct injection call such as `jfaker.xss()` while the global `jfaker` type is still `faker`.**
389
- Use `parseSpecialCharSequences: false`.
390
-
391
- In short, the automatic behavior depends on the **global `jfaker` type when `type()` runs**, not on how the value was generated.
392
-
393
- ### Example 1: Global injection mode, but one field still needs `{enter}` as a command
394
-
395
- ```typescript
396
- // Env variable: JAHIA_CYPRESS_INJECTION_TYPE=xss
397
-
398
- // Returns an XSS payload because the global type is xss
399
- const firstName = jfaker.person.firstName();
400
-
401
- // Returns a normal Faker.js email because safe: true overrides the global type for this value only
402
- const email = jfaker.internet.email({safe: true});
403
-
404
- // Because the global type is still xss at type() time,
405
- // special sequences are treated literally.
406
- cy.findById('firstName').type(`${firstName}{enter}`);
407
-
408
- // We want {enter} to act as a Cypress command for this field,
409
- // so we must override the automatic behavior explicitly.
410
- cy.findById('email').type(`${email}{enter}`, {parseSpecialCharSequences: true});
411
- ```
412
-
413
- ### Example 2: Global Faker mode, but one field must always receive an injection payload
414
-
415
- ```typescript
416
- // Env variable: JAHIA_CYPRESS_INJECTION_TYPE=faker
417
-
418
- // Returns normal Faker.js data
419
- const firstName = jfaker.person.firstName();
420
-
421
- // Returns an XSS payload directly, regardless of the global faker setting
422
- const email = jfaker.xss();
423
-
424
- // Default Cypress behavior is fine here
425
- cy.findById('firstName').type(firstName);
426
-
427
- // Because the global type is faker at type() time,
428
- // Cypress would still try to interpret special characters as commands.
429
- // Force literal typing for the payload.
430
- cy.findById('email').type(email, {parseSpecialCharSequences: false});
431
- ```
432
-
433
- ### Rule of thumb
434
-
435
- - Want Cypress sequences such as `{enter}` to act as commands? Set `parseSpecialCharSequences: true`.
436
- - Want an explicitly generated injection payload to be typed literally? Set `parseSpecialCharSequences: false`.
437
- - Otherwise, omit the option and use the default `jahia-cypress` behavior.
438
-
439
- ## See Also
440
-
441
- - [Faker.js API Documentation](https://fakerjs.dev/api/) - Complete reference for all faker methods
442
- - [OWASP Injection Attacks](https://owasp.org/www-community/Injection_Flaws) - Understanding injection vulnerabilities
443
- - [Cypress Type Command](https://docs.cypress.io/api/commands/type) - Details on the `type()` command options
444
-
445
- ## Support
446
-
447
- For issues, questions, or contributions related to the jfaker module, please refer to the main jahia-cypress repository.
@@ -1,210 +0,0 @@
1
- # JavaScript Errors Logger
2
-
3
- ## Overview
4
-
5
- The JavaScript Errors Logger is a comprehensive monitoring and reporting module for JavaScript errors and warnings in Cypress tests. It provides automated detection, collection, and reporting of console errors and warnings that occur during test execution, helping maintain code quality and identify issues early in the development process.
6
-
7
- ## Features
8
-
9
- - **Multiple Strategy Support**: Choose from three different error handling strategies
10
- - **Configurable Warning Filtering**: Define allowed warnings that won't trigger test failures
11
- - **Automatic Hook Integration**: Seamlessly integrates with Cypress test lifecycle
12
- - **Detailed Error Reporting**: Comprehensive error messages with test context
13
-
14
- ## Error Handling Strategies
15
-
16
- The logger supports three distinct strategies for handling JavaScript errors and warnings:
17
-
18
- ### 1. Fail After Each Test
19
- - **Strategy**: `STRATEGY.failAfterEach`
20
- - **Behavior**: Collects errors/warnings during test execution and fails at the end of the one; the rest of tests will be skipped
21
- - **Use Case**: Suitable when you want the test to complete but still get immediate feedback
22
- - **Pros**: Allows test to be executed till the end before providing a report
23
- - **Cons**: Since the analysis happens in afterEach() hook, the rest of spec will be ignored
24
-
25
- ### 2. Fail After All Tests (default)
26
- - **Strategy**: `STRATEGY.failAfterAll`
27
- - **Behavior**: Collects all errors/warnings and reports them after the entire test suite completes; the last test will be marked as failed
28
- - **Use Case**: Ideal for CI/CD environments where you want a complete test run overview
29
- - **Pros**: Complete test suite execution with comprehensive error reporting
30
- - **Cons**: Error reporting may be confusing as the last test will be marked as failed, since the errors analysis and reporting is done in after() hook
31
- - **Hint:** To make reporting less confusing, dummy test can be added by the end of the spec to provide more clarity on why the spec failed, e.g:
32
-
33
- ```typescript
34
- describe('Tests for the UI module', () => {
35
- it('Should validate flow A', () => { ... });
36
-
37
- it('Should validate flow B', () => { ... });
38
-
39
- it('Should validate flow C', () => { ... });
40
- ...
41
-
42
- // Dummy test to fail if any errors or warnings appear in the browser console,
43
- // providing clearer insight into execution and failure reasons.
44
- // Analysis itself will happen inside jsErrorsLogger module (if one is enabled).
45
- it('Should ensure errors and warnings absense in browser console', () => {
46
- cy.log('Analyze console messages');
47
- });
48
- });
49
- ```
50
- Say, there were JavaScript errors and warnings in all tests. Without that dummy test, the very last test in spec will be marked by Cypress as failed, even though it might pass:
51
- ```
52
- ✓ Should validate flow A
53
- ✓ Should validate flow B
54
- - Should validate flow C
55
- ... <errors/warnings list for each visited url, grouped by test> ...
56
- ```
57
- But with that dummy test it will be much clearer what exactly happened:
58
- ```
59
- ✓ Should validate flow A
60
- ✓ Should validate flow B
61
- ✓ Should validate flow C
62
- - Should ensure errors and warnings absence in browser console during spec execution
63
- ... <errors/warnings list for each visited url, grouped by test> ...
64
- ```
65
- And in case of JavaScript errors and warnings absense (and all tests passed) it will also be much clearer - what validations were performed:
66
- ```
67
- ✓ Should validate flow A
68
- ✓ Should validate flow B
69
- ✓ Should validate flow C
70
- ✓ Should ensure errors and warnings absense in browser console during spec execution
71
- ```
72
-
73
- ## Usage
74
-
75
- ### Basic Setup
76
-
77
- #### Enable the Logger for the repo
78
- This call should only be used in `tests/cypress/support/e2e.js`. Add the following code in the repo where functionality should be used:
79
-
80
- ```typescript
81
- import {jsErrorsLogger} from '@jahia/cypress';
82
-
83
- // Enable and attach JS Errors Logger
84
- jsErrorsLogger.enable();
85
- ```
86
-
87
- ### Disabling the Logger
88
-
89
- #### Via Environment Variable
90
-
91
- ```bash
92
- # Disable in CI/CD or specific environments
93
- export JAHIA_HOOKS_DISABLE_JS_LOGGER="true"
94
- ```
95
-
96
- #### Disable for the specific Spec
97
-
98
- ```typescript
99
- import {jsErrorsLogger} from '@jahia/cypress';
100
-
101
- describe('Tests with disabled JS logger', () => {
102
- before(() => {
103
- jsErrorsLogger.disable();
104
- });
105
-
106
- it('should run without JS error monitoring', () => {
107
- // Test implementation
108
- });
109
- });
110
- ```
111
-
112
- ## Configuration
113
-
114
- ### Environment Variables
115
-
116
- | Variable | Type | Description |
117
- |---------------------------------|------|-------------|
118
- | `JAHIA_HOOKS_DISABLE_JS_LOGGER` | boolean | Disables the logger when set to `true` |
119
-
120
- ### Programmatic Configuration
121
-
122
- It is **strongly** recommended to add custom configuration in project's common files, e.g. `tests/cypress/support/e2e.js` to have it applied to all test-cases within the project.
123
-
124
- ```typescript
125
- import {jsErrorsLogger} from '@jahia/cypress';
126
-
127
- // Enable and attach JS Errors Logger
128
- jsErrorsLogger.enable();
129
-
130
- // Set preferrable error handling strategy
131
- jsErrorsLogger.setStrategy(jsErrorsLogger.STRATEGY.failAfterAll);
132
-
133
- // Define allowed warnings that won't trigger failures
134
- jsErrorsLogger.setAllowedJsWarnings([
135
- 'Warning: React Hook',
136
- 'Warning: componentWillReceiveProps'
137
- ]);
138
- ```
139
-
140
- ## Error Reporting Format
141
-
142
- ### Single Test Error (failAfterEach)
143
-
144
- ```
145
- CONSOLE ERRORS and WARNINGS FOUND:
146
-
147
- ❌️ TEST: Should be authenticated when correct credentials and code are provided: ❌️
148
- --------------------------------------------------
149
- URL: http://localhost:8080/jahia/dashboard
150
- ISSUES:
151
- - ⚠️ Unsatisfied version 5.0.1 from @jahia/jcontent of shared singleton module redux (required ^4.0.5)
152
- - ⚠️ Unsatisfied version 9.2.0 from @jahia/jcontent of shared singleton module react-redux (required ^8.0.5)
153
- - ❌️ TypeError: Cannot read property 'user' of undefined
154
- ```
155
-
156
- ### Multiple Test Errors (failAfterAll)
157
-
158
- ```
159
- CONSOLE ERRORS and WARNINGS FOUND:
160
-
161
- ❌️ TEST: Should be authenticated when correct credentials and code are provided: ❌️
162
- --------------------------------------------------
163
- URL: http://localhost:8080/jahia/dashboard
164
- ISSUES:
165
- - ⚠️ No satisfying version (^1.11.9) of shared module dayjs found in shared scope default.
166
- - ⚠️ No satisfying version (^3.0.6) of shared module @jahia/react-material found in shared scope default.
167
- - ❌️ TypeError: Cannot read property 'user' of undefined
168
- ==================================================
169
-
170
- ❌️ TEST: Should be authenticated on a specific site when correct credentials and code are provided: ❌️
171
- --------------------------------------------------
172
- URL: http://localhost:8080/jahia/admin
173
- ISSUES:
174
- - ⚠️ No satisfying version (^3.0.6) of shared module @jahia/react-material found in shared scope default.
175
- ==================================================
176
- ```
177
-
178
- ## Best Practices
179
-
180
- ### Development Environment
181
- - Use `STRATEGY.failAfterEach` for immediate feedback during development
182
- - Configure comprehensive allowed warnings list for known, acceptable warnings
183
- - Enable detailed logging for debugging purposes
184
-
185
- ### CI/CD Environment
186
- - Use `STRATEGY.failAfterAll` to get complete test coverage
187
- - Keep allowed warnings list minimal to catch regressions
188
- - Consider disabling in performance testing environments
189
-
190
- ### Team Collaboration
191
- - Maintain a shared allowed warnings configuration
192
- - Document any permanently allowed warnings with justification
193
- - Regular review and cleanup of allowed warnings list
194
-
195
- ## API Reference
196
-
197
- ### Methods
198
-
199
- | Method | Parameters | Return Type | Description |
200
- |--------|------------|-------------|--------------------------------------------------------|
201
- | `setStrategy(strategy)` | STRATEGY enum | void | Sets the error handling strategy |
202
- | `setAllowedJsWarnings(warnings)` | string[] | void | Configures allowed warning messages |
203
- | `disable()` | - | void | Disables the logger for the current spec |
204
- | `enable()` | - | void | Enables the logger for the current repo |
205
-
206
- ### Enums
207
-
208
- | Enum | Values | Description |
209
- |------|--------|-------------|
210
- | `STRATEGY` | `failAfterAll`, `failAfterEach` | Error handling strategies |