User tests: Successful: 0 Unsuccessful: 0
Starts work on adding an API for guided tours to give a structured way to create/update/delete guided tours and their steps from the system
This currently roughly returns the right things. However, things left to do:
Install copy of joomla. Check API endpoints - these will all be covered by the tests once completed
No API exists
API exists
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org: TODO!
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | SQL Administration com_admin Postgresql Installation Front End Plugins JavaScript Unit Tests |
Labels |
Added:
Unit/System Tests
PR-5.3-dev
|
Title |
|
Category | SQL Administration com_admin Postgresql Installation Front End Plugins JavaScript Unit Tests | ⇒ | SQL Administration com_admin Postgresql Templates (admin) Installation Front End Plugins JavaScript Unit Tests |
Category | SQL Administration com_admin Postgresql Installation Front End Plugins JavaScript Unit Tests Templates (admin) | ⇒ | SQL Administration com_admin Postgresql Installation Front End Plugins JavaScript Unit Tests |
@wilsonge , i have performed a first series of tests on this PR using Patchtester and Postman.
It works pretty well for now (50%, 'tours' APIs are Ok, i have to test 'steps' APIs).
Just one thing to check:
When applying PR 44398 via Patchtester (I do it twice to be sure), the plg_webservices_guidedtours files are indeed visible in the file system, but the installation is not effective in Joomla!?
I try to access the plugin in the plugins manager administration and via the installer in "Discover" mode, but nothing works!
In the end, I had to inject a SQL query into the _Extensions table to get the GT APIs to work:
INSERT INTO xxx_extensions (name, type, element, folder, client_id, enabled, locked, manifest_cache, params, custom_data)
VALUES ('plg_webservices_guidedtours', 'plugin', 'guidedtours', 'webservices', '0', '1', '1',
'{"name":"plg_webservices_guidedtours","type":"plugin","creationDate":"2019-09","author":"Joomla! Project","copyright":"(C) 2019 Open Source Matters, Inc.","authorEmail":"admin@joomla.org","authorUrl":"www.joomla.org","version":"4.0.0","description":"PLG_WEBSERVICES_GUIDEDTOURS_XML_DESCRIPTION","group":"","namespace":"Joomla\\\\Plugin\\\\WebServices\\\\Guidedtours","filename":"guidedtours"}', '{}', '');
Do we leave it as is to perform the validation tests or do you want to correct the PR before we proceed with the validation tests?
CC @obuisard
Hello Super Joomlers,
Happy to help testing and potentially improving this new Web Services endpoint.
Here's what I found out until now.
My current setup for testing this was php built-in server and for database docker mysql-8.0.36 official image. I tried this setup because I didn't want to set apache , nginx or caddy or frankenphp for now but ideally it should be tested with all those server. IIS too and litespeed too.
I added new tours and steps endpoints to the public postman collection I maintain with pre-request script and post-request script tests to ensure we have the correct responses and request otherwise those some tests will fail when trying to make a request with postman. I'm focusing on Postman since you already provided cypress system test for the tours and steps api endpoints. @wilsonge @garstud pointed out that in his tests with postman the delete endpoint returns 204 when hit once then it return 500 it tried another time. When I tried this with php-built in server it returns 500 on the first request but actually deletes the tour correctly all those test are made with the latest version of the postman app on for linux
I'm currently working on adding all endpoints available for tours and steps with tests in public postman collection to follow the progress live of improvements and added tests and more the live documentation is https://documenter.getpostman.com/view/7443864/2s9YywfKez
And you can watch the collection https://www.postman.com/mralexandrelise/workspace/alex-api-public-workspace/collection/7443864-c678a936-c256-497c-9894-d8f193d81e7e?action=share&creator=7443864&active-environment=7443864-63b1cc08-85f1-4ae9-8260-630f1ce738b0
I'll also try to help @wilsonge with the missing piece Check the step is part of the tour in the url when editing an individual step, else throw a 400. I already have a local custom branch with the current pull request applied as a patch locally. Hopefully I'll try to help as much as I can. Take care and have a great day Super Joomlers
You guys are definitely right it needs fixing - but it's going to need a fix beyond the scope of this PR - currently contacts/articles etc all have this behaviour (you can validate if you want). it's going to need a fix in the shared library code rather than something custom for tours. I'll try and create a separate PR for that over the coming few days - but for now I'd suggest we mark this as tested if that's the only bug you guys can find.
You guys are definitely right it needs fixing - but it's going to need a fix beyond the scope of this PR - currently contacts/articles etc all have this behaviour (you can validate if you want). it's going to need a fix in the shared library code rather than something custom for tours. I'll try and create a separate PR for that over the coming few days - but for now I'd suggest we mark this as tested if that's the only bug you guys can find.
Hey @wilsonge are you sure that this behaviour is not spread across more components than guided tours, contacts and articles? Maybe we should check if a majority of components using PATCH don't have this behaviour. What do you think?
The reason you have this is because deleting a second time tries to delete something that doesn’t exist. Just delete anything in a standard install with ID 1000 or something that doesn’t exist.
As you asked though I verified same behaviour in banners, menu items, redirects, modules, messages, users and tags.
The reason you have this is because deleting a second time tries to delete something that doesn’t exist. Just delete anything in a standard install with ID 1000 or something that doesn’t exist.
As you asked though I verified same behaviour in banners, menu items, redirects, modules, messages, users and tags.
I understand that removing an item that doesn't exists or is already deleted triggers an "error" but as you said it is not an error it is the expected behaviour because DELETE is not an idempotent operation meaning we cannot try over and over with the exact same outcome hence the "error" that isn't an error.
I was referring to what you said in the beginning of this PR not the DELETE as it works for me in Postman.
You said what is missing it that:
- Check the step is part of the tour in the url when editing an individual step, else throw a 400.
That's what I'm talking about. From what I understand in your sentence, it seems to be for the PATCH operation on step PATCH https://example.org/api/index.php/v1/tours/{tourid}/steps/{stepid}
. Seem to need be checked in the edit task of the StepsController.php
maybe a trait to handle common behaviour across otherwise unrelated classes like contacts/content and maybe others?
Thank you Alexandre @alexandreelise et Marc @garstud for looking into this and testing that great addition to the API provided by George @wilsonge !
Thanks to all of you Super Joomlers! And Happy new year 2025
Hello, sorry, i forgot to finish my test on the "steps" APIs.
(my tests on "tours" APIs are already ok)
I will try to finish them this WE ... and validate my test on this PR!
@alexandreelise , i think you are the best candidate to make a second test series ;)
Is it possible for you to make tests too (when you can)?
(i hope we validate this PR before Joomla 5.3 Beta 1 ... and maybe i will write a JCM article on it ;) )
@garstud As far as I know, All the tests are already in the updated Postman Collection https://documenter.getpostman.com/view/7443864/2s9YywfKez . @wilsonge or anyone willing to do it will make the adjustments in the code to provide a more robust and unified way to handle PATCH request which is, for now , preventing this PR to be merged.
Well, @alexandreelise I wanted to avoid reusing an already existing and ready-made list of API calls!
And rather redo one to be sure that the test is not just a simple copy of another test.
So I will continue on my Postman collection, and I will test the step/PATCH case! ;)
@garstud It was just as suggestion, not a recommandation, a rule or a law. I'm just trying to help move this pr forward as Joomla Web Services is my main focus for now. If it is not appreciated, I can continue my own projects like I already used to do and leave this as is. Enjoy your weekend.
@alexandreelise your work is really appreciated, for sure! ;)
We need 2 success tests to validate this PR, so it seems interesting to me that one of the tests is done based on your collection and the other is done on an independent collection ;)
Then outside of this PR, your collection brings real added value for all devs who wish to develop on Joomla APIs!!!
This collection is a contribution to the joomla community which is an attempt to make more people aware of the true power of Joomla Web Services. Even though it is "my" collection. The focus is the help others learn and use Joomla more. Thanks anyway for your kind words. Thanks for your contribution to this PR too. Take care @garstud
@obuisard some tests here would be appreciated. Think this will help with some of your exports/imports