Skip to content

๐ŸŽ“ Teacher-friendly quiz system with offline ZIP packages, cross-browser image support & Unity integration. No internet required!

Notifications You must be signed in to change notification settings

anbanm/quiz-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

40 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ“ Quiz System - Teacher-Friendly Quiz Creator

Version License Browser Support Offline
Tests Playwright Rich Text

Create professional quizzes with rich text formulas โ€ข PDF export with templates โ€ข 250 automated tests

Perfect for teachers who want a simple, reliable quiz tool that works anywhere

๐Ÿ“ฆ Download Latest Release โ€ข ๐ŸŽฌ See Demo โ€ข ๐Ÿš€ Get Started โ€ข ๐Ÿค– Run Tests


โœจ Why Teachers Love This Quiz System

  • ๐Ÿงฎ Rich Text & Formulas: Chemical formulas (Hโ‚‚O), physics equations (E=mcยฒ), mathematical expressions
  • ๐ŸŽจ Visual Formatting: Bold, italic, underline, subscript, superscript with color-coded editors
  • ๐ŸŒ Works Everywhere: Safari, Chrome, Firefox, Edge - even without internet
  • ๐Ÿ“ธ Image Support: Add pictures to questions with live preview
  • ๐Ÿ“ฆ ZIP Packages: Share complete quizzes easily - students just upload and go
  • ๐ŸŽฏ Educational Design: Teacher-friendly interface with clear "Quiz" terminology
  • โšก Zero Setup: Download, open in browser, start creating
  • ๐Ÿ“„ PDF Export: 3 professional templates (Student Quiz, Answer Key, Practice Sheet)
  • ๐Ÿ”’ Privacy First: All data stays on your device, no accounts needed
  • ๐Ÿค– 100% Test Coverage: 250 automated tests across all browsers and mobile devices
  • ๐Ÿ“ฑ Mobile Ready: Responsive design tested on iPhone, Android, and iPad

A comprehensive quiz generation and testing system with Unity integration for educational applications.

๐Ÿ—๏ธ Modular Architecture (v1.5.0)

The quiz system now features a completely modular architecture with 73% code reduction and enhanced maintainability:

๐Ÿ“ฆ Module Overview

  • ๐Ÿ”ง quiz-loader.js (189 lines) - Module system with validation and dependency checking
  • โš™๏ธ quiz-utils.js (225 lines) - Utility functions for format conversion and calculations
  • ๐Ÿ“ quiz-richtext.js (367 lines) - Quill.js integration for mathematical formulas
  • ๐Ÿ’พ quiz-data.js (722 lines) - Data management, import/export, and test library
  • ๐ŸŽจ quiz-ui.js (646 lines) - UI components, dialogs, and rendering
  • โ“ quiz-questions.js (374 lines) - Question CRUD operations and management
  • ๐Ÿ“„ quiz-pdf.js (821 lines) - PDF export with 3 professional templates

๐ŸŒ Global Namespace Pattern

window.QuizModules = {
    Loader: { registerModule, validateAPI, initializeModules },
    Utils: { deltaToHtml, convertAnswerFormats, getDifficultyColor },
    RichText: { initializeQuillEditor, getQuestionContent },
    Data: { loadTestLibrary, saveTestLibrary, generateJSON },
    UI: { renderQuestions, showSuccessDialog, toggleSidebar },
    Questions: { addOrUpdateQuestion, editQuestion, deleteQuestion },
    PDF: { generateStudentQuiz, generateAnswerKey, generatePracticeSheet }
};

โœ… Benefits Achieved

  • Maintainability: Clear separation of concerns across focused modules
  • Testability: Each module can be tested independently with isolated APIs
  • Reusability: Modules can be used in other projects following the same patterns
  • Debuggability: Module-specific logging and error handling
  • Offline-First: Global namespace ensures compatibility without ES6 imports

๐Ÿ“ธ Screenshots

Coming Soon! We're preparing beautiful screenshots to show you the teacher-friendly interface in action.

For now, try it yourself: Download the files and open src/frontend/quizGenerator.html in your browser!

Overview

This project consists of two main components:

  • Quiz Generator: A web-based tool for creating and managing quiz questions
  • Quiz Test Runner: A web-based interface for taking quizzes and reporting results

Features

