Skip to content

Commit

Permalink
Merge pull request #26 from rocky-linux/feature/gh-24-redirect-cloud-…
Browse files Browse the repository at this point in the history
…images

Add redirect for old cloud images
  • Loading branch information
NebraskaCoder authored May 3, 2024
2 parents 5a75da4 + 9274f9b commit 82ab59d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
14 changes: 5 additions & 9 deletions e2e/Homepage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { test, expect } from "@playwright/test";
import { expectDownloadPage } from "./utils/PageUtils";

test.describe("Core Rocky Brand", () => {
test("has title", async ({ page }) => {
Expand All @@ -9,13 +10,8 @@ test.describe("Core Rocky Brand", () => {
});
});

test.describe("Downloads Flow", () => {
test("has two download buttons on desktop", async ({ page, isMobile }) => {
const verifyDownloadPage = async () => {
await expect(page).toHaveURL(/\/download/);
await expect(page).toHaveTitle(/Download - Rocky Linux/);
};

test.describe("Home Page Downloads Flow", () => {
test("has download buttons", async ({ page, isMobile }) => {
await page.goto("/");

// Check that we have a download button in the navigation on desktop.
Expand All @@ -28,7 +24,7 @@ test.describe("Downloads Flow", () => {

await navDownloadButton.click();

await verifyDownloadPage();
await expectDownloadPage(page);

await page.goBack();
}
Expand All @@ -43,6 +39,6 @@ test.describe("Downloads Flow", () => {

await heroDownloadButton.click();

await verifyDownloadPage();
await expectDownloadPage(page);
});
});
10 changes: 10 additions & 0 deletions e2e/Redirects.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { test } from "@playwright/test";
import { expectDownloadPage } from "./utils/PageUtils";

test.describe("Website Redirects", () => {
test("redirects old /cloud-images to /download", async ({ page }) => {
await page.goto("/cloud-images");

await expectDownloadPage(page);
});
});
6 changes: 6 additions & 0 deletions e2e/utils/PageUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { expect, type Page } from "@playwright/test";

export const expectDownloadPage = async (page: Page) => {
await expect(page).toHaveURL(/\/download/);
await expect(page).toHaveTitle(/Download - Rocky Linux/);
};
9 changes: 9 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ const nextConfig = {
images: {
domains: ["www.rockylinux.org", "rockylinux.org"],
},
async redirects() {
return [
{
source: "/cloud-images",
destination: "/download",
permanent: true,
},
];
},
};

module.exports = withNextIntl(nextConfig);

0 comments on commit 82ab59d

Please sign in to comment.