[Testing:TAGrading] Cypress panel switcher tests#12835
Conversation
4591371 to
9d03446
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Hi, could someone please review why the CI check failed? I’m having trouble figuring out the cause. |
|
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. |
There was a problem hiding this comment.
The selectors be data-testids if they can, instead of ids or classes. Feel free to add them to the relevant HTML/Twig elements.
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
See failing TA grading test. |
|
Hey @AtCloudDiwash, looks like the TA Grading cypress is still failing |
|
@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. |
|
@GarvitKhandelwal31, could you please guide me through this issue. 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. |
|
@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(() => { |
@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') |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
IDzyre
left a comment
There was a problem hiding this comment.
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.

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