Quiz Generator (quizGenerator.html)

  • โœ… Rich Text Editor with Quill.js integration for mathematical formulas
  • โœ… Chemical Formulas: Hโ‚‚O, COโ‚‚, NaCl with proper subscript formatting
  • โœ… Physics Equations: E=mcยฒ, F=ma with superscript support
  • โœ… Color-Coded Options: Each answer (A-F) has themed toolbar (green, blue, orange, red, purple, cyan)
  • โœ… Multiple Question Types: Multiple choice (2-6 options) and True/False
  • โœ… Dedicated Quiz Creation: "Start Fresh Quiz" button always available
  • โœ… Image support with live preview and smart file handling
  • โœ… Set difficulty levels (Easy, Medium, Hard) with visual indicators
  • โœ… Assign point values to questions (1-10 points)
  • โœ… Category organization for subject-based quizzes
  • โœ… PDF Export: 3 professional templates with rich text preservation
  • โœ… ZIP package export with images in separate folder (recommended)
  • โœ… Triple format storage: Plain text, HTML, and Delta for maximum compatibility
  • โœ… Load and edit existing quiz data with proper rich text preservation
  • โœ… Offline functionality - works without internet connection

Quiz Test Runner (WebTest.html)

  • โœ… Rich Text Display: Mathematical formulas and formatting preserved perfectly
  • โœ… Chemical Formulas: Hโ‚‚O, COโ‚‚ rendered with proper subscripts
  • โœ… Physics Equations: E=mcยฒ displayed with correct superscripts
  • โœ… Universal browser support - Safari, Chrome, Firefox, Edge
  • โœ… ZIP package upload with automatic extraction (all browsers)
  • โœ… JSON file upload for embedded image and rich text quizzes
  • โœ… Smart image loading with extension matching (.jpg/.jpeg support)
  • โœ… Display questions with properly resolved images and rich formatting
  • โœ… Multiple choice answer collection with letter-based answers
  • โœ… Complete compatibility with old and new quiz formats
  • โœ… Score calculation and detailed reporting
  • โœ… Unity integration via messaging
  • โœ… Debug logging for troubleshooting

Unity Integration

  • โœ… WebView integration with UniWebView
  • โœ… JSON data communication
  • โœ… Coin/points system integration
  • โœ… Result tracking and display

Project Structure

quiz-system/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ frontend/          # Web-based quiz tools
โ”‚   โ”‚   โ”œโ”€โ”€ quizGenerator.html      # Main quiz creation interface
โ”‚   โ”‚   โ”œโ”€โ”€ WebTest.html           # Student quiz testing interface
โ”‚   โ”‚   โ”œโ”€โ”€ css/                   # Stylesheets
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ quiz-generator.css
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ quill-custom.css
โ”‚   โ”‚   โ”œโ”€โ”€ lib/                   # Third-party libraries
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ quill.min.js       # Rich text editor
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ quill.snow.css
โ”‚   โ”‚   โ”œโ”€โ”€ jszip.min.js          # ZIP handling (offline)
โ”‚   โ”‚   โ””โ”€โ”€ js/                    # JavaScript modules
โ”‚   โ”‚       โ”œโ”€โ”€ quiz-generator.js  # Main application (512 lines)
โ”‚   โ”‚       โ””โ”€โ”€ modules/           # Modular architecture (v1.4.0)
โ”‚   โ”‚           โ”œโ”€โ”€ quiz-loader.js     # Module system (189 lines)
โ”‚   โ”‚           โ”œโ”€โ”€ quiz-utils.js      # Utilities (225 lines)
โ”‚   โ”‚           โ”œโ”€โ”€ quiz-richtext.js   # Rich text (367 lines)
โ”‚   โ”‚           โ”œโ”€โ”€ quiz-data.js       # Data management (722 lines)
โ”‚   โ”‚           โ”œโ”€โ”€ quiz-ui.js         # UI components (646 lines)
โ”‚   โ”‚           โ”œโ”€โ”€ quiz-questions.js  # Question management (374 lines)
โ”‚   โ”‚           โ””โ”€โ”€ quiz-pdf.js        # PDF export templates (821 lines)
โ”‚   โ””โ”€โ”€ unity/             # Unity C# scripts
โ”‚       โ”œโ”€โ”€ SampleWebView.cs
โ”‚       โ””โ”€โ”€ SampleWebViewSim.cs
โ”œโ”€โ”€ tests/                 # Revolutionary test architecture with 250 tests
โ”‚   โ”œโ”€โ”€ page-objects/      # Page Object Model with UI mapping
โ”‚   โ”‚   โ”œโ”€โ”€ QuizGeneratorPage.js
โ”‚   โ”‚   โ””โ”€โ”€ WebTestPage.js
โ”‚   โ”œโ”€โ”€ ui-mapping.json    # UI element mapping abstraction
โ”‚   โ”œโ”€โ”€ quiz-generator-clean.spec.js # Clean architecture tests
โ”‚   โ”œโ”€โ”€ quiz-generator.spec.js       # Rich text integration tests
โ”‚   โ”œโ”€โ”€ quiz-test-runner.spec.js     # Student interface tests
โ”‚   โ”œโ”€โ”€ question-reordering.spec.js  # Question management tests
โ”‚   โ”œโ”€โ”€ mobile-responsiveness.spec.js # Mobile compatibility tests
โ”‚   โ”œโ”€โ”€ pdf-export.spec.js          # PDF export functionality tests
โ”‚   โ””โ”€โ”€ test-data/         # Sample images and quiz data
โ”œโ”€โ”€ docs/                  # Documentation
โ”œโ”€โ”€ examples/              # Sample quiz data
โ”œโ”€โ”€ playwright.config.js   # Test configuration
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ CLAUDE.md             # Development context and recovery instructions
โ””โ”€โ”€ README.md

๐Ÿš€ Quick Start

๐Ÿ“ฅ Download & Setup (30 seconds)

  1. Download: Click the green "Code" button above โ†’ "Download ZIP"
  2. Extract: Unzip the downloaded file anywhere on your computer
  3. Open: Double-click src/frontend/quizGenerator.html
  4. Start Creating: Your browser opens with the quiz generator ready to go!

That's it! No installation, no accounts, no internet required.

Creating a Quiz (Teacher)

  1. Open src/frontend/quizGenerator.html in a web browser
  2. Click "โœจ Create New Quiz"
  3. Add questions with the teacher-friendly interface:
    • Write clear questions
    • Add images if needed (with live preview)
    • Set A/B/C/D answer options
    • Choose difficulty and points
  4. Export Options:
    • ๐Ÿ“„ Export to PDF (3 professional templates)
    • ๐Ÿ“ฆ Download ZIP Package (recommended for sharing)
    • ๐Ÿ“„ Download JSON Only (embedded format)
  5. Share files with students

Taking a Quiz (Student)

  1. Open src/frontend/WebTest.html in a web browser
  2. Toggle to "Local File Mode"
  3. Upload ZIP Package (easiest - works on all browsers):
    • Select the ZIP file from your teacher
    • Images and quiz load automatically
  4. OR Upload JSON File (if using embedded format)
  5. Answer questions and submit for results

Advanced: Folder Method (Chrome/Edge only)

  • Extract ZIP package to a folder
  • Use the folder picker in WebTest
  • Images load from the extracted folder

Unity Integration

  1. Import the C# scripts into your Unity project
  2. Set up UniWebView component
  3. Configure the WebView to load your quiz HTML files
  4. Handle results in your game logic

๐Ÿค– Testing

Our quiz system includes comprehensive automated testing to ensure reliability across all platforms.

Test Coverage - TRUE 100% ACHIEVED! ๐ŸŽ‰

  • 250 total tests across 5 different browsers and devices - ALL PASSING
  • 50 tests per platform: Each browser/device runs complete test suite
  • Rich Text Testing: Mathematical formulas, chemical equations, formatting preservation
  • UI Architecture Testing: Page Object Model with UI mapping abstraction layer
  • End-to-End Testing: Complete workflow from quiz creation to student testing

Tested Platforms (50/50 tests each โœ…)

  • Desktop Browsers: Chromium โœ…, Firefox โœ…, WebKit (Safari) โœ…
  • Mobile Devices: Mobile Chrome โœ…, Mobile Safari โœ…
  • Rich Text Features: Hโ‚‚O, E=mcยฒ, bold/italic/underline formatting tested
  • Cross-Platform Formulas: Mathematical expressions preserved across all platforms

Running Tests

# Install dependencies (first time only)
npm install

# Run all 250 tests (TRUE 100% passing!)
npm test

# Clean Architecture Tests (Modern Page Object Model)
npx playwright test tests/quiz-generator-clean.spec.js

# Specific test suites (ALL 100% PASSING โœ…)
npx playwright test tests/question-reordering.spec.js   # Question management
npx playwright test tests/quiz-generator.spec.js        # Rich text integration  
npx playwright test tests/mobile-responsiveness.spec.js # Mobile compatibility
npx playwright test tests/quiz-test-runner.spec.js      # Student interface
npx playwright test tests/pdf-export.spec.js            # PDF export functionality

# Interactive "bot vision" testing
npx playwright test --ui

# View test reports
npx playwright show-report

Interactive Testing Experience

Run npx playwright test --ui to experience "bot vision" testing:

  • โœจ Watch tests execute in real-time with rich text editors
  • ๐ŸŽฎ Use timeline scrubber to replay mathematical formula input
  • ๐Ÿ” Inspect Quill.js rich text elements the bot interacts with
  • ๐Ÿ“ฑ Switch between different devices and browsers
  • ๐Ÿงฎ See chemical formulas (Hโ‚‚O) and physics equations (E=mcยฒ) being tested
  • ๐ŸŽจ Watch color-coded option editors in action

Dependencies

  • Web: Modern web browser with ES6 support (works completely offline)
  • Unity: Unity 2021.3+ with UniWebView package
  • Testing: Node.js 16+ and npm (for running automated tests)
  • Included Libraries:
    • Quill.js (bundled locally for rich text editing with mathematical formulas)
    • JSZip 3.10.1 (bundled locally for offline ZIP package support)
    • Playwright 1.54.2+ (automated testing framework with 210 tests)

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run the test suite: npm test (all 250 tests must pass)
  5. Test thoroughly across different browsers
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Submit a pull request

Development Guidelines

  • All new features must include comprehensive Playwright tests
  • Maintain cross-browser compatibility (Chrome, Firefox, Safari, Edge)
  • Ensure mobile responsiveness with proper touch targets (44px minimum)
  • Follow the existing teacher-friendly design patterns

Changelog

v1.5.0 (2025-08-03) - ๐Ÿ“„ Professional PDF Export System

  • โœ… 3 PDF Templates: Student Quiz, Teacher Answer Key, Practice Worksheet
  • โœ… Rich Text Preservation: Superscript/subscript formulas maintained in PDF (Hโ‚‚O, E=mcยฒ)
  • โœ… Smart Image Integration: Automatic scaling with aspect ratio preservation (max 100mm x 60mm)
  • โœ… Professional A4 Layout: Proper margins, typography, and page headers/footers
  • โœ… Offline PDF Generation: Complete jsPDF integration for tablet/offline compatibility
  • โœ… Comprehensive Testing: 40 new PDF export tests (250 total tests, 100% passing)
  • โœ… Template Selection Dialog: User-friendly interface with template previews
  • โœ… Multiple Export Formats: Student bubbles, filled answer keys, blank practice sheets
  • โœ… Mathematical Formula Support: Delta and HTML format processing in PDFs
  • โœ… Modular Architecture: New quiz-pdf.js module (821 lines) with clean separation

v1.4.0 (2025-08-03) - ๐Ÿ—๏ธ JavaScript Modular Refactoring

  • โœ… Modular Architecture: Complete refactoring of 71KB monolithic file into 6 maintainable modules
  • โœ… 73% Code Reduction: Main file reduced from 1,917 lines to 512 lines
  • โœ… Global Namespace Pattern: Offline-first compatibility with window.QuizModules.* structure
  • โœ… Module System: Comprehensive loader with validation, dependency checking, and initialization
  • โœ… Separation of Concerns: Clear module boundaries for utilities, rich text, data, UI, and questions
  • โœ… 100% Functionality Preserved: All existing features work identically with modular structure
  • โœ… Enhanced Maintainability: Isolated responsibilities make debugging and feature additions easier
  • โœ… Testability: Each module has clear APIs and can be tested independently
  • โœ… Backward Compatibility: Existing quiz files continue to work without modification
  • โœ… Bug Fixes: Resolved test library loading, focus issues, and global function accessibility

v1.3.1 (2025-08-02) - ๐Ÿงฎ Rich Text Revolution with TRUE 100% Test Coverage

  • โœ… Rich Text Editor Integration: Complete Quill.js integration with mathematical formula support
  • โœ… Chemical Formulas: Hโ‚‚O, COโ‚‚, NaCl with proper subscript formatting throughout
  • โœ… Physics Equations: E=mcยฒ, F=ma with superscript support for scientific notation
  • โœ… Color-Coded Interfaces: Each answer option (A-F) has themed toolbar and editor
  • โœ… Multiple Question Types: Support for 2-6 multiple choice options and True/False
  • โœ… Quiz Terminology Standardization: Consistent "Quiz" usage throughout interface
  • โœ… Dedicated Quiz Creation: "Start Fresh Quiz" button always available when editing
  • โœ… Revolutionary Test Architecture: UI mapping abstraction layer with Page Object Model
  • โœ… TRUE 100% Test Coverage: 210/210 tests passing across all browsers and platforms
  • โœ… Triple Format Storage: Plain text, HTML, and Delta formats for maximum compatibility
  • โœ… Cross-Platform Formula Preservation: Mathematical expressions maintained from creation to testing
  • โœ… End-to-End Rich Text Testing: Complete workflow validation with formula preservation
  • โœ… Backward Compatibility: Existing quizzes work seamlessly with new rich text features

v1.3.0 (2025-08-02) - ๐Ÿ”ง Major Codebase Refactoring & Enhanced UX

  • โœ… Major Code Refactoring: Separated HTML, CSS, and JavaScript into dedicated files
  • โœ… 87% File Size Reduction: HTML file reduced from 1,915 lines to 244 lines
  • โœ… Improved Maintainability: Clean file structure with css/ and js/ directories
  • โœ… Test Library with Sidebar: Left sidebar menu for managing quiz collections
  • โœ… Built-in Sample Tests: Pre-loaded math and science quizzes for immediate use
  • โœ… Smart JSON Format Conversion: Automatic handling of different option formats
  • โœ… Enhanced Button Behavior: Context-aware "Create New Quiz" vs "Add New Question"
  • โœ… Test Metadata Display: Question count, total points, difficulty overview
  • โœ… Duplicate Test Detection: Smart handling of test library imports
  • โœ… Better Code Organization: Separation of concerns following web development best practices
  • โœ… Future-Ready Architecture: Easier maintenance and feature additions

v1.2.0 (2025-08-01) - ๐Ÿค– Comprehensive Testing Release

  • โœ… Complete Playwright Test Suite: 108 automated tests across 6 browsers/devices
  • โœ… Real Image Testing: Sample math formulas, diagrams, and visual elements
  • โœ… Cross-Browser Testing: Chromium, Firefox, WebKit compatibility validation
  • โœ… Mobile Device Testing: iPhone 12, Pixel 5, iPad Pro responsive testing
  • โœ… Interactive Bot Vision: npm run test:ui for real-time test watching
  • โœ… Teacher Interface Testing: Quiz creation, image upload, JSON generation (36 tests)
  • โœ… Student Interface Testing: Quiz taking, image display, answer submission (36 tests)
  • โœ… Mobile Responsiveness Testing: Touch targets, image sizing, layout validation (36 tests)
  • โœ… Sample Test Data: Comprehensive test images and quiz examples
  • โœ… Professional Test Infrastructure: Playwright configuration with cross-platform support

v1.1.0 (2025-07-27)

  • โœ… ZIP Package Support: Upload and extract ZIP files in any browser
  • โœ… Teacher-Friendly Interface: Professional educational design with emojis and clear language
  • โœ… Offline JSZip Library: Complete offline functionality without internet dependency
  • โœ… Smart Image Handling: Extension matching, data URL support, live previews
  • โœ… Enhanced JSON Format: Labeled options (A/B/C/D) with letter-based correct answers
  • โœ… Cross-Browser Compatibility: Full support for Safari, Firefox, Chrome, Edge
  • โœ… Compact Question Cards: Horizontal layout with image thumbnails
  • โœ… Better Error Handling: Debug logging and improved user feedback
  • โœ… Backward Compatibility: Supports both old and new quiz formats

v1.0.0 (2025-07-27)

  • โœ… Initial release with basic quiz generation and testing
  • โœ… Unity integration with UniWebView
  • โœ… JSON export/import functionality
  • โœ… Basic image support

Future Improvements

Modular Enhancements (v1.5.0+)

  • Module Hot-Reloading: Development mode with live module updates
  • Plugin System: Third-party modules with standardized APIs
  • Module Lazy Loading: Load modules on-demand for better performance
  • Module Configuration: Per-module settings and customization
  • Inter-Module Communication: Event bus for decoupled module interaction

Educational Features

  • Quick Assessment Mode: Rapid quiz taking with instant feedback
  • Test Resubmission: Allow students to retake quizzes with improved scoring
  • Question reordering (drag & drop) - partially implemented
  • Additional question types (text input, fill-in-the-blank, matching)
  • Question bank and templates library with rich text formulas
  • Export to PDF/Word formats with preserved mathematical formatting
  • Advanced analytics and reporting dashboard
  • Real-time collaborative quiz editing with rich text synchronization
  • Student progress tracking across multiple quizzes
  • Quiz scheduling and time limits

Technical Enhancements

  • Advanced mathematical notation (LaTeX integration)
  • Scientific notation and complex equations support
  • Module-specific testing: Individual module test suites
  • Visual regression testing: Screenshot comparisons with module isolation
  • Performance testing: Module load time and memory usage optimization
  • Automated accessibility (a11y) testing integration
  • Module dependency graph visualization
  • Code splitting and tree shaking: Remove unused module features

License

This project is for educational use. Please respect any licensing requirements for UniWebView if used commercially.

Support

For questions or issues, please open an issue on GitHub.

About

๐ŸŽ“ Teacher-friendly quiz system with offline ZIP packages, cross-browser image support & Unity integration. No internet required!

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •