@jahia/cypress 8.2.0 → 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,450 +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, Bash, 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
- - **`.bash()`** - Bash/shell command injection payloads
57
- - **`.chars()`** - Random special characters
58
- - **`.htmlentities()`** - HTML entities
59
- - **`.numbers()`** - Number-based edge cases and payloads
60
-
61
- **Basic Usage:**
62
- ```typescript
63
- // Default behavior (no length specified): 2-5 random items joined
64
- jfaker.xss() // Returns: random XSS payload
65
- jfaker.sql() // Returns: random SQL injection payload
66
- jfaker.bash() // Returns: random Bash injection payload
67
- ```
68
-
69
- **With Length Control:**
70
- ```typescript
71
- // Generate specific length (characters will be randomly selected and joined)
72
- jfaker.xss({length: 100}) // Returns: XSS payload exactly 100 chars long
73
- jfaker.sql({length: 50}) // Returns: SQL payload exactly 50 chars long
74
-
75
- // Use all available payloads for the type
76
- jfaker.xss({length: -1}) // Returns: all XSS payloads joined together
77
- jfaker.sql({length: -1}) // Returns: all SQL payloads joined together
78
- ```
79
-
80
- ### Utility Methods
81
-
82
- #### `setDataType(type: string): void`
83
-
84
- 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.
85
-
86
- **Parameters:**
87
- - `type`: One of `'faker'`, `'xss'`, `'sql'`, `'bash'`, `'chars'`, `'htmlentities'`, or `'numbers'`
88
-
89
- **Usage:**
90
- ```typescript
91
- // Set to generate XSS payloads by default
92
- jfaker.setDataType('xss');
93
-
94
- // Now all calls return XSS data (unless safe: true is used)
95
- jfaker.person.firstName(); // Returns: XSS payload, not a real name
96
- jfaker.internet.email(); // Returns: XSS payload, not a real email
97
-
98
- // Reset to normal faker behavior
99
- jfaker.setDataType('faker');
100
- jfaker.person.firstName(); // Returns: "John" (normal faker data)
101
- ```
102
-
103
- **CI/CD Integration:**
104
-
105
- The data type can also be set via the `JAHIA_CYPRESS_INJECTION_TYPE` environment variable from your CI/CD pipeline:
106
-
107
- ```bash
108
- # Run tests with XSS injection data
109
- JAHIA_CYPRESS_INJECTION_TYPE=xss
110
-
111
- # Run tests with SQL injection data
112
- JAHIA_CYPRESS_INJECTION_TYPE=sql
113
- ```
114
-
115
- #### `getDataType(): string`
116
-
117
- Retrieves the current global data type.
118
-
119
- **Returns:** The current data type (defaults to `'faker'` if not set)
120
-
121
- **Usage:**
122
- ```typescript
123
- jfaker.setDataType('xss');
124
- console.log(jfaker.getDataType()); // Outputs: "xss"
125
- ```
126
-
127
- #### `escape(str: string): string`
128
-
129
- 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.
130
-
131
- **Parameters:**
132
- - `str`: String to escape
133
-
134
- **Returns:** Escaped string
135
-
136
- **Usage:**
137
- ```typescript
138
- jfaker.escape('Hello "World"'); // Returns: 'Hello \"World\"'
139
- jfaker.escape('Line1\nLine2'); // Returns: 'Line1\\nLine2'
140
- jfaker.escape('Tab\there'); // Returns: 'Tab\\there'
141
- ```
142
-
143
- ## Advanced Usage
144
-
145
- ### Safe Option
146
-
147
- When a global injection type is overridden, you can force specific calls to keep using `Faker.js` data by setting `safe: true`.
148
-
149
- ```typescript
150
- // Set global type to XSS
151
- jfaker.setDataType('xss');
152
-
153
- // This returns XSS payload
154
- jfaker.person.firstName();
155
-
156
- // This forces Faker.js data generation (overrides global setting)
157
- // Call down below always returns human-readable first name, e.g.: "John"
158
- jfaker.person.firstName({safe: true});
159
-
160
- // Combining with other options
161
- // Call down below always returns human-readable email,
162
- // e.g. "user@example.com" (faker data with provider option)
163
- jfaker.internet.email({
164
- provider: 'example.com',
165
- safe: true
166
- });
167
- ```
168
-
169
- ### Options Summary
170
-
171
- | Option | Type | Injection Methods | Faker Methods | Description |
172
- |--------------------|------|-------------------|---------------|----------------------------------------------------------------------------------------------------|
173
- | `length` | `number` | ✅ | ✅* | For injections: exact character length (-1 = all payloads). For faker: passed to the faker method. |
174
- | `safe` | `boolean` | ❌ | ✅ | When `true`, forces to use `Faker.js` data even when global type is overridden (set to injection). |
175
- | *any faker option* | various | ❌ | ✅ | Any option supported by the specific Faker.js method (e.g., `provider`, `min`, `max`). |
176
-
177
- \* Many Faker.js methods accept a `length` option, such as `jfaker.string.alpha({length: 10})`.
178
-
179
- ## Usage Examples
180
-
181
- ### Example 1: Form Testing with Realistic Data
182
-
183
- ```typescript
184
- describe('User Registration Form', () => {
185
- it('should register a new user', () => {
186
- cy.visit('/register');
187
-
188
- cy.get('#firstName').type(jfaker.person.firstName());
189
- cy.get('#lastName').type(jfaker.person.lastName());
190
- cy.get('#email').type(jfaker.internet.email({provider: 'testdomain.com'}));
191
- cy.get('#phone').type(jfaker.phone.number());
192
- cy.get('#company').type(jfaker.company.name());
193
- cy.get('#city').type(jfaker.location.city());
194
-
195
- cy.get('#submit').click();
196
- cy.contains('Registration successful').should('be.visible');
197
- });
198
- });
199
- ```
200
-
201
- ### Example 2: Security Testing with Injection Payloads
202
-
203
- ```typescript
204
- describe('Input Validation - XSS Protection', () => {
205
- it('should sanitize XSS payloads in username field', () => {
206
- cy.visit('/profile');
207
-
208
- const xssPayload = jfaker.xss({length: 50});
209
-
210
- cy.get('#username').type(xssPayload, {
211
- parseSpecialCharSequences: false // Important!
212
- });
213
-
214
- cy.get('#save').click();
215
-
216
- // Verify the payload is escaped/sanitized
217
- cy.get('#username-display').invoke('text').then(text => {
218
- expect(text).not.to.include('<script>');
219
- });
220
- });
221
- });
222
- ```
223
-
224
- ### Example 3: Global Injection Testing
225
-
226
- ```typescript
227
- describe('Security Test Suite - SQL Injection', () => {
228
- before(() => {
229
- // Set global type to SQL injection for the entire suite
230
- jfaker.setDataType('sql');
231
- });
232
-
233
- after(() => {
234
- // Reset to faker after tests
235
- jfaker.setDataType('faker');
236
- });
237
-
238
- it('should protect search from SQL injection', () => {
239
- cy.visit('/search');
240
-
241
- // This returns SQL injection payload due to global setting
242
- const searchTerm = jfaker.lorem.word();
243
-
244
- cy.get('#search').type(searchTerm, {parseSpecialCharSequences: false});
245
- cy.get('#search-btn').click();
246
- cy.contains('No results found').should('be.visible');
247
- });
248
-
249
- it('should use faker data when explicitly needed', () => {
250
- cy.visit('/search');
251
-
252
- // Force to use Faker.js data for this specific call
253
- const normalSearch = jfaker.lorem.word({safe: true});
254
-
255
- cy.get('#search').type(normalSearch);
256
- cy.get('#search-btn').click();
257
- // Test with normal search term...
258
- });
259
- });
260
- ```
261
-
262
- ### Example 4: Comprehensive Input Fuzzing
263
-
264
- ```typescript
265
- describe('Input Field Robustness', () => {
266
- const injectionTypes = ['xss', 'sql', 'bash', 'chars', 'htmlentities', 'numbers'];
267
-
268
- injectionTypes.forEach(type => {
269
- it(`should handle ${type} injection payloads`, () => {
270
- cy.visit('/form');
271
-
272
- const payload = jfaker[type]();
273
-
274
- cy.get('#input-field').type(payload, {
275
- parseSpecialCharSequences: false
276
- });
277
-
278
- cy.get('#submit').click();
279
-
280
- // Verify no errors or security issues
281
- cy.get('.error-message').should('not.exist');
282
- });
283
- });
284
- });
285
- ```
286
-
287
- ### Example 5: Dynamic Test Data Creation
288
-
289
- ```typescript
290
- describe('User Creation', () => {
291
- it('should create multiple users with unique data', () => {
292
- for (let i = 0; i < 5; i++) {
293
- const user = {
294
- firstName: jfaker.person.firstName(),
295
- lastName: jfaker.person.lastName(),
296
- email: jfaker.internet.email(),
297
- username: jfaker.internet.userName(),
298
- password: jfaker.internet.password({length: 12}),
299
- bio: jfaker.lorem.paragraph(),
300
- age: jfaker.number.int({min: 18, max: 80})
301
- };
302
-
303
- cy.request('POST', '/api/users', user).then(response => {
304
- expect(response.status).to.eq(201);
305
- });
306
- }
307
- });
308
- });
309
- ```
310
-
311
- ### Data Persistence
312
-
313
- The global data type is stored in Cypress environment variables (`JAHIA_CYPRESS_INJECTION_TYPE`), which means:
314
- - It persists across specs within a test run
315
- - It can be set from CI/CD pipelines as an environment variable
316
- - It's cleared when Cypress restarts
317
-
318
- ## Best Practices
319
-
320
- 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:
321
- ```typescript
322
- after(() => {
323
- jfaker.setDataType('faker');
324
- });
325
- ```
326
-
327
- 2. **Use Descriptive Variables**: Store generated data in descriptive variables for better test readability:
328
- ```typescript
329
- const userEmail = jfaker.internet.email({provider: 'test.com'});
330
- const xssPayload = jfaker.xss({length: 100});
331
- ```
332
-
333
- 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.
334
-
335
- 4. **CI/CD Integration**: Use environment variables to run the same test suite with different data types:
336
- ```bash
337
- # Security tests with XSS
338
- JAHIA_CYPRESS_INJECTION_TYPE=xss npm run cypress:run
339
-
340
- # Security tests with SQL injection
341
- JAHIA_CYPRESS_INJECTION_TYPE=sql npm run cypress:run
342
- ```
343
-
344
- ## Technical Details
345
-
346
- ### Architecture
347
-
348
- The module uses a `DeepApi` class that implements a Proxy-based architecture:
349
- - **Property access** creates a deeper proxy, building a path (e.g., `person.firstName`)
350
- - **Function calls** execute the handler with the accumulated path and arguments
351
- - This enables the dynamic, chainable API without pre-defining all possible methods
352
-
353
- ### Injection Data Sources
354
-
355
- Injection payloads are imported from TypeScript files in the `src/injections/` directory:
356
- - `xss-data.ts` - XSS attack vectors
357
- - `sql-data.ts` - SQL injection patterns
358
- - `bash-data.ts` - Shell command injections
359
- - `chars-data.ts` - Special characters
360
- - `htmlentities-data.ts` - HTML entity variations
361
- - `numbers-data.ts` - Numeric edge cases
362
-
363
- ### Length Handling for Injections
364
-
365
- - **Undefined length**: Picks 2-5 random items from the payload array and joins them
366
- - **Positive length**: Concatenates random items until reaching the specified character count, then trims to exact length
367
- - **Length = -1**: Returns all available payloads for that type joined together
368
-
369
- ## IMPORTANT: Cypress `.type()` Command
370
-
371
- ### Why this matters
372
-
373
- Cypress `type()` treats sequences such as `{enter}` and characters such as `{` or `}` as special commands.
374
- That is a problem for injection payloads, because many payloads contain those same characters and should be typed literally.
375
-
376
- ### What `jahia-cypress` does automatically
377
-
378
- To reduce the need to set `parseSpecialCharSequences` everywhere, `jahia-cypress` overwrites Cypress `type()` with this rule:
379
-
380
- - If `jfaker.getDataType() !== 'faker'` at the time of the `type()` call, `parseSpecialCharSequences` is automatically set to `false`.
381
- - If `jfaker.getDataType() === 'faker'`, Cypress keeps its default behavior.
382
-
383
- This covers most common cases.
384
-
385
- ### When you still need to set it explicitly
386
-
387
- You should still pass `parseSpecialCharSequences` yourself in these edge cases:
388
-
389
- 1. **You want Cypress command sequences to work even though the global `jfaker` type is an injection type.**
390
- Use `parseSpecialCharSequences: true`.
391
- 2. **You use a direct injection call such as `jfaker.xss()` while the global `jfaker` type is still `faker`.**
392
- Use `parseSpecialCharSequences: false`.
393
-
394
- In short, the automatic behavior depends on the **global `jfaker` type when `type()` runs**, not on how the value was generated.
395
-
396
- ### Example 1: Global injection mode, but one field still needs `{enter}` as a command
397
-
398
- ```typescript
399
- // Env variable: JAHIA_CYPRESS_INJECTION_TYPE=xss
400
-
401
- // Returns an XSS payload because the global type is xss
402
- const firstName = jfaker.person.firstName();
403
-
404
- // Returns a normal Faker.js email because safe: true overrides the global type for this value only
405
- const email = jfaker.internet.email({safe: true});
406
-
407
- // Because the global type is still xss at type() time,
408
- // special sequences are treated literally.
409
- cy.findById('firstName').type(`${firstName}{enter}`);
410
-
411
- // We want {enter} to act as a Cypress command for this field,
412
- // so we must override the automatic behavior explicitly.
413
- cy.findById('email').type(`${email}{enter}`, {parseSpecialCharSequences: true});
414
- ```
415
-
416
- ### Example 2: Global Faker mode, but one field must always receive an injection payload
417
-
418
- ```typescript
419
- // Env variable: JAHIA_CYPRESS_INJECTION_TYPE=faker
420
-
421
- // Returns normal Faker.js data
422
- const firstName = jfaker.person.firstName();
423
-
424
- // Returns an XSS payload directly, regardless of the global faker setting
425
- const email = jfaker.xss();
426
-
427
- // Default Cypress behavior is fine here
428
- cy.findById('firstName').type(firstName);
429
-
430
- // Because the global type is faker at type() time,
431
- // Cypress would still try to interpret special characters as commands.
432
- // Force literal typing for the payload.
433
- cy.findById('email').type(email, {parseSpecialCharSequences: false});
434
- ```
435
-
436
- ### Rule of thumb
437
-
438
- - Want Cypress sequences such as `{enter}` to act as commands? Set `parseSpecialCharSequences: true`.
439
- - Want an explicitly generated injection payload to be typed literally? Set `parseSpecialCharSequences: false`.
440
- - Otherwise, omit the option and use the default `jahia-cypress` behavior.
441
-
442
- ## See Also
443
-
444
- - [Faker.js API Documentation](https://fakerjs.dev/api/) - Complete reference for all faker methods
445
- - [OWASP Injection Attacks](https://owasp.org/www-community/Injection_Flaws) - Understanding injection vulnerabilities
446
- - [Cypress Type Command](https://docs.cypress.io/api/commands/type) - Details on the `type()` command options
447
-
448
- ## Support
449
-
450
- 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 |