Skip to content

Commit 46c3bc0

Browse files
muhmealikonlaoneo
authored
[4.4] Use joomla-cypress 1.1.1 (joomla#43722)
* [cypress] Updated to joomla-cypress 1.1.0 The joomla-cypress NPM package used has been updated to the latest version in order to be able to use one version in all active joomla-cms branches. Other packages were also updated to the latest versions with the `npm update`. The overwritten Cypress commands for faster login with session have been deleted, as they are already included in the new joomla-cypress version. * Hack to prevent deprecated in mod_related_items * 3 more files with workarounds * no hack for modules * avoid hacks * avoid hacks * featured * featured * module * nomore * nomore * Fix missing apostrophe * NPM Update only joomla-cypress npm install [email protected] * Update tests/System/README.md Removed notice on overridden joomla-cypress commands * Fixing lint:testjs errors * Undo the changes extracted to a separate PRs * npm update joomla-cypress 1.1.1 --------- Co-authored-by: Nicola Galgano <[email protected]> Co-authored-by: Allon Moritz <[email protected]>
1 parent 98a4b2a commit 46c3bc0

File tree

4 files changed

+36
-86
lines changed

4 files changed

+36
-86
lines changed

package-lock.json

Lines changed: 33 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"fs-extra": "^10.1.0",
9393
"ini": "^2.0.0",
9494
"jasmine-core": "^3.99.1",
95-
"joomla-cypress": "^0.0.16",
95+
"joomla-cypress": "^1.1.1",
9696
"lightningcss": "^1.22.1",
9797
"mysql": "^2.18.1",
9898
"postcss": "^8.4.30",
@@ -111,4 +111,4 @@
111111
"stylelint-order": "^5.0.0",
112112
"stylelint-scss": "^4.7.0"
113113
}
114-
}
114+
}

tests/System/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,6 @@ SMTP configuration.
122122
123123
The used npm package "Helpers for using Cypress with Joomla for testing" **[joomala-cypress](https://github.com/joomla-projects/joomla-cypress/)** helps in writing the Cypress tests for Joomla in extending the Cypress API with custom commands.
124124
125-
> [!IMPORTANT]
126-
> Some `joomala-cypress` commands are overwritten by the System Tests,
127-
> see [tests/System/support/commands.js](/tests/System/support/commands.js).
128-
129125
The **[smtp-tester](https://www.npmjs.com/package/smtp-tester)** npm package creates an SMTP server that listens
130126
on the `smtp_port` specified in `cypress.config.mjs` during test runtime.
131127
This server accepts connections, receives emails, and provides the capability to check the received emails during the test.

tests/System/support/commands.mjs

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Imports commands fom files. The commands start with the folder name and an underscore as cypress doesn't support
2+
* Imports commands from files. The commands start with the folder name and an underscore as Cypress doesn't support
33
* namespaces for commands.
44
*
55
* https://github.com/cypress-io/cypress/issues/6575
@@ -12,55 +12,3 @@ import './commands/config.mjs';
1212
import './commands/db.mjs';
1313

1414
registerCommands();
15-
16-
Cypress.Commands.overwrite('doFrontendLogin', (originalFn, username, password, useSnapshot = true) => {
17-
// Ensure there are valid credentials
18-
const user = username ?? Cypress.env('username');
19-
const pw = password ?? Cypress.env('password');
20-
21-
// Do normal login when no snapshot should be used
22-
if (!useSnapshot) {
23-
// Clear the session data
24-
Cypress.session.clearAllSavedSessions();
25-
26-
// Call the normal function
27-
return originalFn(user, pw);
28-
}
29-
30-
// Do login through the session
31-
return cy.session([user, pw, 'front'], () => originalFn(user, pw), { cacheAcrossSpecs: true });
32-
});
33-
34-
Cypress.Commands.overwrite('doFrontendLogout', (originalFn) => {
35-
// Call the login function
36-
originalFn();
37-
38-
// Clear the session data
39-
Cypress.session.clearAllSavedSessions();
40-
});
41-
42-
Cypress.Commands.overwrite('doAdministratorLogin', (originalFn, username, password, useSnapshot = true) => {
43-
// Ensure there are valid credentials
44-
const user = username ?? Cypress.env('username');
45-
const pw = password ?? Cypress.env('password');
46-
47-
// Do normal login when no snapshot should be used
48-
if (!useSnapshot) {
49-
// Clear the session data
50-
Cypress.session.clearAllSavedSessions();
51-
52-
// Call the normal function
53-
return originalFn(user, pw);
54-
}
55-
56-
// Do login through the session
57-
return cy.session([user, pw, 'back'], () => originalFn(user, pw), { cacheAcrossSpecs: true });
58-
});
59-
60-
Cypress.Commands.overwrite('doAdministratorLogout', (originalFn) => {
61-
// Call the login function
62-
originalFn();
63-
64-
// Clear the session data
65-
Cypress.session.clearAllSavedSessions();
66-
});

0 commit comments

Comments
 (0)