Skip to content

Commit fe60690

Browse files
committed
authenticated e2e tests
1 parent 2585d53 commit fe60690

1 file changed

Lines changed: 46 additions & 1 deletion

File tree

cypress/e2e/authenticated.js

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,53 @@ describe('an unauthenticated user', () => {
2222
cy.visit('/mynotes')
2323
.wait(500)
2424
.queryByText('Delete Note')
25+
.click()
26+
.get('article')
27+
.should('not.exist')
28+
.queryByText('No notes yet')
29+
.should('exist');
30+
});
31+
});
32+
33+
it('can create and edit a note', () => {
34+
cy.loginUser().then(({ user, data }) => {
35+
cy.visit('/new')
36+
.get('main textarea')
37+
.type('Pizza parties are the best parties')
38+
.queryByText('Save')
2539
.click();
26-
// TODO: add assertion to test that note has been deleted
40+
41+
cy.visit('/mynotes')
42+
.wait(500)
43+
.queryByText('Edit')
44+
.click()
45+
.get('main textarea')
46+
.type('!')
47+
.queryByText('Save')
48+
.click()
49+
.wait(500)
50+
.window()
51+
.queryByText('Pizza parties are the best parties!')
52+
.should('exist');
53+
});
54+
});
55+
56+
it('can toggle note favorites', () => {
57+
cy.loginUser().then(({ user, data }) => {
58+
cy.visit('/')
59+
.wait(500)
60+
.get('[data-cy=favorite]')
61+
.first()
62+
.click();
63+
64+
cy.visit('/favorites')
65+
.get('article')
66+
.should('exist')
67+
.get('[data-cy=favorite]')
68+
.first()
69+
.click()
70+
.get('article')
71+
.should('not.exist');
2772
});
2873
});
2974
});

0 commit comments

Comments
 (0)