-
Notifications
You must be signed in to change notification settings - Fork 3
/
frontend.js
58 lines (56 loc) · 2.22 KB
/
frontend.js
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
module.exports = {
tags: ['default'],
'Step one: page is properly formed' : function (client) {
client
.url('localhost:3000')
.waitForElementVisible('body', 1000)
.assert.title('Amazin\' Affiliate Link Checker')
.assert.visible('#link-checker-title')
.assert.visible('#enter-tag')
.assert.visible('#enter-key-id')
.assert.visible('#enter-secret')
.assert.visible('#enter-url')
.assert.visible('#button-submit-form')
},
'Step two: page rejects empty form fields' : function (client) {
client
.waitForElementVisible('#button-submit-form')
.click('#button-submit-form')
.pause(1000)
.assert.cssClassPresent('#enter-tag', 'is-invalid')
.assert.cssClassPresent('#enter-key-id', 'is-invalid')
.assert.cssClassPresent('#enter-secret', 'is-invalid')
.assert.cssClassPresent('#enter-url', 'is-invalid')
},
'Step three: form rejects URL without http(s) protocol, clears error once http:// or https:// is included' : function (client) {
client
.setValue('#enter-url', 'test.com')
.click('#button-submit-form')
.pause(500)
.assert.cssClassPresent('#enter-url', 'is-invalid')
.clearValue('#enter-url')
.setValue('#enter-url', 'http://not-so-secure-blog.com')
.click('#button-submit-form')
.pause(500)
.assert.cssClassNotPresent('#enter-url', 'is-invalid')
.clearValue('#enter-url')
.setValue('#enter-url', 'https://super-secure-blog.com')
.click('#button-submit-form')
.pause(500)
.assert.cssClassNotPresent('#enter-url', 'is-invalid')
},
'Step four: page accepts a form with filled-in fields and a URL with https://' : function (client) {
client
.setValue('#enter-tag', 'test-tag')
.setValue('#enter-key-id', 'TEST-KEY-ID')
.setValue('#enter-secret', 'TEST-SECRET')
.setValue('#enter-url', 'https://link-checker-test.com')
.click('#button-submit-form')
.pause(500)
.assert.cssClassNotPresent('#enter-tag', 'is-invalid')
.assert.cssClassNotPresent('#enter-key-id', 'is-invalid')
.assert.cssClassNotPresent('#enter-secret', 'is-invalid')
.assert.cssClassNotPresent('#enter-url', 'is-invalid')
.end();
}
};