()
| 17 | let app |
| 18 | |
| 19 | const runTests = () => { |
| 20 | it('should allow manual href/as on index page', async () => { |
| 21 | const browser = await webdriver(appPort, '/') |
| 22 | |
| 23 | expect(await browser.elementByCss('#index').text()).toBe('index page') |
| 24 | expect(await browser.hasElementByCssSelector('#modal')).toBeFalsy() |
| 25 | await browser.eval('window.beforeNav = 1') |
| 26 | |
| 27 | await browser.elementByCss('#to-modal').click() |
| 28 | |
| 29 | expect(await browser.elementByCss('#index').text()).toBe('index page') |
| 30 | expect(await browser.hasElementByCssSelector('#modal')).toBeTruthy() |
| 31 | expect(await browser.eval('window.beforeNav')).toBe(1) |
| 32 | expect(JSON.parse(await browser.elementByCss('#query').text())).toEqual({ |
| 33 | imageId: '123', |
| 34 | }) |
| 35 | |
| 36 | await browser |
| 37 | .elementByCss('#to-preview') |
| 38 | .click() |
| 39 | .waitForElementByCss('#preview') |
| 40 | |
| 41 | expect(await browser.elementByCss('#preview').text()).toBe('preview page') |
| 42 | expect(await browser.eval('window.beforeNav')).toBe(1) |
| 43 | expect(JSON.parse(await browser.elementByCss('#query').text())).toEqual({ |
| 44 | slug: '123', |
| 45 | }) |
| 46 | |
| 47 | await browser.back() |
| 48 | |
| 49 | await browser |
| 50 | .elementByCss('#to-another') |
| 51 | .click() |
| 52 | .waitForElementByCss('#another') |
| 53 | |
| 54 | expect(await browser.elementByCss('#another').text()).toBe('another page') |
| 55 | expect(await browser.eval('window.beforeNav')).toBe(1) |
| 56 | expect(JSON.parse(await browser.elementByCss('#query').text())).toEqual({}) |
| 57 | |
| 58 | await browser.back() |
| 59 | |
| 60 | await browser.elementByCss('#to-rewrite-me').click() |
| 61 | |
| 62 | expect(await browser.elementByCss('#another').text()).toBe('another page') |
| 63 | expect(await browser.eval('window.beforeNav')).toBe(1) |
| 64 | expect(JSON.parse(await browser.elementByCss('#query').text())).toEqual({}) |
| 65 | |
| 66 | await browser.back() |
| 67 | |
| 68 | await browser |
| 69 | .elementByCss('#to-index-as-rewrite') |
| 70 | .click() |
| 71 | .waitForElementByCss('#index') |
| 72 | |
| 73 | expect(await browser.elementByCss('#index').text()).toBe('index page') |
| 74 | expect(await browser.eval('window.beforeNav')).toBe(1) |
| 75 | expect(JSON.parse(await browser.elementByCss('#query').text())).toEqual({}) |
| 76 | }) |
no test coverage detected