|
| 1 | +module.exports = { |
| 2 | + 'redirect': function (browser) { |
| 3 | + browser |
| 4 | + .url('http://localhost:8080/redirect/') |
| 5 | + .waitForElementVisible('#app', 1000) |
| 6 | + .assert.count('li a', 6) |
| 7 | + // assert correct href with base |
| 8 | + .assert.attributeContains('li:nth-child(1) a', 'href', '/redirect/foo') |
| 9 | + .assert.attributeContains('li:nth-child(2) a', 'href', '/redirect/foo?foo=bar') |
| 10 | + .assert.attributeContains('li:nth-child(3) a', 'href', '/redirect/bar') |
| 11 | + .assert.attributeContains('li:nth-child(4) a', 'href', '/redirect/baz') |
| 12 | + .assert.attributeContains('li:nth-child(5) a', 'href', '/redirect/with-params/123') |
| 13 | + .assert.attributeContains('li:nth-child(6) a', 'href', '/redirect/') |
| 14 | + |
| 15 | + .assert.containsText('.view', 'default') |
| 16 | + |
| 17 | + .click('li:nth-child(1) a') |
| 18 | + .assert.urlEquals('http://localhost:8080/redirect/foo') |
| 19 | + .assert.containsText('.view', 'foo') |
| 20 | + |
| 21 | + .click('li:nth-child(2) a') |
| 22 | + .assert.urlEquals('http://localhost:8080/redirect/foo?foo=bar') |
| 23 | + .assert.containsText('.view', 'foo') |
| 24 | + |
| 25 | + .click('li:nth-child(3) a') |
| 26 | + .assert.urlEquals('http://localhost:8080/redirect/bar') |
| 27 | + .assert.containsText('.view', 'bar') |
| 28 | + |
| 29 | + .click('li:nth-child(4) a') |
| 30 | + .assert.urlEquals('http://localhost:8080/redirect/baz') |
| 31 | + .assert.containsText('.view', 'baz') |
| 32 | + |
| 33 | + .click('li:nth-child(5) a') |
| 34 | + .assert.urlEquals('http://localhost:8080/redirect/with-params/123') |
| 35 | + .assert.containsText('.view', '123') |
| 36 | + |
| 37 | + .click('li:nth-child(6) a') |
| 38 | + .assert.urlEquals('http://localhost:8080/redirect/') |
| 39 | + .assert.containsText('.view', 'default') |
| 40 | + |
| 41 | + // check initial visit |
| 42 | + .url('http://localhost:8080/redirect/relative-redirect') |
| 43 | + .waitForElementVisible('#app', 1000) |
| 44 | + .assert.urlEquals('http://localhost:8080/redirect/foo') |
| 45 | + .assert.containsText('.view', 'foo') |
| 46 | + |
| 47 | + .url('http://localhost:8080/redirect/relative-redirect?foo=bar') |
| 48 | + .waitForElementVisible('#app', 1000) |
| 49 | + .assert.urlEquals('http://localhost:8080/redirect/foo?foo=bar') |
| 50 | + .assert.containsText('.view', 'foo') |
| 51 | + |
| 52 | + .url('http://localhost:8080/redirect/absolute-redirect') |
| 53 | + .waitForElementVisible('#app', 1000) |
| 54 | + .assert.urlEquals('http://localhost:8080/redirect/bar') |
| 55 | + .assert.containsText('.view', 'bar') |
| 56 | + |
| 57 | + .url('http://localhost:8080/redirect/named-redirect') |
| 58 | + .waitForElementVisible('#app', 1000) |
| 59 | + .assert.urlEquals('http://localhost:8080/redirect/baz') |
| 60 | + .assert.containsText('.view', 'baz') |
| 61 | + |
| 62 | + .url('http://localhost:8080/redirect/redirect-with-params/123') |
| 63 | + .waitForElementVisible('#app', 1000) |
| 64 | + .assert.urlEquals('http://localhost:8080/redirect/with-params/123') |
| 65 | + .assert.containsText('.view', '123') |
| 66 | + |
| 67 | + .url('http://localhost:8080/redirect/not-found') |
| 68 | + .waitForElementVisible('#app', 1000) |
| 69 | + .assert.urlEquals('http://localhost:8080/redirect/') |
| 70 | + .assert.containsText('.view', 'default') |
| 71 | + .end() |
| 72 | + } |
| 73 | +} |
0 commit comments