-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathtagPush.cy.js
More file actions
131 lines (109 loc) · 4.37 KB
/
tagPush.cy.js
File metadata and controls
131 lines (109 loc) · 4.37 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* Copyright 2026 GitProxy Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
describe('Tag Push Functionality', () => {
beforeEach(() => {
cy.login('admin', 'admin');
cy.on('uncaught:exception', () => false);
// Create test data for tag pushes
cy.createTestTagPush();
});
describe('Tag Push Display in PushesTable', () => {
it('can navigate to push dashboard and view push table', () => {
cy.visit('/dashboard/push');
// Wait for API call to complete
cy.wait('@getPushes');
// Check that we can see the basic table structure
cy.get('table', { timeout: 10000 }).should('exist');
cy.get('thead').should('exist');
cy.get('tbody').should('exist');
// Now we should have test data, so we can check for rows
cy.get('tbody tr').should('have.length.at.least', 1);
// Check the structure of the first row
cy.get('tbody tr')
.first()
.within(() => {
cy.get('td').should('have.length.at.least', 6); // We know there are multiple columns
// Check for tag-specific content
cy.contains('v1.0.0').should('exist'); // Tag name
cy.contains('test-tagger').should('exist'); // Tagger
});
});
it('can interact with push table entries', () => {
cy.visit('/dashboard/push');
cy.wait('@getPushes');
cy.get('tbody tr').should('have.length.at.least', 1);
// Check for clickable elements in the first row
cy.get('tbody tr')
.first()
.within(() => {
// Should have links and buttons
cy.get('a').should('have.length.at.least', 1); // Repository links, etc.
cy.get('button').should('have.length.at.least', 1); // Action button
});
});
});
describe('Tag Push Details Page', () => {
it('can access push details page structure', () => {
// Try to access a push details page directly
cy.visit('/dashboard/push/test-push-id', { failOnStatusCode: false });
// Check basic page structure exists (regardless of whether push exists)
cy.get('body').should('exist'); // Basic content check
// If we end up redirected, that's also acceptable behavior
cy.url().should('include', '/dashboard');
});
});
describe('Basic UI Navigation', () => {
it('can navigate between dashboard pages', () => {
cy.visit('/dashboard/push');
cy.wait('@getPushes');
cy.get('table', { timeout: 10000 }).should('exist');
// Test navigation to repo dashboard
cy.visit('/dashboard/repo');
cy.get('table', { timeout: 10000 }).should('exist');
// Test navigation to user management if it exists
cy.visit('/dashboard/user');
cy.get('body').should('exist');
});
});
describe('Application Robustness', () => {
it('handles navigation to non-existent push gracefully', () => {
// Try to visit a non-existent push detail page
cy.visit('/dashboard/push/non-existent-push-id', { failOnStatusCode: false });
// Should either redirect or show error page, but not crash
cy.get('body').should('exist');
});
it('maintains functionality after page refresh', () => {
cy.visit('/dashboard/push');
cy.wait('@getPushes');
cy.get('table', { timeout: 10000 }).should('exist');
// Refresh the page
cy.reload();
// Wait for API call again after reload
cy.wait('@getPushes');
// Wait for page to reload and check basic functionality
cy.get('body').should('exist');
// Give more time for table to load after refresh, or check if redirected
cy.url().then((url) => {
if (url.includes('/dashboard/push')) {
cy.get('table', { timeout: 15000 }).should('exist');
} else {
// If redirected (e.g., to login), that's also acceptable behavior
cy.get('body').should('exist');
}
});
});
});
});