- commit
- 5934c3869a8842006a3066968eba9965376923c2
- parent
- 5526a4a285e303cc11568e4dedc082d7600ed0ae
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2017-11-19 10:57
adapt tests
Diffstat
| M | static/test/test.js | 32 | ++++++++++++++++++-------------- |
1 files changed, 18 insertions, 14 deletions
diff --git a/static/test/test.js b/static/test/test.js
@@ -42,7 +42,7 @@ describe('load', function() {
42 42 });
43 43
44 44 it('should work without error', function() {
45 -1 expect(browser.contentDocument.querySelector('#name')).to.exist;
-1 45 expect(browser.contentDocument.querySelector('.user__name')).to.exist;
46 46 });
47 47 it('should set the page title', function() {
48 48 var title = browser.contentDocument.title;
@@ -61,7 +61,7 @@ describe('setName', function() {
61 61 browser = b;
62 62 d = browser.contentDocument;
63 63
64 -1 userName = d.querySelector('#name input');
-1 64 userName = d.querySelector('.user__name input');
65 65 userName.value = name;
66 66 userName.dispatchEvent(new Event('change'));
67 67
@@ -84,18 +84,18 @@ describe('setName', function() {
84 84
85 85 it('should set node name', function() {
86 86 node = d.getElementById('node-' + ID);
87 -1 nodeName = node.querySelector('.body .name').textContent;
-1 87 nodeName = node.querySelector('.node__name').textContent;
88 88 expect(nodeName).to.equal(name);
89 89 });
90 90
91 91 it('should be permanent', function(done) {
92 92 browser.reload(function() {
93 93 d = browser.contentDocument;
94 -1 userName = d.querySelector('#name input').value;
-1 94 userName = d.querySelector('.user__name input').value;
95 95 expect(userName).to.equal(name);
96 96
97 97 node = d.getElementById('node-' + ID);
98 -1 nodeName = node.querySelector('.body .name').textContent;
-1 98 nodeName = node.querySelector('.node__name').textContent;
99 99 expect(nodeName).to.equal(name);
100 100
101 101 done();
@@ -114,7 +114,7 @@ describe('setComment', function() {
114 114 browser = b;
115 115 d = browser.contentDocument;
116 116
117 -1 userComment = d.querySelector('#comment textarea');
-1 117 userComment = d.querySelector('.user__comment textarea');
118 118 userComment.value = comment;
119 119 userComment.dispatchEvent(new Event('change'));
120 120
@@ -137,18 +137,22 @@ describe('setComment', function() {
137 137
138 138 it('should set node comment', function() {
139 139 node = d.getElementById('node-' + ID);
140 -1 nodeComment = node.querySelector('.body .comment').textContent.trim();
-1 140 nodeExpand = node.querySelector('.node__expand');
-1 141 nodeExpand.dispatchEvent(new Event('click'));
-1 142 nodeComment = node.querySelector('.node__comment').textContent.trim();
141 143 expect(nodeComment).to.equal(comment);
142 144 });
143 145
144 146 it('should be permanent', function(done) {
145 147 browser.reload(function() {
146 148 d = browser.contentDocument;
147 -1 userComment = d.querySelector('#comment textarea').value;
-1 149 userComment = d.querySelector('.user__comment textarea').value;
148 150 expect(userComment).to.equal(comment);
149 151
150 152 node = d.getElementById('node-' + ID);
151 -1 nodeComment = node.querySelector('.body .comment').textContent.trim();
-1 153 nodeExpand = node.querySelector('.node__expand');
-1 154 nodeExpand.dispatchEvent(new Event('click'));
-1 155 nodeComment = node.querySelector('.node__comment').textContent.trim();
152 156 expect(nodeComment).to.equal(comment);
153 157
154 158 done();
@@ -177,14 +181,14 @@ describe('remove', function() {
177 181 browser.contentWindow.confirm = function() {return true};
178 182
179 183 // create something to delete
180 -1 userName = d.querySelector('#name input');
-1 184 userName = d.querySelector('.user__name input');
181 185 userName.value = 'testName';
182 186 userName.dispatchEvent(new Event('change'));
183 -1 userComment = d.querySelector('#comment textarea');
-1 187 userComment = d.querySelector('.user__comment textarea');
184 188 userComment.value = 'testComment';
185 189 userComment.dispatchEvent(new Event('change'));
186 190
187 -1 userRemove = d.querySelector('#rm');
-1 191 userRemove = d.querySelector('.user__rm');
188 192 userRemove.dispatchEvent(new Event('click'));
189 193
190 194 setTimeout(done, TIMEOUT);
@@ -201,12 +205,12 @@ describe('remove', function() {
201 205 });
202 206
203 207 it('should clear user name', function() {
204 -1 userName = d.querySelector('#name input').value;
-1 208 userName = d.querySelector('.user__name input').value;
205 209 expect(userName).to.equal('');
206 210 });
207 211
208 212 it('should clear user comment', function() {
209 -1 userComment = d.querySelector('#comment textarea').value;
-1 213 userComment = d.querySelector('.user__comment textarea').value;
210 214 expect(userComment).to.equal('');
211 215 });
212 216