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

CU-8689rj9th Add Super Admin Tests #820

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open

Conversation

ksmontville
Copy link
Collaborator

@ksmontville ksmontville commented Sep 17, 2024

Proposed changes

Awaiting PR: #821 --> Merge this first to reduce files changed in this PR (there is some duplication).

This PR adds support for running Cypress tests related to super admin functions on the dashboard. Currently, this includes creating test orgs, test administrations, test administrators, test students, and other general super admin user flows.

There are also new clean-up tests which will help keep Firestore from being inundated with test-related documents generated during these super admin tests.

Types of changes

What types of changes does this pull request introduce?

MAJOR CHANGES:

  • Add super admin credentials to GitHub secrets, and a new workflow to utilize them in order to run super admin related Cypress tests
  • New GitHub actions to run the super admin tests, then run clean-up tests if those tests were successful
  • Add super admin clean-up tests, which execute after the super admin tests. These clean-up tests will go through the development Firestore and delete any test orgs, admins, administrations, students, etc. that are created during the super admin tests. These may be deprecated in the future if we can get the Firestore emulators to work with the dashboard.
  • New helper functions for super admins, including functions for accessing and interacting with Firestore. These can be found in Cypress/support/query.js and Cypress/support/utils.js
  • General refactors
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (non-breaking change that does not add functionality but makes code cleaner or more efficient)
  • Documentation Update
  • Tests (new or updated tests)
  • Style (changes to code styling)
  • CI (continuous integration changes)
  • Repository Maintenance
  • Other (please describe below)

Checklist

  • I have read the guidelines for contributing.
  • The changes in this PR are as small as they can be. They represent one and only one fix or enhancement.
  • Linting checks pass with my changes.
  • Any existing unit tests pass with my changes.
  • Any existing end-to-end tests pass with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • If this PR fixes an existing issue, I have added a unit or end-to-end test that will detect if this issue reoccurs.
  • I have added JSDoc comments as appropriate.
  • I have added the necessary documentation to the roar-docs repository.
  • I have shared this PR on the roar-pr-reviews channel (if I have access)
  • I have linked relevant issues (if any)

Justification of missing checklist items

Further comments

@ksmontville ksmontville requested a review from a team as a code owner September 17, 2024 22:10
@richford
Copy link
Contributor

Copy link

github-actions bot commented Sep 17, 2024

Visit the preview URL for this PR (updated for commit 68ad7c3):

https://roar-staging--pr820-add-super-admin-test-y1rnqety.web.app

(expires Wed, 02 Oct 2024 18:45:37 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2631e9c58fd0104ecbfddd72a62245ddac467460

Copy link

cypress bot commented Sep 17, 2024

roar-dashboard-e2e    Run #7324

Run Properties:  status check passed Passed #7324  •  git commit 68ad7c30fd: Super Admin E2E Tests for PR 820 "CU-8689rj9th Add Super Admin Tests" from commi...
Project roar-dashboard-e2e
Branch Review add-super-admin-tests
Run status status check passed Passed #7324
Run duration 01m 26s
Commit git commit 68ad7c30fd: Super Admin E2E Tests for PR 820 "CU-8689rj9th Add Super Admin Tests" from commi...
Committer Kyle
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
View all changes introduced in this branch ↗︎

Copy link

github-actions bot commented Sep 17, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 0.97% 73 / 7476
🔵 Statements 0.9% 74 / 8211
🔵 Functions 0.76% 14 / 1819
🔵 Branches 0.44% 20 / 4496
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/components/ConsentPicker.vue 0% 0% 0% 0% 290, 294-311, 313-323, 325-340, 342-347, 350-353, 351-352, 354-357, 355-356, 358-369, 372-373, 375-388, 376-387, 378-379, 381-386, 390-403, 391, 394-401, 395-400, 406-429, 414, 417-429, 421, 423, 425, 427-428, 432-438, 440-452, 441-442, 444-450, 445-449, 446-449, 448, 451, 456-460, 457, 459, 461-463, 467-470, 469, 474-477, 476, 481-491, 482-488, 483-487, 484-487, 486, 489-490, 495-515, 496-504, 499-503, 500-502, 506-514, 507-513, 508-512, 509-511, 519-539, 522-536, 523-535, 528-535, 534, 537-538, 543, 545-569, 546-568, 548-549, 553-568, 556, 559-568, 562-563, 563-567, 565-566, 573-575, 574, 578-584, 579-583, 580, 582, 586-589, 587-588, 591-594, 592-593, 596-603, 597-602, 598, 600-601, 3-5, 15, 17, 27, 31, 40-41, 44, 46, 48, 50, 58-59, 64, 72, 81-82, 108-109, 135-136, 154-158, 160, 163-164, 166, 173, 182, 192-195, 197, 200-201, 203, 210-211, 213-216, 216-219, 219-222, 222, 225, 1, 235, 238, 240-243, 243-246, 246-249, 249, 252, 262, 1-7, 1-19, 1-33, 1-52, 1-84, 1-111, 1-138, 1-159, 1-165, 1-175, 1-184, 1-196, 1-202, 229, 256, 1-270
src/components/CreateAdministrator.vue 0% 0% 0% 0% 103-106, 108-112, 114-115, 118-121, 119, 119-120, 123-125, 124, 124, 127-129, 128, 128, 131, 133-135, 134, 137-187, 138-147, 140-146, 149, 151-155, 157-163, 158-162, 167-170, 169, 172-175, 173-174, 177-186, 180-181, 184-185, 2-4, 1, 16-18, 25, 29-30, 37, 41-42, 44, 48-49, 51, 57-58, 71, 1-21, 1-33, 1-43, 1-50, 56, 1-60
src/components/CreateOrgs.vue 0% 0% 0% 0% 221-227, 229-238, 241-244, 242, 242-243, 246-248, 247, 247, 250-252, 251, 251, 254-260, 256, 262, 262-263, 263, 265, 265, 267-273, 269, 275-281, 277, 283-285, 284, 287, 287, 289-295, 291, 297-299, 298, 301-303, 302, 305, 305, 307-313, 309, 315-321, 318-320, 323-324, 326-331, 333, 335-341, 337-339, 338, 340, 343, 343, 345-361, 363-369, 364, 364-365, 365-366, 366-367, 367-368, 371-378, 372-376, 373-376, 375, 377, 380-390, 382-383, 383-388, 385, 387, 387, 389, 392-399, 393-398, 401-403, 402, 405-456, 406-455, 409-412, 414, 414-415, 415-416, 416-417, 417, 419-424, 420-424, 423, 426-452, 427-438, 430-432, 435-437, 440-451, 443-445, 448-450, 454, 458-465, 459-464, 2-3, 1, 15-18, 35-36, 54, 72-74, 76, 76, 81-82, 84, 84, 90, 107, 110, 112, 120, 124-126, 154, 156, 168, 172-173, 177, 190-191, 1-20, 1-38, 1-56, 1-75, 1-83, 1-92, 1-114, 1-158, 1-174, 1-179
src/components/NavBar.vue 0% 0% 0% 0% 82-88, 91-94, 92, 92-93, 96-98, 97, 97, 100-102, 101, 104-107, 105, 105-106, 109-111, 110, 115-121, 117, 123-125, 124, 127-150, 128-148, 131-141, 132, 134-140, 138, 142-147, 143-146, 149, 152-169, 153-168, 154, 156-159, 158, 160-167, 164, 166, 171-175, 172, 172-173, 173-174, 177, 177, 179-181, 180, 183-189, 184-188, 191-206, 196, 203, 208-234, 209-233, 216, 223, 230, 236-238, 237, 3, 5, 9, 24, 1, 47, 56
src/pages/HomeAdministrator.vue 0% 0% 0% 0% 138-140, 142-143, 145, 148-151, 149, 149-150, 153-155, 154, 154, 157-159, 158, 158, 161-163, 165, 165-166, 166-167, 167-170, 169, 177-201, 178, 180-198, 181-196, 184-192, 197, 200, 203-210, 205, 216-245, 219-227, 233-235, 234, 237-243, 238, 240-242, 241, 247, 249-255, 250-252, 254, 257-339, 341-345, 342-344, 347-355, 348-354, 349, 351-353, 352, 357-361, 358-360, 359, 363-382, 364-367, 369-374, 371, 373, 375-379, 376, 378, 381, 2-3, 5-6, 1, 14-15, 17, 24-26, 45-46, 89, 122, 1-19, 1-29, 1-48, 53
Generated in workflow #472

@ksmontville ksmontville marked this pull request as ready for review September 19, 2024 23:50
Emily-ejag
Emily-ejag previously approved these changes Sep 23, 2024
@richford
Copy link
Contributor

@ksmontville , can you rebase now that #821 is merged?

check body for success on test complete

add wait time to csv exports
Copy link
Collaborator

@maximilianoertel maximilianoertel left a comment

Choose a reason for hiding this comment

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

I've only had a very quick look at the PR, more specifically the post-test cleanup logic and believe the current approach will cause test failures if implemented as-is.

From what I could see, and please correct me if I missed a part, the cleanup script is deleting any entry that matches these specified regexes – not just the ones that were created in the current test run.

In other words: if one PR runs the cleanup task whilst another PR is running tests, you'll be deleting data that is currently being used as part of separate test runs.

As your PR description says, this should ideally not be run against a remote environment but rather against the emulator, run in the CI. If we really have to get these tests merged before getting the emulators to work (?), then every test run needs to create database records that are identifiable. Whilst we cannot use the PR number for this as tests can be re-run, the workflow run_id could do the job. Unfortunately, that approach means altering the application code to include this run ID, which is, well, not great.

Let me know what you think!

@ksmontville
Copy link
Collaborator Author

I've only had a very quick look at the PR, more specifically the post-test cleanup logic and believe the current approach will cause test failures if implemented as-is.

From what I could see, and please correct me if I missed a part, the cleanup script is deleting any entry that matches these specified regexes – not just the ones that were created in the current test run.

In other words: if one PR runs the cleanup task whilst another PR is running tests, you'll be deleting data that is currently being used as part of separate test runs.

As your PR description says, this should ideally not be run against a remote environment but rather against the emulator, run in the CI. If we really have to get these tests merged before getting the emulators to work (?), then every test run needs to create database records that are identifiable. Whilst we cannot use the PR number for this as tests can be re-run, the workflow run_id could do the job. Unfortunately, that approach means altering the application code to include this run ID, which is, well, not great.

Let me know what you think!

Thanks for the feedback.

I have thought about this as well, and for now I think that we are okay because the tests which create the database entities (for example, creating a test adminstration) don't go back and check that they are in the database. They check for the "Success!" banner that pops up as a result of a successful database entity creation through roar-firekit.

Then the clean-up tests go through and delete any entities which match the regex, but they won't fail in the case where they don't find any particular entity.

Ideally we would do this through emulators running gse-roar-admin and gse-roar-assessment after we get them all setup, but we aren't quite there yet.

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.

4 participants