Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cypress] + com_actionlogs #43531

Merged
merged 16 commits into from
Jun 24, 2024
Merged

[cypress] + com_actionlogs #43531

merged 16 commits into from
Jun 24, 2024

Conversation

alikon
Copy link
Contributor

@alikon alikon commented May 26, 2024

Summary of Changes

add a simple test for the view /administrator/index.php?option=com_actionlogs&view=actionlogs

Testing Instructions

npm run cypress:run -- --spec tests/System/integration/administrator/components/com_actionlogs/Actionlogs.cy.js

Actual result BEFORE applying this Pull Request

N/A

Expected result AFTER applying this Pull Request

a test for the view

Link to documentations

Please 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

@alikon alikon changed the title cy-actionlogs [cypress] + com_actionlogs May 27, 2024
@alikon alikon marked this pull request as ready for review May 27, 2024 06:26
alikon and others added 4 commits May 30, 2024 15:54
…gs/Actionlogs.cy.js

Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com>
…gs/Actionlogs.cy.js

Co-authored-by: Allon Moritz <allon.moritz@digital-peak.com>
@laoneo laoneo self-assigned this Jun 14, 2024
@muhme
Copy link
Contributor

muhme commented Jun 17, 2024

I was surprised that this test spec fails on my Docker-based test for all four branches with the following:

  2 failing

  1) Test in backend that the action logs
       can display a list of actions:
     AssertionError: Timed out retrying after 4000ms: Expected to find content: 'User ci-admin logged in to admin' but never did.
      at Context.eval (webpack://joomla/./tests/System/integration/administrator/components/com_actionlogs/Actionlogs.cy.js:21:7)

  2) Test in backend that the action logs
       can delete selected logs:
     AssertionError: Timed out retrying after 4000ms: Expected to find element: `thead input[name='checkall-toggle']`, but never found it.
      at Context.checkAllResults (webpack://joomla/./node_modules/joomla-cypress/src/support.js:140:0)

After some investigation:

  • The reason is not the docker-based test, it is running the overall test suite twice.
  • The plugin 'Action Log - Joomla' is deactivated and therefore no action log is written.
  1. administrator/components/com_plugins/Plugins.cy.js disables and enables plugin 'Action Log - Joomla', if by fault this test is interrupted, the plugin may stay disabled and then there is no action log – but this was not the reason it was:
  2. api/com_plugins/Plugins.cy.js this test spec, as last step, disables the first plugin in the list and this in in alphabetical order 'Action Log' 😞

It should be reproducible by

 npx cypress run --spec tests/System/integration/api/com_plugins/Plugins.cy.js,tests/System/integration/administrator/components/com_plugins/Plugins.cy.js

I would recommend to add enable 'Action Log - Joomla' in the beginning of the test spec, after check if the plugin is disabled. This would also cover the first case with the interrupted test. And of course extend the api test by enabling the first plugin in the list as last step.

@laoneo
Copy link
Member

laoneo commented Jun 20, 2024

@alikon what do you think about the suggestion from @muhme?

@alikon
Copy link
Contributor Author

alikon commented Jun 20, 2024

i'll check in the week-end hopefully

@alikon
Copy link
Contributor Author

alikon commented Jun 22, 2024

should be more safe than before now
😄

@muhme
Copy link
Contributor

muhme commented Jun 22, 2024

should be more safe than before now 😄

✅ yes, it is 👍 successfully tested this additional test spec administrator/components/com_plugins/Plugins.cy.js and the improved api/com_plugins/Plugins.cy.js on the branches dev-4.4, dev-5.1, dev-5.2 and dev-6.0 by running tree times:

tests/System/integration/api/com_plugins/Plugins.cy.js,tests/System/integration/administrator/components/com_plugins/Plugins.cy.js

@muhme
Copy link
Contributor

muhme commented Jun 22, 2024

Sorry, those were not the appropriate test specifications, one more test:

✅ this additional test specification Actionlogs.cy.js together with Plugins.cy.js (this time only executable in 4.4-dev) three times as well as once the entire test suite for 4.4-dev successfully

tests/System/integration/api/com_plugins/Plugins.cy.js,tests/System/integration/administrator/components/com_actionlogs/Actionlogs.cy.js

@laoneo
Copy link
Member

laoneo commented Jun 24, 2024

Should the plugin state not be restored after the tests were running through? After a test, the system should be left in the same stage as before the test. This is because we do not restore an initial database dump before every test runs.

@alikon
Copy link
Contributor Author

alikon commented Jun 24, 2024

if you refer to this line https://github.com/joomla/joomla-cms/pull/43531/files#diff-8265cec42f94079a40c9f1675f71d2290441d6e25a8225c1b12ae1de7383d07eR3

this was added to cover the scenario:

administrator/components/com_plugins/Plugins.cy.js disables and enables plugin 'Action Log - Joomla', if by fault this test is interrupted, the plugin may stay disabled and then there is no action log

@laoneo laoneo merged commit b805d80 into joomla:4.4-dev Jun 24, 2024
3 checks passed
@laoneo
Copy link
Member

laoneo commented Jun 24, 2024

Fine by me then. Thanks!

@laoneo laoneo added this to the Joomla! 4.4.6 milestone Jun 24, 2024
@alikon alikon deleted the cy.actionlogs branch June 24, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants