odex30_standard/odex30_base/expert_theme/TESTING_GUIDE.md

8.1 KiB

Testing Guide - Login Page Templates Feature

Prerequisites

  • Odoo 18 installed and running
  • Expert Theme module installed
  • Admin access to Odoo backend

Step 1: Install/Upgrade the Module

  1. Go to Apps Menu

    • Navigate to: Apps → Search for "Expert Theme"
    • Click on the module
  2. Upgrade the Module

    • Click the "Upgrade" button (if already installed)
    • OR click "Install" if not installed yet
    • Wait for the upgrade/installation to complete
  3. Verify Installation

    • Check that no errors appear in the logs
    • The module should show as "Installed"

Step 2: Access Login Template Configuration

  1. Navigate to Configuration

    • Go to: Expert HomeLogin Page Templates
    • OR use the menu: Expert HomeLogin Page Templates (should be above "Theme Colors")
  2. Verify Default Templates

    • You should see 2 templates created by default:
      • Default Template (White background #FFFFFF) - Should be Active
      • Light Gray Template (Gray background #F5F5F5) - Should be Inactive

Step 3: Test Template Switching

Test 3.1: Switch to Gray Template

  1. Open the Gray Template

    • Click on "Light Gray Template" from the list
  2. Activate the Template

    • Click the "Activate" button in the form header
    • OR toggle the "Active" field to True
    • Click "Save"
  3. Verify Switch

    • The "Default Template" should automatically become Inactive
    • Only "Light Gray Template" should be Active
    • Check the list view - only one template should have the Active toggle ON

Test 3.2: Switch Back to Default Template

  1. Open Default Template

    • Click on "Default Template" from the list
  2. Activate it

    • Click "Activate" button or toggle "Active" field
    • Click "Save"
  3. Verify

    • "Light Gray Template" should become inactive
    • "Default Template" should be active

Step 4: Test Login Page Appearance

Test 4.1: Test with Default Template (White)

  1. Logout from Odoo

    • Click on your user menu (top right)
    • Click "Log out"
  2. Check Login Page

    • The login page should have a white background (#FFFFFF)
    • All login form elements should be visible and functional
  3. Verify JavaScript Loading

    • Open browser Developer Tools (F12)
    • Go to Console tab
    • Check for any errors
    • You should see the CSS variable being set: --expert-login-bg-color

Test 4.2: Test with Gray Template

  1. Switch to Gray Template (from Step 3.1)

  2. Logout and Check Login Page

    • Logout from Odoo
    • The login page should now have a light gray background (#F5F5F5)
    • Login form should still be visible and functional
  3. Verify Background Applied

    • Check browser DevTools → Elements tab
    • Inspect <body> or <html> element
    • Should have background-color: #F5F5F5 applied

Step 5: Test Color Customization

Test 5.1: Edit Template Background Color

  1. Edit a Template

    • Go to Login Page Templates
    • Open any template (e.g., "Default Template")
  2. Change Background Color

    • Click on the "Background Color" field
    • Choose a different color (e.g., #E3F2FD - light blue)
    • Click "Save"
  3. Test on Login Page

    • Logout and check login page
    • Background should be the new color you selected

Test 5.2: Create New Template

  1. Create New Template

    • Go to Login Page Templates
    • Click "Create" button
  2. Fill Template Details

    • Name: "Blue Template"
    • Background Color: #2196F3 (or any blue color)
    • Description: "Blue themed login page"
    • Sequence: 3
    • DO NOT activate it yet
  3. Save and Activate

    • Click "Save"
    • Then click "Activate" button
    • Verify other templates become inactive
  4. Test on Login Page

    • Logout and verify blue background appears

Step 6: Test Edge Cases

Test 6.1: Multiple Templates (Only One Active)

  1. Create Multiple Templates

    • Create 2-3 templates
    • Try to activate multiple templates at once
  2. Expected Behavior

    • Only the last activated template should be active
    • All others should automatically become inactive
    • This ensures only one template is applied at a time

Test 6.2: No Active Template

  1. Deactivate All Templates

    • Go to all templates and set Active = False
    • Save all
  2. Check Login Page

    • Logout and check login page
    • Should still work (fallback to default white or system default)
    • OR a default template should be auto-created

Test 6.3: Invalid Color Code

  1. Test Invalid Color

    • Edit a template
    • Enter invalid color code (e.g., "invalid" or "12345")
    • Save
  2. Expected Behavior

    • Should either:
      • Show validation error
      • OR fallback to default color (#FFFFFF)

Step 7: Test API Endpoint

Test 7.1: Check API Response

  1. Open Browser DevTools

    • Press F12
    • Go to Network tab
  2. Access Login Page

    • Go to login page (while logged out)
  3. Check API Call

    • Look for request: /expert_theme/get_login_template_styles
    • Click on it to see response
    • Should return JSON:
      {
        "success": true,
        "styles": {
          "background_color": "#F5F5F5"
        }
      }
      
  4. Verify Public Access

    • The API should work without authentication (public access)
    • Try accessing directly: http://your-odoo-url/expert_theme/get_login_template_styles

Step 8: Test Browser Compatibility

Test the login page in different browsers:

  • Chrome/Edge (Chromium)
  • Firefox
  • Safari (if available)

Verify that:

  • Background colors apply correctly
  • Login form remains functional
  • No JavaScript errors in console

Step 9: Performance Testing

  1. Check Page Load Time

    • Login page should load quickly
    • API call should be fast (< 100ms ideally)
  2. Check for Console Errors

    • Open DevTools → Console
    • Should see no errors
    • Only warnings are acceptable (e.g., if API fails, it should gracefully handle)

Step 10: Final Verification Checklist

  • Module installs/upgrades without errors
  • Menu "Login Page Templates" appears in Expert Home
  • Default templates are created (2 templates)
  • Can switch between templates
  • Only one template can be active at a time
  • Login page background changes when template is switched
  • Can edit template colors
  • Can create new templates
  • Login form remains functional with all templates
  • API endpoint works (public access)
  • No JavaScript errors in console
  • Works in multiple browsers

Troubleshooting

Issue: Login page background doesn't change

Solutions:

  1. Clear browser cache (Ctrl+Shift+Delete)
  2. Hard refresh login page (Ctrl+F5)
  3. Check browser console for JavaScript errors
  4. Verify API endpoint is accessible: /expert_theme/get_login_template_styles
  5. Check that a template is actually active in the backend

Issue: Menu "Login Page Templates" not visible

Solutions:

  1. Upgrade the module again
  2. Check user permissions (should be available to all users)
  3. Clear browser cache
  4. Restart Odoo server

Issue: Multiple templates active at once

Solutions:

  1. This shouldn't happen - check the model's write() method
  2. Manually deactivate all except one
  3. Report as a bug if it persists

Issue: API returns error

Solutions:

  1. Check Odoo logs for Python errors
  2. Verify the model expert.login.template exists
  3. Check database for template records
  4. Verify controller route is registered

Expected Results Summary

Success Criteria:

  • Admin can configure login page templates from backend
  • Can switch between templates easily
  • Login page background changes immediately after switching
  • Only one template active at a time
  • Login functionality remains intact
  • No errors in console or logs

Notes

  • The feature is designed to be simple initially (only background color)
  • Future enhancements can add more customization options
  • All changes take effect immediately (no server restart needed)
  • Templates are stored in database, so they persist after module upgrades