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

chore(cypress): extend test suite to cover case study elements in practice quizzes #4488

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

sjschlapbach
Copy link
Member

@sjschlapbach sjschlapbach commented Feb 1, 2025

Summary by CodeRabbit

  • New Features
    • Case study content is now supported across group activities, live quizzes, microlearning, and practice quizzes.
  • Tests
    • Enhanced test scenarios ensure smooth creation and verification of case study questions within quizzes.
  • Style
    • Updated layout improvements in evaluation components offer better responsiveness and visual clarity.

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Feb 1, 2025
Copy link

coderabbitai bot commented Feb 1, 2025

📝 Walkthrough

Walkthrough

This PR extends support for case study elements across the application by adding ElementType.CaseStudy to the accepted types in various activity creation components. It updates frontend wizard components, Cypress test suites, and related command interfaces to recognize and handle case study content, while also restructuring quiz fixture data and making minor layout adjustments in the evaluation component.

Changes

File(s) Change Summary
apps/frontend-manage/...Wizard.tsx Added ElementType.CaseStudy to the acceptedTypes arrays in the group activity, live quiz, microlearning, and practice quiz wizards.
cypress/.../H-practice-quiz-workflow.cy.ts Renamed question collection properties, introduced a case study question creation process (via cy.createQuestionCS), added computeCaseStudySlidedValue, and updated answer verification logic.
cypress/.../H-practice-quiz.json Restructured quiz data by adding a new top-level "collection", removing the nested "collection" from "SE", and introducing a new "CS" section for case study questions.
cypress/.../support/commands.ts Updated multiple command signatures to include an optional explanation parameter and added a new createQuestionCS command to support case study questions.
packages/shared-components/.../CSEvaluation.tsx Modified CSS classes in <div> elements (added w-full and min-w-max) to adjust layout without altering component logic.

Possibly related PRs

Suggested labels

enhancement, size:L

Suggested reviewers

  • rschlaefli
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

sonarqubecloud bot commented Feb 1, 2025

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
cypress/cypress/e2e/H-practice-quiz-workflow.cy.ts (1)

304-304: Use a named constant for substring length.
While this is functional, consider extracting 20 into a constant to clarify intent.

- this.data.questions.CS.title.substring(0, 20)
+ this.data.questions.CS.title.substring(0, MAX_DISPLAY_LENGTH)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c628725 and f83e197.

📒 Files selected for processing (8)
  • apps/frontend-manage/src/components/activities/creation/groupActivity/GroupActivityWizard.tsx (1 hunks)
  • apps/frontend-manage/src/components/activities/creation/liveQuiz/LiveQuizQuestionsStep.tsx (1 hunks)
  • apps/frontend-manage/src/components/activities/creation/microLearning/MicroLearningWizard.tsx (1 hunks)
  • apps/frontend-manage/src/components/activities/creation/practiceQuiz/PracticeQuizWizard.tsx (1 hunks)
  • cypress/cypress/e2e/H-practice-quiz-workflow.cy.ts (14 hunks)
  • cypress/cypress/fixtures/H-practice-quiz.json (1 hunks)
  • cypress/cypress/support/commands.ts (16 hunks)
  • packages/shared-components/src/evaluation/CSEvaluation.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/shared-components/src/evaluation/CSEvaluation.tsx
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: format
  • GitHub Check: SonarCloud
  • GitHub Check: build
  • GitHub Check: cypress-run
  • GitHub Check: check
  • GitHub Check: test
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (27)
cypress/cypress/e2e/H-practice-quiz-workflow.cy.ts (19)

76-78: Ensure the answer collection creation references are correct.
Everything looks good here.


89-90: Check collection usage for selection question.
The references to the collection name and filtered correct answers appear consistent.


94-107: Case Study question creation.
The addition of cy.createQuestionCS correctly sets up the new case study question type.


188-188: Include Case Study in quiz stack.
Adding the new question to the stack is properly handled.


307-308: Consistent substring usage for Flashcard title.
No issues found with these lines.


320-323: Validate drag-and-drop for SC1 question.
The logic to drag and drop elements into the correct stack looks correct.


491-491: Check duplication of Case Study question.
Ensures the new Case Study type is included in duplication tests.


494-494: Confirm Flashcard substring on duplication.
Looks consistent and well-integrated.


497-497: Confirm Content substring on duplication.
No issues found here.


498-498: Check closing parenthesis.
Syntax is correct.


499-499: Continue duplication logic.
All good on this line.


523-535: Review of computeCaseStudySlidedValue.
The logic for handling midpoints, steps, and clamping is correct.


636-639: Check pointer-events for SE question fields.
Verifying the selected options become non-interactive after submission is valid.

Also applies to: 642-642


646-709: Implement Case Study question submission flow.
Thorough coverage of sliding controls and result verification. Nicely done.


712-712: Practice quiz progress navigation.
Index-based navigation to previous questions works correctly.


844-844: Partial submission of SE question.
This test properly checks partial submission features for selection questions.


854-916: Partial answers for Case Study question.
Excellent approach verifying full coverage of partial slider interactions.


1216-1216: Include Case Study question in cleanup list.
Good to see the question is removed as part of the final cleanup.


1230-1230: Delete the created answer collection.
Logic fits the final cleanup phase.

apps/frontend-manage/src/components/activities/creation/liveQuiz/LiveQuizQuestionsStep.tsx (1)

24-24: Add ElementType.CaseStudy to accepted types.
This aligns with the new case study functionality across the app.

apps/frontend-manage/src/components/activities/creation/practiceQuiz/PracticeQuizWizard.tsx (1)

54-54: Expand accepted types with ElementType.CaseStudy.
Ensures the practice quiz wizard accommodates case study questions.

apps/frontend-manage/src/components/activities/creation/microLearning/MicroLearningWizard.tsx (1)

53-53: LGTM!

The addition of ElementType.CaseStudy to the acceptedTypes array is consistent with the PR objective to extend support for case study elements.

apps/frontend-manage/src/components/activities/creation/groupActivity/GroupActivityWizard.tsx (1)

56-56: LGTM!

The addition of ElementType.CaseStudy to the acceptedTypes array is consistent with the PR objective to extend support for case study elements.

cypress/cypress/support/commands.ts (2)

207-207: LGTM! Consistent addition of explanation parameter.

The addition of the optional explanation parameter to question creation commands is well-implemented and follows a consistent pattern.

Also applies to: 214-234


662-836: LGTM! Well-structured case study command implementation.

The new createQuestionCS command is well-implemented with:

  • Clear interface definition
  • Comprehensive validation steps
  • Proper error handling
  • Good verification of entered data
cypress/cypress/fixtures/H-practice-quiz.json (2)

63-73: LGTM! Good restructuring of collection data.

Moving the collection data to the root level improves reusability and reduces duplication.


80-241: LGTM! Comprehensive case study test data.

The new CS section provides:

  • Well-structured test data
  • Good coverage of all case study features
  • Diverse test values for thorough testing

Copy link

cypress bot commented Feb 1, 2025

klicker-uzh    Run #4218

Run Properties:  status check passed Passed #4218  •  git commit 7c36913cfa ℹ️: Merge f83e197f7ef06dba69075b695d7eaeba9fa1d973 into c6287259828c97774c59a900d9db...
Project klicker-uzh
Branch Review testing-case-study-pq
Run status status check passed Passed #4218
Run duration 22m 05s
Commit git commit 7c36913cfa ℹ️: Merge f83e197f7ef06dba69075b695d7eaeba9fa1d973 into c6287259828c97774c59a900d9db...
Committer Julius Schlapbach
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 325
View all changes introduced in this branch ↗︎

@sjschlapbach sjschlapbach merged commit 1600ef2 into v3-case-study Feb 1, 2025
14 of 15 checks passed
@sjschlapbach sjschlapbach deleted the testing-case-study-pq branch February 1, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Development

Successfully merging this pull request may close these issues.

1 participant