/
digest-playground.spec.ts
166 lines (125 loc) · 6.66 KB
/
digest-playground.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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
describe('Digest Playground Workflow Page', function () {
beforeEach(function () {
cy.initializeSession({ noTemplates: true }).as('session');
});
it('should have a link to the docs', function () {
cy.intercept('GET', '**/notification-templates**').as('notificationTemplates');
cy.visit('/get-started');
cy.getByTestId('get-started-footer-left-side').click();
cy.wait('@notificationTemplates');
cy.waitForNetworkIdle(500);
cy.getByTestId('try-digest-playground-btn').click();
cy.url().should('include', '/digest-playground');
cy.contains('Digest Workflow Playground');
cy.get('a[href="https://docs.novu.co/workflows/digest?utm_campaign=in-app"]').contains('Learn more in docs');
});
it('the set up digest workflow should redirect to template edit page', function () {
cy.intercept('GET', '**/notification-templates**').as('notificationTemplates');
cy.intercept('GET', '**/notification-templates/**').as('getNotificationTemplate');
cy.visit('/get-started');
cy.getByTestId('get-started-footer-left-side').click();
cy.wait('@notificationTemplates');
cy.waitForNetworkIdle(500);
cy.getByTestId('try-digest-playground-btn').click();
cy.url().should('include', '/digest-playground');
cy.contains('Digest Workflow Playground');
cy.get('button').contains('Set Up Digest Workflow').click();
cy.wait('@getNotificationTemplate');
cy.url().should('include', '/workflows/edit');
});
it('should show the digest workflow hints', () => {
cy.intercept('GET', '**/notification-templates**').as('notificationTemplates');
cy.intercept('GET', '**/notification-templates/**').as('getNotificationTemplate');
cy.visit('/get-started');
// click try digest playground
cy.getByTestId('get-started-footer-left-side').click();
cy.wait('@notificationTemplates');
cy.waitForNetworkIdle(500);
cy.getByTestId('try-digest-playground-btn').click();
cy.url().should('include', '/digest-playground');
cy.contains('Digest Workflow Playground');
// click set up digest workflow
cy.get('button').contains('Set Up Digest Workflow').click();
cy.wait('@getNotificationTemplate');
// in the template workflow editor
cy.url().should('include', '/workflows/edit');
// check the digest hint
cy.getByTestId('digest-workflow-tooltip').contains('Set-up time interval');
cy.getByTestId('digest-workflow-tooltip').contains(
'Specify for how long the digest should collect events before sending a digested event to the next step step in the workflow.'
);
cy.getByTestId('digest-workflow-tooltip-primary-button').contains('Next');
cy.getByTestId('digest-workflow-tooltip-skip-button').contains('Skip tour');
cy.getByTestId('digest-workflow-tooltip-dots-navigation').should('be.visible');
// check if has digest step
cy.getByTestId('node-digestSelector').should('be.visible');
// check if digest step settings opened
cy.getByTestId('step-editor-sidebar').should('exist');
cy.getByTestId('step-editor-sidebar').contains('All events');
// click next on hint
cy.getByTestId('digest-workflow-tooltip-primary-button').contains('Next').click();
cy.waitForNetworkIdle(1000);
// check the email hint
cy.getByTestId('digest-workflow-tooltip').contains('Set-up email content');
cy.getByTestId('digest-workflow-tooltip').contains(
'Use custom HTML or our visual editor to define how the email will look like when sent to the subscriber.'
);
cy.getByTestId('digest-workflow-tooltip-primary-button').contains('Next');
cy.getByTestId('digest-workflow-tooltip-skip-button').contains('Skip tour');
cy.getByTestId('digest-workflow-tooltip-dots-navigation').should('be.visible');
// check if email step settings opened
cy.getByTestId('step-editor-sidebar').should('exist');
cy.getByTestId('step-editor-sidebar').contains('Email');
// click next on hint
cy.getByTestId('digest-workflow-tooltip-primary-button').contains('Next').click();
// check the email hint
cy.getByTestId('digest-workflow-tooltip').contains('Test your workflow');
cy.getByTestId('digest-workflow-tooltip').contains(
'We will trigger the workflow multiple times to represent how it aggregates notifications.'
);
cy.getByTestId('digest-workflow-tooltip-primary-button').contains('Got it');
cy.getByTestId('digest-workflow-tooltip-skip-button').should('not.exist');
cy.getByTestId('digest-workflow-tooltip-dots-navigation').should('be.visible');
// the step settings should be hidden
cy.getByTestId('workflow-sidebar').should('exist');
cy.getByTestId('workflow-sidebar').contains('Trigger');
// click got it should hide the hint
cy.getByTestId('digest-workflow-tooltip-primary-button').contains('Got it').click();
cy.getByTestId('digest-workflow-tooltip').should('not.exist');
});
it('should hide the digest workflow hints when clicking on skip tour button', () => {
cy.intercept('GET', '**/notification-templates**').as('notificationTemplates');
cy.intercept('GET', '**/notification-templates/**').as('getNotificationTemplate');
cy.visit('/get-started');
// click try digest playground
cy.getByTestId('get-started-footer-left-side').click();
cy.wait('@notificationTemplates');
cy.waitForNetworkIdle(500);
cy.getByTestId('try-digest-playground-btn').click();
cy.url().should('include', '/digest-playground');
cy.contains('Digest Workflow Playground');
// click set up digest workflow
cy.get('button').contains('Set Up Digest Workflow').click();
cy.wait('@getNotificationTemplate');
// in the template workflow editor
cy.url().should('include', '/workflows/edit');
// check the digest hint
cy.getByTestId('digest-workflow-tooltip').contains('Set-up time interval');
cy.getByTestId('digest-workflow-tooltip-skip-button').contains('Skip tour').click();
cy.getByTestId('digest-workflow-tooltip').should('not.exist');
});
it('when clicking on the back button from the playground it should redirect to /get-started/preview', function () {
cy.intercept('GET', '**/notification-templates**').as('notificationTemplates');
cy.intercept('GET', '**/notification-templates/**').as('getNotificationTemplate');
cy.visit('/get-started');
// click try digest playground
cy.getByTestId('get-started-footer-left-side').click();
cy.wait('@notificationTemplates');
cy.waitForNetworkIdle(500);
cy.getByTestId('try-digest-playground-btn').click();
cy.url().should('include', '/digest-playground');
cy.contains('Digest Workflow Playground');
cy.contains('Go Back').click();
cy.url().should('include', '/get-started/preview');
});
});