Skip to content

[Testing:InstructorUI] Add Cypress for Manage Teams#13043

Merged
bmcutler merged 20 commits into
mainfrom
manage-teams-ui-cypress
Jul 23, 2026
Merged

[Testing:InstructorUI] Add Cypress for Manage Teams#13043
bmcutler merged 20 commits into
mainfrom
manage-teams-ui-cypress

Conversation

@roye2

@roye2 roye2 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

In #12909 I added some features for instructors to manage teams for their class. These features include: creating teams from subsections, creating single-student teams, and deleting all teams (without submissions). However, I did not add Cypress e2e testing for these features.

What is the New Behavior?

Cypress e2e testing has been added for the manage teams features. Creating teams from subsections and single student teams are tested for the instructor. It will also test that these teams have actually been created for their users. Then, it will test deleting these teams.

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. run the spec locally and ensure it passes (both in headless and headful mode)
  2. observe the spec passing on CI
  3. Verify that the spec is written with Cypress best practices as this is the first time I've ever written a cypress test.
    Submitty guidelines I followed here:
    https://submitty.org/developer/testing/cypress

Automated Testing & Documentation

It sure is :)

Other information

This is not a breaking change.
Luckily, this gradeable (grading team homework pdf) only starts off with teams with submissions, so the test is free to make and delete teams without disturbing the initial state of the gradeable (as long as it makes it to cleanup.)

@github-project-automation github-project-automation Bot moved this to Seeking Reviewer in Submitty Development Jul 15, 2026
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Jul 15, 2026
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.16%. Comparing base (db53b65) to head (ce0de11).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #13043   +/-   ##
=========================================
  Coverage     21.16%   21.16%           
  Complexity    10103    10103           
=========================================
  Files           285      285           
  Lines         38773    38773           
  Branches        596      596           
=========================================
  Hits           8205     8205           
  Misses        29986    29986           
  Partials        582      582           
Flag Coverage Δ
autograder 21.16% <ø> (ø)
js 1.73% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.19% <ø> (ø)
python_submitty_utils 79.83% <ø> (ø)
submitty_daemon_jobs 55.91% <ø> (ø)
vue 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@roye2
roye2 marked this pull request as ready for review July 15, 2026 15:28
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to Seeking Reviewer in Submitty Development Jul 15, 2026

@NicholasCiuica NicholasCiuica left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have done a code review, and have tested the new spec headfully (npx cypress open), and everything looks good. I've added some suggestions for things I noticed in the code. Also, I was unable to run the spec headlessly because of an npm issue that will require me to rebuild my VM, but I will test it tomorrow.

Comment thread site/cypress/e2e/Cypress-Feature/manage_teams.spec.js Outdated
Comment thread site/cypress/e2e/Cypress-Feature/manage_teams.spec.js Outdated
Comment thread site/cypress/e2e/Cypress-Feature/manage_teams.spec.js Outdated
@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Jul 16, 2026
@roye2

roye2 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

I have done a code review, and have tested the new spec headfully (npx cypress open), and everything looks good. I've added some suggestions for things I noticed in the code. Also, I was unable to run the spec headlessly because of an npm issue that will require me to rebuild my VM, but I will test it tomorrow.

@NicholasCiuica I've updated the spec to assert the states of the section + subsection for the students at appropriate times.

@roye2
roye2 requested a review from NicholasCiuica July 17, 2026 14:37
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to In Review in Submitty Development Jul 17, 2026
Comment thread site/cypress/e2e/Cypress-Feature/manage_teams.spec.js Outdated
@github-project-automation github-project-automation Bot moved this from In Review to Work in Progress in Submitty Development Jul 17, 2026

@NicholasCiuica NicholasCiuica left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I did a code review and all of the requests have been addressed. I tested locally with cypress run and open and all tests are passing and behaving as expected. Good work!

@IDzyre IDzyre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A couple comments about test structuring, but the code in the test themselves looks good. After the restructuring, I will re-review and approve if it's better.

cyAssertRegistration(STUDENT_3, '1');
});

context('Test Instructor team management', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All the "it" blocks in this PR should be combined. It is better to have one larger one, than a bunch of smaller ones. And since they are on the same page, just testing different items on that page, this is significantly better and faster, especially on windows machines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright, I combined it for the latest commit and did notice a speed increase. One downside I observed with combining them was that it was now harder to debug certain steps using the Cypress GUI, since I couldn't run each individual it block. But hopefully that is only an issue during debugging.

Comment on lines +138 to +163
context('Test Student team access', () => {
it('Should test student access to their new teams created in this test', () => {
[STUDENT_1, STUDENT_2, STUDENT_3].forEach((user) => {
cy.login(user);
cy.visit(['sample', 'gradeable', GRADEABLE, 'team']);
cy.get('[data-testid="your-team-header"]').should('exist');
});
});
});

context('Test Instructor team management, delete teams', () => {
it('Should successfully test the deletion of teams', () => {
cy.login('instructor');
cy.visit(['sample', 'gradeable', GRADEABLE, 'team']);
cy.on('window:confirm', () => true);

cy.get('[data-testid="delete-all-teams"]').click();

cy.get('[data-testid="popup-message"]')
.invoke('text')
.should('equal', 'Successfully deleted 2 teams. Skipped 36 teams with submissions. Skipped 0 teams with instructor-level users.');

cy.get('[data-testid="manage-teams-message"]', { timeout: 5000 })
.should('have.text', 'There are currently 36 existing teams for this gradeable. There are currently 3 students not yet on a team and 101 students on existing teams for this gradeable.');
});
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of different "context", these could be different "it" in the same "context" as the first set.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I ended up just making one it and putting them in there, and then we also don't need a context any more. Hopefully that is okay.

@roye2

roye2 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@IDzyre Thank you for the review. I have pushed a commit to address your requested changes, hopefully the structure of the test looks good now.

@roye2
roye2 requested a review from IDzyre July 21, 2026 15:20
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to In Review in Submitty Development Jul 21, 2026

// Verify the buttons for management of teams exist
cy.get('[data-testid="create-teams-from-registration-subsections"]')
.should('be.visible')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While not strictly necessary here, since if the element isn't visible, it shouldn't be able to be retreived by cy.get, I think this is fine since it is an assertion.

@IDzyre IDzyre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tests look better to me,

Comment on lines +30 to +32
cyAssertRegistration(STUDENT_1, 'NULL');
cyAssertRegistration(STUDENT_2, 'NULL');
cyAssertRegistration(STUDENT_3, 'NULL');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think you should assert anything in the before, since it is the setup. If you run half of the test, then stop and rerun it because you fixed something, this will fail. The before should be to set the state that the tests expect, even if they were in an unexpected state before .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright, that makes sense. I've just pushed a commit to remove the assertions both from the before() and from the after().

@github-project-automation github-project-automation Bot moved this from In Review to Work in Progress in Submitty Development Jul 21, 2026
@roye2
roye2 requested a review from IDzyre July 22, 2026 20:42
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to In Review in Submitty Development Jul 22, 2026
// ==========================================
// Test Instructor creation of teams
// ==========================================
cy.login('instructor');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since the instructor is already logged in, this isn't really necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out, I've just updated with a commit to remove it!

@IDzyre IDzyre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tests look better. There are a couple of things that are redundant, but won't hurt anything or cause significant delay in test time (maybe + seconds at the most).

@github-project-automation github-project-automation Bot moved this from In Review to Awaiting Maintainer Review in Submitty Development Jul 22, 2026
@bmcutler

Copy link
Copy Markdown
Member

@roye2 @IDzyre @williamjallen

There are errors about excessive/duplicate queries so we cannot merge this PR without either addressing that or making an exception.

@roye2

roye2 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@roye2 @IDzyre @williamjallen

There are errors about excessive/duplicate queries so we cannot merge this PR without either addressing that or making an exception.

@bmcutler thank you for pointing that out, I updated the PR to ignore the warnings on the 3 functions being tested since I believe we had previously discussed that in this case it was okay to ignore the warnings. Hopefully once tests pass it should be ready to go now.

@bmcutler
bmcutler merged commit 703786a into main Jul 23, 2026
27 of 28 checks passed
@bmcutler
bmcutler deleted the manage-teams-ui-cypress branch July 23, 2026 20:18
@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Done in Submitty Development Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants