ep_email_notifications 11.0.16 → 11.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ep_email_notifications",
3
3
  "description": "Subscribe to a pad and receive an email when someone edits your pad",
4
- "version": "11.0.16",
4
+ "version": "11.0.17",
5
5
  "author": {
6
6
  "name": "John Mclear",
7
7
  "email": "john@mclear.co.uk",
@@ -38,7 +38,7 @@
38
38
  "devDependencies": {
39
39
  "eslint": "^8.57.1",
40
40
  "eslint-config-etherpad": "^4.0.5",
41
- "typescript": "^6.0.2"
41
+ "typescript": "^6.0.3"
42
42
  },
43
43
  "scripts": {
44
44
  "lint": "eslint .",
@@ -0,0 +1,49 @@
1
+ import {expect, test} from '@playwright/test';
2
+ import {goToNewPad} from 'ep_etherpad-lite/tests/frontend-new/helper/padHelper';
3
+
4
+ test.beforeEach(async ({page}) => {
5
+ await goToNewPad(page);
6
+ });
7
+
8
+ test.describe('ep_email_notifications', () => {
9
+ const malformedEmail = 'tutti@bad-email';
10
+ const goodEmail = 'tutti@non-existing-domain.org';
11
+
12
+ const openSettings = async (page: any) => {
13
+ await page.locator('.buttonicon-settings').click();
14
+ await expect(page.locator('.ep_email_settings')).toBeVisible();
15
+ };
16
+
17
+ test('subscribe with no notification options shows missing-options notice', async ({page}) => {
18
+ await openSettings(page);
19
+ await page.locator('#ep_email_form_mysettings [name=ep_email]').fill(goodEmail);
20
+ await page.locator('#ep_email_form_mysettings [name=ep_email_onStart]').uncheck();
21
+ await page.locator('#ep_email_form_mysettings [name=ep_email_onEnd]').uncheck();
22
+ await page.locator('#ep_email_form_mysettings [name=ep_email_subscribe]').click();
23
+ await expect(page.locator('.gritter-item').first()).toBeVisible({timeout: 30_000});
24
+ await expect(page.locator('.emailNotificationsSubscrOptionsMissing')).toBeVisible();
25
+ });
26
+
27
+ test('subscribe with malformed email is rejected', async ({page}) => {
28
+ await openSettings(page);
29
+ await page.locator('#ep_email_form_mysettings [name=ep_email]').fill(malformedEmail);
30
+ await page.locator('#ep_email_form_mysettings [name=ep_email_onStart]').check();
31
+ await page.locator('#ep_email_form_mysettings [name=ep_email_subscribe]').click();
32
+ await expect(page.locator('.gritter-item').first()).toBeVisible({timeout: 30_000});
33
+ const missing = await page.evaluate(
34
+ () => (window as any).clientVars && (window as any).clientVars.ep_email_missing);
35
+ if (missing) test.skip(true, 'email settings not configured');
36
+ await expect(page.locator('.emailNotificationsSubscrResponseBad')).toBeVisible();
37
+ });
38
+
39
+ test('unsubscribe with unregistered email is rejected', async ({page}) => {
40
+ await openSettings(page);
41
+ await page.locator('#ep_email_form_mysettings [name=ep_email]').fill(goodEmail);
42
+ await page.locator('#ep_email_form_mysettings [name=ep_email_unsubscribe]').click();
43
+ await expect(page.locator('.gritter-item').first()).toBeVisible({timeout: 30_000});
44
+ const missing = await page.evaluate(
45
+ () => (window as any).clientVars && (window as any).clientVars.ep_email_missing);
46
+ if (missing) test.skip(true, 'email settings not configured');
47
+ await expect(page.locator('.emailNotificationsUnsubscrResponseBad')).toBeVisible();
48
+ });
49
+ });
@@ -1,130 +0,0 @@
1
- 'use strict';
2
-
3
- describe('email notifications plugin', function () {
4
- // create a new pad before each test run
5
- beforeEach(function (cb) {
6
- helper.newPad(cb);
7
- this.timeout(60000);
8
- });
9
-
10
- // Subscribe malformed email
11
- const malformedEmail = 'tutti@bad-email';
12
-
13
- // Subscribe good email
14
- const goodEmail = 'tutti@non-existing-domain.org';
15
-
16
- // Test the form in mysetting menu
17
-
18
- // Launch the tests
19
- // First test without options selected
20
- it('makes test without options selected', function (done) {
21
- const chrome$ = helper.padChrome$;
22
-
23
- // click on the settings button to make settings visible
24
- const $settingsButton = chrome$('.buttonicon-settings');
25
- $settingsButton.click();
26
-
27
- // Show the notification form
28
- chrome$('.ep_email_settings').slideDown(() => {
29
- chrome$('#ep_email_form_mysettings [name=ep_email]').val(goodEmail);
30
- chrome$('#ep_email_form_mysettings [name=ep_email_onStart]').prop('checked', false);
31
- chrome$('#ep_email_form_mysettings [name=ep_email_onEnd]').prop('checked', false);
32
-
33
- chrome$('#ep_email_form_mysettings [name=ep_email_subscribe]').click(); // function() {
34
-
35
- // Is the correct gritter msg there
36
- helper.waitFor(() => chrome$('.gritter-item').is(':visible') === true)
37
- .done(() => {
38
- expect(chrome$('.emailNotificationsSubscrOptionsMissing').is(':visible')).to.be(true);
39
- done();
40
- });
41
- });
42
- });
43
-
44
- // Second, test with a malformed email
45
- it('makes test subscription with malformed email address', function (done) {
46
- const chrome$ = helper.padChrome$;
47
-
48
- // click on the settings button to make settings visible
49
- const $settingsButton = chrome$('.buttonicon-settings');
50
- $settingsButton.click();
51
-
52
- // Show the notification form
53
- chrome$('.ep_email_settings').slideDown(() => {
54
- chrome$('#ep_email_form_mysettings [name=ep_email]').val(malformedEmail);
55
- chrome$('#ep_email_form_mysettings [name=ep_email_onStart]').prop('checked', true);
56
-
57
- chrome$('#ep_email_form_mysettings [name=ep_email_subscribe]').click();
58
-
59
- // Is the correct gritter msg there
60
- helper.waitFor(() => chrome$('.gritter-item').is(':visible') === true)
61
- .done(() => {
62
- const clientVars = $('iframe')[0].contentWindow.window.clientVars;
63
- if (clientVars.ep_email_missing) { // don't test if settings aren't set
64
- return done();
65
- }
66
- expect(chrome$('.emailNotificationsSubscrResponseBad').is(':visible')).to.be(true);
67
- done();
68
- });
69
- });
70
- });
71
-
72
- // Third, test unsubscription with an email not registered
73
- it('makes test unsubscription with an unregistered email address', function (done) {
74
- const chrome$ = helper.padChrome$;
75
-
76
- // click on the settings button to make settings visible
77
- const $settingsButton = chrome$('.buttonicon-settings');
78
- $settingsButton.click();
79
-
80
- // Show the notification form
81
- chrome$('.ep_email_settings').slideDown(() => {
82
- chrome$('#ep_email_form_mysettings [name=ep_email]').val(goodEmail);
83
-
84
- chrome$('#ep_email_form_mysettings [name=ep_email_unsubscribe]').click();
85
-
86
- // Is the correct gritter msg there
87
- helper.waitFor(() => chrome$('.gritter-item').is(':visible') === true)
88
- .done(() => {
89
- const clientVars = $('iframe')[0].contentWindow.window.clientVars;
90
- if (clientVars.ep_email_missing) { // don't test if settings aren't set
91
- return done();
92
- }
93
-
94
- expect(chrome$('.emailNotificationsUnsubscrResponseBad').is(':visible')).to.be(true);
95
-
96
- done();
97
- });
98
- });
99
- });
100
-
101
- // Fourth, test subscription with a good email
102
- it('makes test subscription with an unregistered email address', function (done) {
103
- const chrome$ = helper.padChrome$;
104
-
105
- // click on the settings button to make settings visible
106
- const $settingsButton = chrome$('.buttonicon-settings');
107
- $settingsButton.click();
108
-
109
- // Show the notification form
110
- chrome$('.ep_email_settings').slideDown(() => {
111
- chrome$('#ep_email_form_mysettings [name=ep_email]').val(goodEmail);
112
- chrome$('#ep_email_form_mysettings [name=ep_email_onStart]').prop('checked', true);
113
-
114
- chrome$('#ep_email_form_mysettings [name=ep_email_subscribe]').click();
115
-
116
- // Is the correct gritter msg there
117
- helper.waitFor(() => chrome$('.gritter-item').is(':visible') === true)
118
- .done(() => {
119
- const clientVars = $('iframe')[0].contentWindow.window.clientVars;
120
- if (clientVars.ep_email_missing) { // don't test if settings aren't set
121
- return done();
122
- }
123
-
124
- expect(chrome$('.emailNotificationsSubscrResponseGood').is(':visible')).to.be(true);
125
-
126
- done();
127
- });
128
- });
129
- });
130
- });