User tests: Successful: Unsuccessful:
System Tests are failing with #46631 as db_createCategory() hacks the category simplified in the database table. To prevent reimplementing nested set properly (lft/rgt/level/path) it is simple replaced by api_post() call.
db_createCategory() by api_post()db_createCategory() command in source and documentationbeforeEach() deletion as recommended by Cypress.
afterEach there may stay objects in instance, e.g. news feed category 'Automated System Tests Category Title feed delete'support/constants.mjs with AST_CATEGORY_TITLE
db_* commands, but the other ones we would leave for performance reasons.npx cypress run --spec tests/System/integration/administrator/components/com_categories/Categories.cy.js
npx cypress run --spec tests/System/integration/administrator/components/com_categories/Categories.cy.js
db_createCategory() is removed from source and documentationPlease select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Administration com_categories Unit Tests Repository JavaScript |
| Labels |
Added:
Unit/System Tests
PR-6.1-dev
|
||
| Category | Administration com_categories Unit Tests Repository JavaScript | ⇒ | Unit Tests Repository JavaScript |
To prevent reimplementing nested set properly (lft/rgt/level/path) it is simple replaced by api_post() call.
surely that makes it an unrealistic test
There are tests that create a category in the backend. What we are talking about here is that if we need to create categories as a prerequisite for other tests, the not fully implemented database table hack will be replaced by API call.
| Labels |
Added:
bug
|
||
I would move the api call to its own function and not call everywhere the api directly.
| Title |
|
||||||
I would move the api call to its own function and not call everywhere the api directly.
Sorry, I don't understand the reasons for this. That would be a separate function with a different name, but without any additional functionality, right? But what's the advantage? And does that only apply to the changed places or also to the 200 cy.api_* calls in 40 files that already exist?
Maybe we can do that later as refactoring and just do the bare minimum in this PR to make it work?
@muhme @laoneo what's the status of this pr, one test failed
The failed test
api/com_content/Articles.cy.jspassed three times locally with current 6.1-dev branch. And the errorTypeError: cy.db_createCategory is not a functionlooks like a Cypress glitch? I would recommend running the tests again.
Nonsense 😅 If I test with this PR applied! the tests fail. That's expected because this PR removes db_createCategory.
It looks like additional tests were added over the past few months. Those new tests will need to have db_createCategory removed as well. I will do that once I have the time.
@muhme
can you explain why db_createCategory() changed to by api_post()
"To prevent reimplementing nested set properly (lft/rgt/level/path) it is simple replaced call."
and then brutally deleting category with cy.task('queryDB', `DELETE FROM #__categories WHERE title LIKE '${AST_CATEGORY_TITLE}%'`);
which broke the nested set ?
@muhme
can you explain why db_createCategory() changed to by api_post()
"To prevent reimplementing nested set properly (lft/rgt/level/path) it is simple replaced call."
and then brutally deleting category with cy.task('queryDB', `DELETE FROM #__categories WHERE title LIKE '${AST_CATEGORY_TITLE}%'`);
which broke the nested set ?
maybe we need to do like with menus
joomla-cms/tests/System/support/commands/db.mjs
Lines 448 to 501 in 7cc83cf
@alikon Thank you for your comments.
can you explain why db_createCategory() changed to api_post()?
ATT discussed this back in January 😅
... brutally deleting category ... which broke the nested set
Yes, that's bad and definitely not acceptable 🙈
maybe we need to do like with menus
It would be great if you could extend db_createCategory(). Would you be willing to take that on, @alikon? 🙏
@richard67 @HLeithner @laoneo In that case, I would close this PR. I think @alikon's proposal to solve wrong lft and rgt setting for categories is more appropriate. Since this is a bug and only affects the System Tests, I guess the fix should be submitted as a new PR against the 5.4-dev branch.
| Status | Pending | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-07-22 08:38:15 |
| Closed_By | ⇒ | muhme |
surely that makes it an unrealistic test