-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathnavigation.cy.js
More file actions
75 lines (68 loc) · 2.26 KB
/
navigation.cy.js
File metadata and controls
75 lines (68 loc) · 2.26 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
/**
* 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.
*/
/**
* Navigation & Shell
* Strategy: Mix of real navigation and intercepts.
*/
describe('Navigation & Shell', () => {
beforeEach(() => {
cy.login('admin', 'admin');
});
afterEach(() => {
cy.logout();
});
it('Sidebar renders all visible links', () => {
cy.visit('/dashboard/repo');
cy.contains('Repositories').should('be.visible');
cy.contains('Dashboard').should('be.visible');
});
it('Sidebar links navigate correctly', () => {
cy.visit('/dashboard/repo');
cy.contains('Dashboard').click();
cy.url().should('include', '/dashboard/push');
cy.contains('Repositories').click();
cy.url().should('include', '/dashboard/repo');
});
it('Active sidebar item highlights', () => {
cy.visit('/dashboard/repo');
cy.get('[aria-current="page"]').should('exist');
});
it('Navbar renders correctly', () => {
cy.visit('/dashboard/repo');
cy.get('[data-testid="navbar"]').should('be.visible');
});
it('Footer renders', () => {
cy.visit('/dashboard/repo');
cy.get('[data-testid="footer"]').should('exist');
cy.get('[data-testid="footer"]').scrollIntoView();
cy.get('[data-testid="footer"]').should('be.visible');
});
// NOTE: Keep unauthenticated checks outside the logged-in hooks.
it('/ redirects to /dashboard/repo', () => {
cy.logout();
cy.visit('/');
cy.url().should('match', /\/(login|dashboard)/);
});
});
describe('Unauthenticated access', () => {
it('Unauthenticated user is redirected to /login', () => {
Cypress.session.clearAllSavedSessions();
cy.clearCookies();
cy.clearLocalStorage();
cy.visit('/dashboard/profile');
cy.url().should('include', '/login');
});
});