File size: 3,728 Bytes
1ca197b
 
 
 
 
 
 
 
 
66e2393
1ca197b
 
 
66e2393
 
 
 
 
 
1ca197b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
document.addEventListener('DOMContentLoaded', function() {
    // Simulate login (in a real app, this would be handled by a backend)
    const loginForm = document.querySelector('#login-form');
    const dashboard = document.querySelector('#dashboard');
    if (loginForm) {
        loginForm.addEventListener('submit', function(e) {
            e.preventDefault();
            dashboard.classList.remove('hidden');
            document.querySelector('#login-modal').classList.add('hidden');
            window.location.hash = '#dashboard';
        });
    }

    // Check for hash on load
    if (window.location.hash === '#dashboard') {
        dashboard.classList.remove('hidden');
        document.querySelector('#login-modal').classList.add('hidden');
    }
// Testing type selection
    const testingTypeCards = document.querySelectorAll('.testing-type-card');
    const testingDashboard = document.querySelector('#testing-dashboard');
    const testingTypeTitle = document.querySelector('#testing-type-title');
    
    testingTypeCards.forEach(card => {
        card.addEventListener('click', function() {
            const type = this.getAttribute('data-type');
            testingDashboard.classList.remove('hidden');
            testingTypeTitle.textContent = type.charAt(0).toUpperCase() + type.slice(1) + ' Testing';
            
            // Scroll to dashboard
            testingDashboard.scrollIntoView({ behavior: 'smooth' });
        });
    });

    // Trigger modal
    const triggerModalBtn = document.querySelector('#trigger-modal-btn');
    const triggerModal = document.querySelector('#trigger-modal');
    const closeModalBtn = document.querySelector('#close-modal');
    
    if (triggerModalBtn) {
        triggerModalBtn.addEventListener('click', function() {
            triggerModal.classList.remove('hidden');
        });
    }
    
    if (closeModalBtn) {
        closeModalBtn.addEventListener('click', function() {
            triggerModal.classList.add('hidden');
        });
    }

    // Close modal when clicking outside
    triggerModal.addEventListener('click', function(e) {
        if (e.target === triggerModal) {
            triggerModal.classList.add('hidden');
        }
    });

    // Show/hide specific fields based on testing type
    const testForm = document.querySelector('#test-form');
    const functionalFields = document.querySelector('#functional-fields');
    const performanceFields = document.querySelector('#performance-fields');
    
    if (testForm) {
        testForm.addEventListener('submit', function(e) {
            e.preventDefault();
            alert('Test execution started!');
            triggerModal.classList.add('hidden');
        });
    }

    // Dynamic fields based on testing type
    testingTypeCards.forEach(card => {
        card.addEventListener('click', function() {
            const type = this.getAttribute('data-type');
            
            // Hide all specific fields first
            functionalFields.classList.add('hidden');
            performanceFields.classList.add('hidden');
            
            // Show relevant fields
            if (type === 'functional') {
                functionalFields.classList.remove('hidden');
            } else if (type === 'performance') {
                performanceFields.classList.remove('hidden');
            }
        });
    });

    // Sample data updates
    setInterval(() => {
        const executingTests = document.querySelector('#executing-tests');
        if (executingTests) {
            const current = parseInt(executingTests.textContent);
            executingTests.textContent = Math.max(0, current + (Math.random() > 0.5 ? -1 : 1));
        }
    }, 5000);
});