Skip to content

Commit 7e67859

Browse files
Add two cypress tests
1 parent 418650f commit 7e67859

File tree

5 files changed

+15
-31
lines changed

5 files changed

+15
-31
lines changed

cypress/integration/ydkjs/sidebar.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,20 @@
55
context('Sidebar', () => {
66
beforeEach(() => {
77
cy.visit('/');
8+
cy.contains('Progress').should('exist');
89
});
910

10-
it('does something', () => {
11-
cy.contains('YDKJS Exercises');
11+
it('closes when X is clicked and reopens when hamburger is clicked', () => {
12+
cy.get('[data-testid=closeSidebar]').click();
13+
cy.contains('Progress').should('not.exist');
14+
cy.get('[data-testid=openSidebar]').click();
15+
cy.contains('Progress').should('exist');
16+
});
17+
18+
it('navigates to /up-going when Up & Going is picked', () => {
19+
cy.contains(/Up & Going \(/).click({ force: true });
20+
cy.url().should('include', '/up-going');
21+
cy.contains('Chapter 1: Into Programming').should('exist');
22+
cy.contains('Chapter 2: Into JavaScript').should('exist');
1223
});
1324
});
-43.1 KB
Binary file not shown.

cypress/videos/ydkjs/sidebar.js.mp4

114 KB
Binary file not shown.

src/components/MenuContainer.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/components/Sidebar/Sidebar.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export default class Sidebar extends Component {
6969
border: 0,
7070
background: 'transparent',
7171
}}
72+
data-testid="openSidebar"
7273
>
7374
<Menu />
7475
</button>
@@ -87,6 +88,7 @@ export default class Sidebar extends Component {
8788
position: 'absolute',
8889
right: '10px',
8990
}}
91+
data-testid="closeSidebar"
9092
>
9193
<Close data-name="svg" />
9294
</button>

0 commit comments

Comments
 (0)