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

Add Cypress tests for partial page load #1605

Merged
merged 9 commits into from
Mar 13, 2024

Conversation

osma
Copy link
Member

@osma osma commented Mar 7, 2024

Reasons for creating this PR

This PR adds more Cypress tests for verifying functionality during and after partial page loads.

Link to relevant issue(s), if any

Description of the changes in this PR

  • modify the Cypress tests for the concept page so that the most important tests related to dynamic functionality (title, URI, copy to clipboard, mappings) are run both with full and partial page loads
  • change the declaration of the SKOSMOS global object from const SKOSMOS to window.SKOSMOS, and all references to it to window.SKOSMOS (this makes it accessible on the Cypress side)
  • add tests to the vocab-home cypress test suite for verifying partial page load functionality when clicking concepts in the sidebar (hierarchy and alphabetical index); also verify that window.SKOSMOS has been properly updated after partial page load

Known problems or uncertainties in this PR

Cypress/Electron appears to have problems getting stuck with cy.visit(url) in case the URL has already been loaded by the tested application using AJAX style requests. The code in the PR avoids this situation by using different example concept pages for the partial page load tests than for the subsequent tests that perform full page loads. See this comment for some details.

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@osma osma added this to the 3.0 milestone Mar 7, 2024
@osma osma self-assigned this Mar 7, 2024
Copy link

codecov bot commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.58%. Comparing base (223ddd2) to head (a7150b7).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1605   +/-   ##
=========================================
  Coverage     70.58%   70.58%           
  Complexity     1647     1647           
=========================================
  Files            32       32           
  Lines          4321     4321           
=========================================
  Hits           3050     3050           
  Misses         1271     1271           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@osma osma changed the title Cypress tests for partial page load Add Cypress tests for partial page load Mar 7, 2024
@osma osma force-pushed the issue1598-cypress-tests-partial-page-load branch from 37d666f to c1db580 Compare March 7, 2024 12:07
@osma osma force-pushed the issue1598-cypress-tests-partial-page-load branch from c1db580 to 315b40d Compare March 7, 2024 12:22
@osma osma marked this pull request as ready for review March 7, 2024 13:50
@osma osma requested a review from UnniKohonen March 7, 2024 13:54
Copy link
Contributor

@UnniKohonen UnniKohonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, but I'm wondering if mappings should be checked on vocab home page too.

tests/cypress/template/vocab-home.cy.js Show resolved Hide resolved
tests/cypress/template/vocab-home.cy.js Show resolved Hide resolved
Copy link

sonarcloud bot commented Mar 12, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
35.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@osma osma requested a review from UnniKohonen March 12, 2024 14:00
@osma
Copy link
Member Author

osma commented Mar 12, 2024

@UnniKohonen I added tests for mappings as well. All good now?

Copy link
Contributor

@UnniKohonen UnniKohonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@osma osma merged commit f22c504 into main Mar 13, 2024
11 of 12 checks passed
@osma osma deleted the issue1598-cypress-tests-partial-page-load branch March 13, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done (verified in test.dev.finto.fi, set Milestone 3.0 for both issue & PR)
Development

Successfully merging this pull request may close these issues.

Cypress tests for partial page load
2 participants