UNPKG

@playwright-mocks/reporters

Version:

Single Playwright reporter for mock interceptor with configurable logging and HTML report generation utility

546 lines (512 loc) 11.1 kB
/* Dark Theme for Playwright Mocks Report */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #181a20; color: #e6e6e6; line-height: 1.6; } .container { max-width: 1200px; margin: 0 auto; background: #23242b; border-radius: 12px; box-shadow: 0 2px 16px rgba(0,0,0,0.32); margin-top: 24px; margin-bottom: 24px; } .header { padding: 32px 24px 24px 24px; border-bottom: 1px solid #23242b; background: linear-gradient(135deg, #23242b 0%, #3a3f5c 100%); color: #fff; border-radius: 12px 12px 0 0; } .header h1 { margin-bottom: 8px; font-size: 2.2rem; font-weight: 700; } .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; } .stat-card { background: rgba(255,255,255,0.04); padding: 16px; border-radius: 8px; text-align: center; color: #e6e6e6; box-shadow: 0 1px 2px rgba(0,0,0,0.08); } .stat-number { font-size: 2rem; font-weight: bold; margin-bottom: 4px; } .content { padding: 32px 24px; } /* Search and Filter Controls */ .controls { margin-bottom: 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; } .search-box { flex: 1; min-width: 250px; position: relative; } .search-input { width: 100%; padding: 12px 16px; padding-left: 40px; background: #2a2b32; border: 1px solid #35363f; border-radius: 8px; color: #e6e6e6; font-size: 14px; } .search-input:focus { outline: none; border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2); } .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #b0b0b0; font-size: 16px; } .filter-buttons { display: flex; gap: 8px; flex-wrap: wrap; } .filter-btn { padding: 8px 16px; background: #2a2b32; border: 1px solid #35363f; border-radius: 6px; color: #e6e6e6; cursor: pointer; font-size: 14px; transition: all 0.2s; } .filter-btn:hover { background: #35363f; } .filter-btn.active { background: #60a5fa; border-color: #60a5fa; color: #fff; } .group-selector { padding: 8px 12px; background: #2a2b32; border: 1px solid #35363f; border-radius: 6px; color: #e6e6e6; font-size: 14px; cursor: pointer; } .group-selector:focus { outline: none; border-color: #60a5fa; } /* Group Headers */ .group-header { background: #2a2b32; padding: 12px 16px; margin: 16px 0 8px 0; border-radius: 8px; border-left: 4px solid #60a5fa; font-weight: 600; color: #e6e6e6; cursor: pointer; display: flex; align-items: center; justify-content: space-between; } .group-header:hover { background: #35363f; } .group-toggle { font-size: 1.2em; transition: transform 0.2s; } .group-header.collapsed .group-toggle { transform: rotate(-90deg); } .group-content { margin-left: 20px; } .group-content.collapsed { display: none; } .group-stats { font-size: 0.9em; color: #b0b0b0; margin-left: 12px; } /* Test Row Actions */ .test-actions { display: flex; gap: 8px; align-items: center; } .action-btn { padding: 4px 8px; background: transparent; border: 1px solid #35363f; border-radius: 4px; color: #b0b0b0; cursor: pointer; font-size: 12px; transition: all 0.2s; } .action-btn:hover { background: #35363f; color: #e6e6e6; } .action-btn.primary { background: #60a5fa; border-color: #60a5fa; color: #fff; } .action-btn.primary:hover { background: #3b82f6; } /* Modal Styles */ .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.8); display: none; z-index: 1000; backdrop-filter: blur(4px); } .modal-overlay.show { display: flex; align-items: center; justify-content: center; } .modal { background: #23242b; border-radius: 12px; max-width: 90vw; max-height: 90vh; width: 800px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; } .modal-header { padding: 20px 24px; border-bottom: 1px solid #35363f; display: flex; align-items: center; justify-content: space-between; } .modal-title { font-size: 1.3rem; font-weight: 600; color: #e6e6e6; } .modal-close { background: none; border: none; color: #b0b0b0; font-size: 24px; cursor: pointer; padding: 4px; border-radius: 4px; transition: all 0.2s; } .modal-close:hover { background: #35363f; color: #e6e6e6; } .modal-content { padding: 24px; overflow-y: auto; flex: 1; } /* Hidden rows */ .test-row.hidden { display: none; } .group-header.hidden { display: none; } table { width: 100%; border-collapse: collapse; margin-top: 16px; background: #23242b; color: #e6e6e6; } th, td { padding: 12px; text-align: left; border-bottom: 1px solid #35363f; } th { background: #23242b; font-weight: 600; color: #b0b0b0; } .passed { color: #4ade80; font-weight: 600; } .failed { color: #f87171; font-weight: 600; } .skipped { color: #facc15; font-weight: 600; } .timedOut { color: #f87171; font-weight: 600; } .status-icon { display: inline-block; vertical-align: middle; margin-right: 8px; font-size: 1.2em; } .test-row:hover { background: #23242b; cursor: pointer; filter: brightness(1.15); } .no-tests { text-align: center; padding: 48px; color: #888; } a { color: #60a5fa; text-decoration: none; } a:hover { text-decoration: underline; } @media (max-width: 768px) { .container { margin: 10px; } .header { padding: 16px; } .content { padding: 16px; } .stats { grid-template-columns: 1fr; } .controls { flex-direction: column; align-items: stretch; } .search-box { min-width: auto; } .filter-buttons { justify-content: center; } .modal { width: 95vw; margin: 10px; } } /* Test page blocks */ .test-block { margin-bottom: 28px; border-radius: 8px; background: #23242b; box-shadow: 0 1px 2px rgba(0,0,0,0.10); border: 1px solid #35363f; } .test-block-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; cursor: pointer; padding: 12px 16px; border-bottom: 1px solid #35363f; background: #23242b; color: #e6e6e6; } .test-block-content { padding: 16px 24px; display: none; background: #23242b; color: #e6e6e6; } .test-block.open .test-block-content { display: block; } .test-block.open .test-block-title { background: #23242b; color: #fff; } .block-icon { margin-right: 10px; font-size: 1.2em; } .attachment-list { margin-top: 8px; } .attachment-item { margin-bottom: 4px; } .error-block { background: #2d1a1a; color: #f87171; padding: 12px; border-radius: 6px; margin-top: 12px; border: 1px solid #b91c1c; } .meta-table { width: 100%; border-collapse: collapse; margin-top: 8px; background: #23242b; color: #e6e6e6; } .meta-table th, .meta-table td { padding: 6px 10px; border-bottom: 1px solid #35363f; } .meta-table th { background: #23242b; font-weight: 500; color: #b0b0b0; } /* Icons */ .icon-passed { color: #4ade80; } .icon-failed { color: #f87171; } .icon-skipped { color: #facc15; } .icon-timedOut { color: #f87171; } .icon-error { color: #f87171; } .icon-attachment { color: #a78bfa; } .icon-mock { color: #60a5fa; } .icon-meta { color: #b0b0b0; } .block-toggle { margin-left: auto; font-size: 1.1em; transition: transform 0.2s; color: #b0b0b0; } .test-block.open .block-toggle { transform: rotate(90deg); color: #60a5fa; } .test-header-details { font-size: 1.2rem; margin-top: 8px; display: flex; align-items: center; } .test-header-meta { margin-top: 10px; color: #b0b0b0; font-size: 1rem; display: flex; gap: 32px; flex-wrap: wrap; } .meta-item { display: flex; align-items: center; gap: 6px; } /* Steps block styles */ .steps-list { list-style: none; margin: 0 0 0 18px; padding: 0; } .step-item { margin-bottom: 8px; border-left: 2px solid #35363f; padding-left: 10px; } .step-header { display: flex; align-items: center; gap: 10px; font-size: 1rem; } .step-title { font-weight: 500; color: #e6e6e6; } .step-status { font-size: 1.1em; margin-left: 4px; } .step-duration { color: #b0b0b0; font-size: 0.95em; margin-left: 8px; } .step-error { background: #2d1a1a; color: #f87171; padding: 6px 10px; border-radius: 5px; margin-top: 6px; border: 1px solid #b91c1c; font-size: 0.97em; } .step-status-passed .step-title { color: #4ade80; } .step-status-failed .step-title { color: #f87171; } .step-status-skipped .step-title { color: #facc15; } .step-status-running .step-title { color: #60a5fa; } /* Network Requests block styles */ .network-requests-list { list-style: none; margin: 0; padding: 0; } .network-request-item { margin-bottom: 8px; padding: 8px 12px; border-radius: 6px; background: #2a2b32; border: 1px solid #35363f; } .network-request-header { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; } .network-method { background: #3a3f5c; color: #e6e6e6; padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; font-weight: 600; min-width: 50px; text-align: center; } .network-url { color: #60a5fa; font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; font-size: 0.9rem; flex: 1; word-break: break-all; } .network-status { background: #35363f; color: #e6e6e6; padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; font-weight: 600; min-width: 40px; text-align: center; } .network-duration { color: #b0b0b0; font-size: 0.85rem; margin-left: 8px; } .network-error-details { background: #2d1a1a; color: #f87171; padding: 6px 10px; border-radius: 5px; margin-top: 6px; border: 1px solid #b91c1c; font-size: 0.9rem; } .network-success .network-status { background: #1a3a1a; color: #4ade80; } .network-redirect .network-status { background: #3a2a1a; color: #facc15; } .network-error .network-status { background: #3a1a1a; color: #f87171; } /* Test details in main table */ .test-details-row { display: none; background: #1a1b20; } .test-details-row.open { display: table-row; } .test-details-content { padding: 20px; border-top: 1px solid #35363f; } .toggle-icon { cursor: pointer; font-size: 1.2em; color: #60a5fa; transition: transform 0.2s; } .test-row { cursor: pointer; } .test-row:hover { background: #2a2b32; } .tests-table { border-collapse: collapse; } .tests-table th, .tests-table td { border-bottom: 1px solid #35363f; padding: 12px; }