Unit/System Tests PR-6.2-dev Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
16 Oct 2026

Added tests for handling invalid payloads, pagination and category relationship.

Pull Request resolves # .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

added test for:

  • pagination
  • error handling for malformed payload
  • category relationship

Testing Instructions

run npx cypress run --spec tests/System/integration/api/com_content/Articles.cy.js

Actual result BEFORE applying this Pull Request

some tests

Expected result AFTER applying this Pull Request

more tests

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar alikon alikon - open - 16 Oct 2026
avatar alikon alikon - change - 16 Oct 2026
Status New ⇒ Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 Oct 2026
Category ⇒ JavaScript Unit Tests
avatar tecpromotion
tecpromotion - comment - 16 Oct 2026

All 13 tests in Articles.cy.js pass (Cypress 15.18.0, Electron, 6.2-dev on PHP 8.3). A few suggestions:

  1. Malformed-payload test: the comment is misleading. The Joomla API takes flat attributes; it doesn't use a JSON:API data wrapper. Even a wrapped valid payload {data:{attributes:{title, catid}}} returns the same 400 Field required: Title\nField required: Category. The test checks missing required fields, not formatting. Suggest a flat { title: 'automated test article' } (no catid), plus an updated comment/test name.
  2. Category test doesn't prove the link. catid: 2 is already the default from db_createArticle, so the assertion would pass even if catid were ignored. Use cy.db_createCategory({ extension: 'com_content' }) and assert that id (checked: a new category id 10 is returned correctly in relationships.category.data.id).
  3. Code style: eslint --config build/eslint.config.mjs reports 31 errors, all in the new lines (double quotes, quoted props, indentation, trailing spaces, missing trailing commas). The existing part of the file is clean. --fix resolves all of them.

The pagination test is solid: it fails if offset is ignored (it would return C instead of B).

avatar alikon alikon - change - 19 Oct 2026
Labels Added: Unit/System Tests PR-6.2-dev
567192b 19 Oct 2026 avatar alikon cs
avatar alikon
alikon - comment - 19 Oct 2026

i have addressed your feedback

avatar brianteeman
brianteeman - comment - 30 Oct 2026

Thanks for adding these tests. The pagination coverage looks good, and it's always nice to see a few more API tests rather than just assuming everything works because nobody has complained yet.

There is one thing I'd like changed in the category relationship test. You're assuming that the article you've just created will magically appear as the first item returned by the API. That's a rather optimistic assumption and one that isn't guaranteed to hold.

I'd suggest capturing the article ID when you create it and then requesting that specific article when checking the category relationship. That way we're actually testing the relationship for the article we created rather than relying on the API returning things in the order we happen to expect.

I'd also rename the malformed payload test. We're not actually testing a malformed payload here, just an otherwise perfectly valid request that's missing a required field. There's a difference.

Other than that, useful additions. Just needs a little more attention to the details.

Add a Comment

Login with GitHub to post a comment