redirection.e2e-spec.ts (angular-11.0.1) | : | redirection.e2e-spec.ts (angular-11.0.2) | ||
---|---|---|---|---|
skipping to change at line 70 | skipping to change at line 70 | |||
const unknownPagePath = '/unknown/page'; | const unknownPagePath = '/unknown/page'; | |||
const unknownResourcePath = '/unknown/resource.ext'; | const unknownResourcePath = '/unknown/resource.ext'; | |||
it('should serve `index.html` for unknown pages', async () => { | it('should serve `index.html` for unknown pages', async () => { | |||
const aioShell = element(by.css('aio-shell')); | const aioShell = element(by.css('aio-shell')); | |||
const heading = aioShell.element(by.css('h1')); | const heading = aioShell.element(by.css('h1')); | |||
await page.goTo(unknownPagePath); | await page.goTo(unknownPagePath); | |||
await browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded. | await browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded. | |||
expect(aioShell.isPresent()).toBe(true); | expect(await aioShell.isPresent()).toBe(true); | |||
expect(heading.getText()).toMatch(/page not found/i); | expect(await heading.getText()).toMatch(/page not found/i); | |||
}); | }); | |||
it('should serve a custom 404 page for unknown resources', async () => { | it('should serve a custom 404 page for unknown resources', async () => { | |||
const aioShell = element(by.css('aio-shell')); | const aioShell = element(by.css('aio-shell')); | |||
const heading = aioShell.element(by.css('h1')); | const heading = aioShell.element(by.css('h1')); | |||
await page.goTo(unknownResourcePath); | await page.goTo(unknownResourcePath); | |||
expect(aioShell.isPresent()).toBe(true); | expect(await aioShell.isPresent()).toBe(true); | |||
expect(heading.getText()).toMatch(/resource not found/i); | expect(await heading.getText()).toMatch(/resource not found/i); | |||
}); | }); | |||
it('should include a link to the home page in custom 404 page', async () => { | it('should include a link to the home page in custom 404 page', async () => { | |||
const homeNavLink = element(by.css('.nav-link.home')); | const homeNavLink = element(by.css('.nav-link.home')); | |||
await page.goTo(unknownResourcePath); | await page.goTo(unknownResourcePath); | |||
expect(homeNavLink.isPresent()).toBe(true); | expect(await homeNavLink.isPresent()).toBe(true); | |||
await homeNavLink.click(); | await homeNavLink.click(); | |||
const expectedUrl = page.baseUrl; | const expectedUrl = page.baseUrl; | |||
const actualUrl = await getCurrentUrl(); | const actualUrl = await getCurrentUrl(); | |||
expect(actualUrl).toBe(expectedUrl); | expect(actualUrl).toBe(expectedUrl); | |||
}); | }); | |||
}); | }); | |||
}); | }); | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added |