Skip to content

[Testing:TAGrading] Cypress panel switcher tests#12835

Merged
bmcutler merged 22 commits into
Submitty:mainfrom
AtCloudDiwash:feature/cypress-ta-grading-panel-switcher-12816
Jun 19, 2026
Merged

[Testing:TAGrading] Cypress panel switcher tests#12835
bmcutler merged 22 commits into
Submitty:mainfrom
AtCloudDiwash:feature/cypress-ta-grading-panel-switcher-12816

Conversation

@AtCloudDiwash

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Closes #12816

Issue #11968 documented a regression where the TA grading panel switcher opened panels in incorrect positions in two-panel mode. This PR adds Cypress tests to prevent this regression from happening again in the future.

What is the New Behavior?

Cypress tests now verify that each panel layout option displays the correct dropdown options when a panel button is clicked.
For example, in two-panel mode, panels should open as "left" or "right", not "bottom left" or "bottom right".

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

  1. Run the Cypress test suite
  2. Navigate to Cypress-Gradeable folder
  3. Run ta_grading_panel_switcher.spec.js
  4. Verify all layout options show correct panel position options

Automated Testing & Documentation

Cypress end-to-end tests added in:
cypress/e2e/Cypress-Gradeable/ta_grading_panel_switcher.spec.js

Other information

No breaking changes. No migrations required.

@AtCloudDiwash
AtCloudDiwash force-pushed the feature/cypress-ta-grading-panel-switcher-12816 branch from 4591371 to 9d03446 Compare May 4, 2026 07:24
@codecov

codecov Bot commented May 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.64%. Comparing base (7d7fb78) to head (51b7add).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #12835      +/-   ##
============================================
- Coverage     21.64%   21.64%   -0.01%     
  Complexity     9861     9861              
============================================
  Files           268      268              
  Lines         36920    36921       +1     
  Branches        495      495              
============================================
  Hits           7990     7990              
- Misses        28439    28440       +1     
  Partials        491      491              
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.01% <0.00%> (-0.01%) ⬇️
migrator 100.00% <ø> (ø)
php 20.70% <ø> (ø)
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

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.

@AtCloudDiwash

Copy link
Copy Markdown
Contributor Author

Hi, could someone please review why the CI check failed? I’m having trouble figuring out the cause.

@AtCloudDiwash

Copy link
Copy Markdown
Contributor Author

I checked the CI failures but couldnot fully understand why it happened. Could someone take a look and suggest me a fix or assure me that some CI checks might be flaky. Thank you.

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.

The selectors be data-testids if they can, instead of ids or classes. Feel free to add them to the relevant HTML/Twig elements.

@AtCloudDiwash AtCloudDiwash Jun 2, 2026

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.

@IDzyre thank you for the feedback and noticing my PR. I made the requested changes. Kindly, let me know if there's a room for improvement. Thank you.

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 we should be ignoring exceptions. Is there an element that appears that you can test for the existence of, or something like that?

Ignoring exceptions should be the LAST thing you do, and even then it's not something we want to do.

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 could add a WAIT delay between each panel switch and let the element load first. Most likely this is why we might be getting errors. should('be.visible') is also not working as expected.

More Importantly, this issue is only being experiencing in CI pipeline not in my local testing environment.

@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Jun 2, 2026
@IDzyre

IDzyre commented Jun 3, 2026

Copy link
Copy Markdown
Member

See failing TA grading test.

@GarvitKhandelwal31

Copy link
Copy Markdown
Contributor

Hey @AtCloudDiwash, looks like the TA Grading cypress is still failing

@AtCloudDiwash

Copy link
Copy Markdown
Contributor Author

@GarvitKhandelwal31, it’s surprising how the code works locally but fails CI tests when I push. Initially I thought it’s twig elements but it could be some other issue.

@AtCloudDiwash

Copy link
Copy Markdown
Contributor Author

@GarvitKhandelwal31, could you please guide me through this issue.
image

I have drawn this image from github artifacts. What could this test error possibly mean. Surprisingly, the test works on my machine but fails at CI. I believe I should write test based on the remote machine ? Moreover I would like to know more about ResizeObserver exception.

@AtCloudDiwash

Copy link
Copy Markdown
Contributor Author

@IDzyre . I added an exception in the spec file. The test passes. However, I'm not sure if it is recommended to do. I believe the failing CI was originating from constant change in the UI (due to the nature of test).

@AtCloudDiwash
AtCloudDiwash requested a review from IDzyre June 9, 2026 18:15
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to In Review in Submitty Development Jun 9, 2026
@IDzyre

IDzyre commented Jun 9, 2026

Copy link
Copy Markdown
Member

@IDzyre . I added an exception in the spec file. The test passes. However, I'm not sure if it is recommended to do. I believe the failing CI was originating from constant change in the UI (due to the nature of test).

After looking this up, it seems like catching the exception in Cypress is the common. That being said, it looks like there are ways of fixing this without ignoring exceptions. See if wrapping "adjustGradingPanelHeader" with requestAnimationFrame works. If it does, I t const resizeObserver = new ResizeObserver(() => {
requestAnimationFrame(() => adjustGradingPanelHeader());
});hink we should go with that. If it doesn't , then I am okay with leaving the exception in.

@AtCloudDiwash

Copy link
Copy Markdown
Contributor Author

@IDzyre . I added an exception in the spec file. The test passes. However, I'm not sure if it is recommended to do. I believe the failing CI was originating from constant change in the UI (due to the nature of test).

After looking this up, it seems like catching the exception in Cypress is the common. That being said, it looks like there are ways of fixing this without ignoring exceptions. See if wrapping "adjustGradingPanelHeader" with requestAnimationFrame works. If it does, I t const resizeObserver = new ResizeObserver(() => { requestAnimationFrame(() => adjustGradingPanelHeader()); });hink we should go with that. If it doesn't , then I am okay with leaving the exception in.

@IDzyre, the requested change is done. The test passed.

cy.log(`Testing layout: ${layout.name}`);

cy.get('[data-testid="panel-selector-toggle"]')
.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.

It is not needed to have a "be visible" assertion before doing actions with an element, as the .click() already waits for it to be visible before clicking on it.

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.

After these are changed, I will approve (assuming tests continue to pass). Good work on this.

panels.forEach((panel) => {
cy.log(`Testing panel: ${panel.name}`);

cy.get(panel.button).should('be.visible').click();

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.

Same comment about be.visible

@github-project-automation github-project-automation Bot moved this from In Review to Work in Progress in Submitty Development Jun 11, 2026
@AtCloudDiwash
AtCloudDiwash requested a review from IDzyre June 14, 2026 05:03
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to In Review in Submitty Development Jun 14, 2026

@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.

New Cypress tests look good, using testids, and minimal code duplication. I will wait to merge this for a little bit, until I can be sure all Cypress tests run on main.

@github-project-automation github-project-automation Bot moved this from In Review to Awaiting Maintainer Review in Submitty Development Jun 18, 2026
@bmcutler
bmcutler merged commit 145aa2e into Submitty:main Jun 19, 2026
25 of 27 checks passed
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.

Write Cypress tests for TA grading panel switcher

4 participants