User tests: Successful: Unsuccessful:
Added tests for handling invalid payloads, pagination and category relationship.
Pull Request resolves # .
added test for:
run npx cypress run --spec tests/System/integration/api/com_content/Articles.cy.js
some tests
more tests
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
| Status | New | ⇒ | Pending |
| Category | ⇒ | JavaScript Unit Tests |
| Labels |
Added:
Unit/System Tests
PR-6.2-dev
|
||
i have addressed your feedback
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.
All 13 tests in
Articles.cy.jspass (Cypress 15.18.0, Electron, 6.2-dev on PHP 8.3). A few suggestions:datawrapper. Even a wrapped valid payload{data:{attributes:{title, catid}}}returns the same 400Field required: Title\nField required: Category. The test checks missing required fields, not formatting. Suggest a flat{ title: 'automated test article' }(nocatid), plus an updated comment/test name.catid: 2is already the default fromdb_createArticle, so the assertion would pass even ifcatidwere ignored. Usecy.db_createCategory({ extension: 'com_content' })and assert that id (checked: a new category id10is returned correctly inrelationships.category.data.id).eslint --config build/eslint.config.mjsreports 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.--fixresolves all of them.The pagination test is solid: it fails if
offsetis ignored (it would return C instead of B).