Skip to content

Commit 764717a

Browse files
committed
fixup! fix(docs-infra): configure Firebase to strip off the .html extension
1 parent ef1e851 commit 764717a

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

‎aio/tests/deployment/e2e/redirection.e2e-spec.ts‎

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ describe(browser.baseUrl, () => {
1313
afterEach(() => browser.waitForAngularEnabled(true));
1414

1515
describe('(with sitemap URLs)', () => {
16-
page.sitemapUrls.forEach((url, i) => {
17-
it(`should not redirect '${url}' (${i + 1}/${page.sitemapUrls.length})`, async () => {
18-
await page.goTo(url);
16+
page.sitemapUrls.forEach((path, i) => {
17+
it(`should not redirect '${path}' (${i + 1}/${page.sitemapUrls.length})`, async () => {
18+
await page.goTo(path);
1919

20-
const expectedUrl = stripTrailingSlash(page.baseUrl + url);
20+
const expectedUrl = stripTrailingSlash(page.baseUrl + path);
2121
const actualUrl = await getCurrentUrl();
2222

2323
expect(actualUrl).toBe(expectedUrl);
@@ -38,14 +38,28 @@ describe(browser.baseUrl, () => {
3838
});
3939
});
4040

41+
describe('(with `.html` URLs)', () => {
42+
['/path/to/file.html', '/top-level-file.html'].forEach(fromPath => {
43+
const toPath = fromPath.replace(/\.html$/, '');
44+
it(`should redirect '${fromPath}' to '${toPath}'`, async () => {
45+
await page.goTo(fromPath);
46+
47+
const expectedUrl = page.baseUrl + toPath;
48+
const actualUrl = await getCurrentUrl();
49+
50+
expect(actualUrl).toBe(expectedUrl);
51+
});
52+
});
53+
});
54+
4155
describe('(with unknown URLs)', () => {
42-
const unknownPageUrl = '/unknown/page';
43-
const unknownResourceUrl = '/unknown/resource.ext';
56+
const unknownPagePath = '/unknown/page';
57+
const unknownResourcePath = '/unknown/resource.ext';
4458

4559
it('should serve `index.html` for unknown pages', async () => {
4660
const aioShell = element(by.css('aio-shell'));
4761
const heading = aioShell.element(by.css('h1'));
48-
await page.goTo(unknownPageUrl);
62+
await page.goTo(unknownPagePath);
4963

5064
expect(aioShell.isPresent()).toBe(true);
5165
expect(heading.getText()).toMatch(/page not found/i);
@@ -54,15 +68,15 @@ describe(browser.baseUrl, () => {
5468
it('should serve a custom 404 page for unknown resources', async () => {
5569
const aioShell = element(by.css('aio-shell'));
5670
const heading = aioShell.element(by.css('h1'));
57-
await page.goTo(unknownResourceUrl);
71+
await page.goTo(unknownResourcePath);
5872

5973
expect(aioShell.isPresent()).toBe(true);
6074
expect(heading.getText()).toMatch(/resource not found/i);
6175
});
6276

6377
it('should include a link to the home page in custom 404 page', async () => {
6478
const homeNavLink = element(by.css('.nav-link.home'));
65-
await page.goTo(unknownResourceUrl);
79+
await page.goTo(unknownResourcePath);
6680

6781
expect(homeNavLink.isPresent()).toBe(true);
6882

0 commit comments

Comments
 (0)