-
Notifications
You must be signed in to change notification settings - Fork 38
/
org_event_page.spec.ts
81 lines (69 loc) · 2.77 KB
/
org_event_page.spec.ts
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
describe('/o/[orgId]/events/[eventId]', () => {
beforeEach(() => {
cy.request('delete', 'http://localhost:8001/_mocks');
});
after(() => {
cy.request('delete', 'http://localhost:8001/_mocks');
});
it('contains non-interactive event content', () => {
cy.visit('/o/1/events/25');
cy.get('[data-test="event-title"]').should('be.visible');
cy.get('[data-test="duration"]').should('be.visible');
cy.get('[data-test="location"]').should('be.visible');
});
it('contains clickable org name that leads to org page', () => {
cy.visit('/o/1/events/25');
cy.waitUntilReactRendered();
cy.findByText('My Organization').click();
cy.url().should('match', /\/o\/1$/);
});
it('contains clickable campaign name that leads to campaign page', () => {
cy.visit('/o/1/events/25');
cy.waitUntilReactRendered();
cy.findByText('Second campaign').click();
cy.url().should('match', /\/o\/1\/campaigns\/2$/);
});
it('shows a sign-up button if user is not signed up to the event', () => {
cy.request('put', 'http://localhost:8001/v1/users/me/action_responses/_mocks/get', {
response: {
data: {
data: [],
},
},
});
cy.visit('/login');
cy.get('input[aria-label="E-mail address"]').type('testadmin@example.com');
cy.get('input[aria-label="Password"]').type('password');
cy.get('input[aria-label="Log in"]')
.click();
cy.visit('/o/1/events/25');
cy.waitUntilReactRendered();
cy.findByText('Sign-up').click();
//TODO: Verify that API request is done corrently.
});
it('shows an undo sign-up button if user is signed up to the event', () => {
cy.fixture('dummyEventResponses').then(json => {
cy.request('put', 'http://localhost:8001/v1/users/me/action_responses/_mocks/get', {
response: {
data: json,
},
});
cy.request('put', 'http://localhost:8001/v1/orgs/1/actions/25/responses/2/_mocks/delete', {
response: {
status: 204,
},
});
cy.visit('/login');
cy.get('input[aria-label="E-mail address"]').type('testadmin@example.com');
cy.get('input[aria-label="Password"]').type('password');
cy.get('input[aria-label="Log in"]')
.click();
cy.visit('/o/1/events/25');
cy.waitUntilReactRendered();
cy.findByText('Undo sign-up').click();
//TODO: Verify that API request is done corrently.
});
});
});
// Hack to flag for typescript as module
export {};