Skip to content

Conversation

@adamNagy56
Copy link
Contributor

Summary:

Added comprehensive E2E test coverage for quiz editing and preview functionality in the Teacher app, including multi-override due date management.

Changes:

  • New Test: testQuizEditAndPreviewE2E() in QuizE2ETest.kt that verifies:
    • Quiz title and description editing
    • Quiz preview displays edited content correctly
    • Creating multiple due date overrides (Everyone else + individual student)
    • "Multiple Due Dates" text display on Quiz Details page
    • Removing due date overrides
  • New Page Object: QuizPreviewPage.kt with methods to assert preview content (title, description, loading state)
  • Enhanced Page Objects:
    • QuizDetailsPage.kt: Added WebView assertions for description changes and multiple due dates text
    • EditQuizDetailsPage.kt: Added indexed due date/time editing support and override removal functionality

Test Coverage:

  • Quiz content editing and persistence
  • WebView-based preview validation
  • Due date override CRUD operations with specific assignee verification

refs: MBL-16328
affects: Teacher
release note:

Checklist

  • Run E2E test suite

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Review Summary

This PR adds a comprehensive E2E test for quiz editing and preview functionality. The test coverage is excellent and follows good testing practices with detailed logging. However, there are a few concerns that should be addressed:

Issues Found

  • Thread.sleep() usage (apps/teacher/src/androidTest/java/com/instructure/teacher/ui/pages/classic/EditQuizDetailsPage.kt:274-275): Using Thread.sleep() in UI tests is an anti-pattern that can lead to flaky tests. Should use proper Espresso wait conditions or idling resources instead.

  • Undocumented production code changes (apps/teacher/src/main/java/com/instructure/teacher/fragments/QuizPreviewWebviewFragment.kt:110, 120): The PR contains production code fixes that are not mentioned in the description:

    • Setting arguments on the fragment (line 110) - fixes a potential bug with fragment recreation
    • Adding AUTHENTICATE = true (line 120) - changes authentication behavior for quiz previews

    These changes should be explicitly documented and potentially tested separately.

  • Test maintainability (apps/teacher/src/androidTest/java/com/instructure/teacher/ui/e2e/classic/QuizE2ETest.kt:203-220): Hardcoded date/time values scattered throughout the test. Consider extracting these into constants or well-named variables for better maintainability.

Positive Feedback

Excellent test structure: The test is well-organized with clear step-by-step logging using PREPARATION_TAG, STEP_TAG, and ASSERTION_TAG

Comprehensive coverage: Tests multiple aspects of quiz functionality including editing, previews, due dates, and overrides

Good assertion pattern: Each assertion is clear and tests specific expected behavior

Proper cleanup: The test includes removing overrides and verifying the state afterwards

Accessibility support: Added content descriptions for testing (due_date_$index, due_time_$index) which aids in UI test stability

New page object: The QuizPreviewPage is well-structured and follows the existing pattern

Recommendations

  1. Replace Thread.sleep() calls with proper Espresso synchronization
  2. Document the production code changes in the PR description
  3. Consider extracting magic numbers/dates into constants
  4. Add a comment explaining why AUTHENTICATE = true is needed for quiz previews

Overall, this is a solid addition to the test suite with comprehensive coverage. The main concerns are around test reliability (Thread.sleep) and documentation of production changes.

@JvmStatic val TITLE = "title"

fun newInstance(args: Bundle) = QuizPreviewWebviewFragment().apply {
arguments = args
Copy link

Choose a reason for hiding this comment

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

This change fixes a bug where the fragment's arguments weren't being set, which could cause issues when the fragment is recreated. However, this is a production code fix that should be called out explicitly in the PR description and potentially covered with a unit test.

Consider adding a test to verify that the arguments are properly set when creating a new instance of this fragment.

args.putString(URL, url)
args.putString(TITLE, title)
args.putBoolean(DARK_TOOLBAR, false)
args.putBoolean(AUTHENTICATE, true)
Copy link

Choose a reason for hiding this comment

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

Adding AUTHENTICATE = true changes the authentication behavior for quiz previews. This is another production code change that should be:

  1. Explicitly documented in the PR description
  2. Verified that it doesn't break existing functionality
  3. Potentially covered with a test to ensure authenticated previews work as expected

Was this missing authentication causing the preview to fail in the E2E test?

@github-actions
Copy link

github-actions bot commented Nov 20, 2025

📊 Code Coverage Report

✅ Student

  • PR Coverage: 42.49%
  • Master Coverage: 42.49%
  • Delta: +0.00%

✅ Teacher

  • PR Coverage: 25.44%
  • Master Coverage: 25.44%
  • Delta: +0.00%

✅ Pandautils

  • PR Coverage: 22.57%
  • Master Coverage: 22.57%
  • Delta: +0.00%

📈 Overall Average

  • PR Coverage: 30.17%
  • Master Coverage: 30.17%
  • Delta: +0.00%

@github-actions
Copy link

github-actions bot commented Nov 20, 2025

Teacher Install Page

@github-actions
Copy link

github-actions bot commented Nov 20, 2025

Student Install Page

refs: MBL-16328
affects: Teacher
release note:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants