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: fix test suite after combination of extended tests with new live quiz URLs #4369

Merged
merged 3 commits into from
Nov 11, 2024

Conversation

sjschlapbach
Copy link
Member

@sjschlapbach sjschlapbach commented Nov 11, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced end-to-end test coverage for course management and live quiz workflows, ensuring accurate validation of UI interactions and gamification features.
    • Updated placeholder URL in the URL form to reflect new quiz-related paths.
  • Bug Fixes

    • Updated UI element references to reflect new terminology, ensuring consistent functionality across tests.
  • Style

    • Minor CSS adjustments made, including the addition of a new line in components.css and the removal of trailing semicolons in utilities.css for cleaner syntax.
  • User Experience

    • Modified routing logic in the Session component to direct users to the new quiz cockpit URL structure.

Copy link

coderabbitai bot commented Nov 11, 2024

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request introduces modifications to the Cypress end-to-end test suite for course management and live quiz functionalities. Key changes include renaming UI selectors from "sessions" to "quizzes," reflecting updates in the application's structure. The test cases have been expanded to cover more scenarios, particularly around gamification features, with enhanced error handling and assertions. Additionally, minor changes were made to CSS files, including the removal of semicolons in utilities.css and the addition of a new line in components.css.

Changes

File Path Change Summary
cypress/cypress/e2e/E-course-workflow.cy.ts Renamed selectors from data-cy="questions" to data-cy="library" and updated navigation flow for quizzes. Expanded test cases for course creation, editing, and deletion with a focus on gamification features. Enhanced error handling and assertions.
cypress/cypress/e2e/F-live-quiz-workflow.cy.ts Renamed selectors from cy.get('[data-cy="sessions"]') to cy.get('[data-cy="quizzes"]'). Adjusted test cases for quiz management while maintaining existing logic.
packages/markdown/src/public/components.css Added a new line to the CSS file.
packages/markdown/src/public/utilities.css Removed trailing semicolons from various CSS property declarations across multiple classes.

Possibly related PRs

Suggested reviewers

  • rschlaefli: Suggested as a reviewer for the changes made in this pull request.

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

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
cypress/cypress/e2e/F-live-quiz-workflow.cy.ts (2)

Line range hint 554-558: Replace arbitrary wait times with proper assertions.

Using arbitrary wait times with cy.wait() can make tests flaky. Instead, wait for specific elements or states.

Consider replacing wait times with proper assertions:

-cy.wait(500)
-cy.get('[data-cy="next-block-timeline"]').click()
-cy.wait(500)
+cy.get('[data-cy="next-block-timeline"]').should('be.enabled').click()
+cy.get('[data-cy="block-status"]').should('contain', 'completed')

Also applies to: 701-704


Line range hint 644-645: Address TODO comment about element stacks migration.

The TODO comment indicates a pending migration to element stacks that should be addressed.

Would you like me to help create a GitHub issue to track the migration to element stacks? This would help ensure the task isn't forgotten and can be properly prioritized.

🛑 Comments failed to post (1)
cypress/cypress/e2e/F-live-quiz-workflow.cy.ts (1)

273-273: 🛠️ Refactor suggestion

Inconsistent selector naming convention.

While the main navigation selector has been updated from "sessions" to "quizzes", there are still several session-related selectors that should be updated for consistency:

  • session-block
  • start-session-
  • session-cockpit-
  • abort-session-cockpit

Consider updating these selectors to maintain consistency with the new "quiz" terminology:

-cy.contains('[data-cy="session-block"]', sessionName1)
+cy.contains('[data-cy="quiz-block"]', sessionName1)

-cy.get(`[data-cy="start-session-${sessionName1New}"]`)
+cy.get(`[data-cy="start-quiz-${sessionName1New}"]`)

-cy.get(`[data-cy="session-cockpit-${sessionName2}"]`)
+cy.get(`[data-cy="quiz-cockpit-${sessionName2}"]`)

-cy.get('[data-cy="abort-session-cockpit"]')
+cy.get('[data-cy="abort-quiz-cockpit"]')

Also applies to: 492-492, 526-526, 536-536, 571-571, 700-700, 712-712, 766-766, 791-791, 799-799

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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
apps/frontend-manage/src/components/sessions/Session.tsx (1)

Line range hint 195-204: Enhance accessibility for interactive elements.

While the component uses semantic HTML well, consider these accessibility improvements:

  1. Add aria-label to the start session button
  2. Ensure loading state is announced to screen readers
                   <Button
                     basic
                     disabled={startingQuiz}
+                    aria-label={t('manage.sessions.startSession')}
+                    aria-busy={startingQuiz}
                     onClick={async () => {
                       await startSession()
                       router.push(`quizzes/${session.id}/cockpit`)
                     }}
                     data={{ cy: `start-session-${session.name}` }}
                   >
🛑 Comments failed to post (1)
apps/frontend-manage/src/components/sessions/Session.tsx (1)

195-197: 🛠️ Refactor suggestion

Add error handling for session start and navigation.

The current implementation lacks error handling for both the session start mutation and navigation. Consider adding try-catch and user feedback:

-                    onClick={async () => {
-                      await startSession()
-                      router.push(`quizzes/${session.id}/cockpit`)
+                    onClick={async () => {
+                      try {
+                        await startSession()
+                        await router.push(`quizzes/${session.id}/cockpit`)
+                      } catch (error) {
+                        // Add error notification/toast here
+                        console.error('Failed to start session:', error)
+                      }
                     }}

Committable suggestion skipped: line range outside the PR's diff.

Copy link

sonarcloud bot commented Nov 11, 2024

Copy link

cypress bot commented Nov 11, 2024

klicker-uzh    Run #3645

Run Properties:  status check passed Passed #3645  •  git commit e0449dd607 ℹ️: Merge b097e50c3e37e12fa3f9e54ec92ce71de0708a67 into 71aeaa5115d4c1c99ca88d073d05...
Project klicker-uzh
Branch Review fix-test-suite
Run status status check passed Passed #3645
Run duration 11m 13s
Commit git commit e0449dd607 ℹ️: Merge b097e50c3e37e12fa3f9e54ec92ce71de0708a67 into 71aeaa5115d4c1c99ca88d073d05...
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 140
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant