|
| 1 | +module.exports = { |
| 2 | + |
| 3 | + 'Check if the p-tag with the class license-text is present': function(browser) { |
| 4 | + browser |
| 5 | + .init() |
| 6 | + .assert.elementPresent('.control-label > span') |
| 7 | + .click('.control-label > span') |
| 8 | + .assert.elementPresent('.pagination-next') |
| 9 | + .click('.pagination-next') |
| 10 | + .assert.elementPresent('.select > select') |
| 11 | + .click('.select') |
| 12 | + .click('option[value="CC BY-SA 4.0"]') |
| 13 | + .assert.elementPresent('.pagination-next') |
| 14 | + .click('.pagination-next') |
| 15 | + .assert.elementPresent('p[class="license-text"]') |
| 16 | + }, |
| 17 | + 'Check if the links in the license code redirects properly': function(browser) { |
| 18 | + browser |
| 19 | + .setValue('input[placeholder="Jane Doe"]', 'Jane Doe') |
| 20 | + .setValue('input[placeholder="www.author.com"]', 'www.author.com') |
| 21 | + .setValue('input[placeholder="This work"]', 'This work') |
| 22 | + .setValue('input[placeholder="www.author.com/work.jpg"]', 'www.author.com/work.jpg') |
| 23 | + .assert.elementPresent('p[class="license-text"] a') |
| 24 | + .getAttribute('p > span > a:nth-child(1)', 'href', function(result) { |
| 25 | + this.assert.equal(result.value, 'http://localhost:8080/www.author.com/work.jpg') |
| 26 | + }) |
| 27 | + .getAttribute('p > span > a:nth-child(2)', 'href', function(result) { |
| 28 | + this.assert.equal(result.value, 'http://localhost:8080/www.author.com') |
| 29 | + }) |
| 30 | + .getAttribute('p > span > a:nth-child(4)', 'href', function(result) { |
| 31 | + this.assert.equal(result.value, 'https://creativecommons.org/licenses/by-sa/4.0/?ref=ccchooser') |
| 32 | + }) |
| 33 | + }, |
| 34 | + 'Check if the text is displayed under the print attribution': function(browser) { |
| 35 | + browser |
| 36 | + .click('nav > ul > li:nth-child(2) > a') |
| 37 | + .assert.elementPresent('p[class="license-text"]') |
| 38 | + .assert.elementPresent('#attribution-text > p > span:nth-child(1)') |
| 39 | + .assert.elementPresent('#attribution-text > p > span:nth-child(2)') |
| 40 | + }, |
| 41 | + |
| 42 | + // Tests for the text under the "Plain Text" |
| 43 | + |
| 44 | + 'Check if the work in plain text is displayed': function(browser) { |
| 45 | + browser |
| 46 | + .click('nav > ul > li:nth-child(2) > a') |
| 47 | + .expect.element('#attribution-text > p > span:nth-child(1) > span:nth-child(1)').text.to.equal('This work') |
| 48 | + }, |
| 49 | + 'Check if the license in plain text is displayed': function(browser) { |
| 50 | + browser |
| 51 | + .expect.element('#attribution-text > p > span:nth-child(1) > span:nth-child(4)').text.to.equal('CC BY-SA 4.0') |
| 52 | + }, |
| 53 | + 'Check if the author-name in plain text is displayed': function(browser) { |
| 54 | + browser |
| 55 | + .expect.element('#attribution-text > p > span:nth-child(1) > span:nth-child(2) > span').text.to.equal('Jane Doe') |
| 56 | + }, |
| 57 | + 'Check if the license-details in plain text are displayed': function(browser) { |
| 58 | + browser |
| 59 | + .click('nav > ul > li:nth-child(2) > a') |
| 60 | + .assert.elementPresent('#attribution-text > p > span:nth-child(2)') |
| 61 | + .expect.element('#attribution-text > p > span:nth-child(2)').text.to.equal('. To view a copy of this license, visit https://creativecommons.org/licenses/by-sa/4.0') |
| 62 | + } |
| 63 | +} |
0 commit comments