TenantAtlas/apps/website/tests/smoke/public-routes.spec.ts

43 lines
1.2 KiB
TypeScript

import { expect, test } from '@playwright/test';
import {
expectNoForbiddenPublicText,
expectNoHorizontalOverflow,
redirectRoutes,
renderedRoutes,
} from './smoke-helpers';
for (const route of renderedRoutes) {
test(`renders intentional route ${route}`, async ({ page }) => {
await page.goto(route);
await expect(page.locator('body')).toContainText('Tenantial');
await expectNoForbiddenPublicText(page);
await expectNoHorizontalOverflow(page);
});
}
for (const route of redirectRoutes) {
test(`redirects ${route} intentionally`, async ({ page }) => {
await page.goto(route);
await expect(page).toHaveURL(/\/platform\/?$/);
await expect(page.getByRole('heading', { name: /Platform review model/ }))
.toBeVisible();
});
}
test('robots and sitemap are available', async ({ page }) => {
await page.goto('/robots.txt');
await expect(page.locator('body')).toContainText('Sitemap:');
await page.goto('/sitemap-index.xml');
await expect(page.locator('body')).toContainText('sitemap-0.xml');
await page.goto('/sitemap-0.xml');
const sitemap = await page.locator('body').innerText();
for (const route of redirectRoutes) {
expect(sitemap).not.toContain(`https://tenantial.com${route}/`);
}
});