Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resources tests #425

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions apps/new/widget/page/resources/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,20 @@ const config = {
},
migrationGuide: {
init: {
name: "MigrationGuide",
name: "Migration Guide",
},
},
installation: {
init: {
name: "Installation",
},
},
setup: {
init: {
name: "Setup",
},
},
// Hidden because not available yet
// setup: {
// init: {
// name: "Setup",
// },
// },
},
},
migrationGuide: {
Expand All @@ -99,17 +100,17 @@ const config = {
},
hide: true,
},
setup: {
path: "${alias_old}/widget/Resources",
blockHeight: "final",
init: {
feedName: "Setup",
name: "Setup",
mdPath:
"https://raw.githubusercontent.com/NEARBuilders/bos-workspace-docs/main/md/getting_started/setup.md",
},
hide: true,
},
// setup: {
// path: "${alias_old}/widget/Resources",
// blockHeight: "final",
// init: {
// feedName: "Setup",
// name: "Setup",
// mdPath:
// "https://raw.githubusercontent.com/NEARBuilders/bos-workspace-docs/main/md/getting_started/setup.md",
// },
// hide: true,
// },
gettingStarted: {
path: "${alias_old}/widget/Resources",
blockHeight: "final",
Expand Down
120 changes: 120 additions & 0 deletions playwright-tests/tests/resources.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { expect, test } from "@playwright/test";
import { ROOT_SRC } from "../util/constants";

test.describe("?page=resources", () => {
test.beforeEach(async ({ page }) => {
await page.goto(`/${ROOT_SRC}?page=resources`);
});

test("Should navigate to default page", async ({ page }) => {
const guideButton = await page.getByRole("button", {
name: "Guide",
});
await guideButton.click();
const h1 = await page.getByRole("heading", { name: "Resources" });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const h1 = await page.getByRole("heading", { name: "Resources" });
const pageHeading = await page.getByRole("heading", { name: "Resources" });

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rename it everywhere else, h1 doesn't really make sense

await expect(h1).toBeVisible();
});

test("Should navigate to Working with VM page", async ({ page }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test("Should navigate to Working with VM page", async ({ page }) => {
test("Should navigate to 'Working with VM page'", async ({ page }) => {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's wrap page headers inside '' to differentiate it

const workingWithVMButton = await page.getByRole("button", {
name: "Working with VM",
});
await workingWithVMButton.click();
const h1 = await page.getByRole("heading", { name: "Working with the VM" });
await expect(h1).toBeVisible();
});

test("Should navigate to Getting Started page", async ({ page }) => {
const gettingStartedButton = await page.getByRole("button", {
name: "Getting Started",
});
await gettingStartedButton.click();
const gettingStartedLink = await page.getByRole("link", {
name: "Getting Started",
});
await gettingStartedLink.click();
const h1 = await page.getByRole("heading", { name: "bos-workspace" });
await expect(h1).toBeVisible();
});

test("Should navigate to Migration Guide page", async ({ page }) => {
const gettingStartedButton = await page.getByRole("button", {
name: "Getting Started",
});
await gettingStartedButton.click();
const migrationGuideLink = await page.getByRole("link", {
name: "Migration Guide",
});
await migrationGuideLink.click();
const h1 = await page.getByRole("heading", { name: "Migration Guide" });
await expect(h1).toBeVisible();
});

test("Should navigate to Installation page", async ({ page }) => {
const gettingStartedButton = await page.getByRole("button", {
name: "Getting Started",
});
await gettingStartedButton.click();
const installationLink = await page.getByRole("link", {
name: "Installation",
});
await installationLink.click();
const h1 = await page.getByRole("heading", { name: "Installation 🏗️" });
await expect(h1).toBeVisible();
});

test("Should navigate to Usage page", async ({ page }) => {
const usageButton = await page.getByRole("button", {
name: "Usage",
});
await usageButton.click();
const usageLink = await page.getByRole("link", {
name: "Usage",
});
await usageLink.click();
const h1 = await page.getByRole("heading", { name: "Usage 👷🏽‍♀️" });
await expect(h1).toBeVisible();
});

test("Should navigate to Aliases page", async ({ page }) => {
const usageButton = await page.getByRole("button", {
name: "Usage",
});
await usageButton.click();
const aliasesLink = await page.getByRole("link", {
name: "Aliases",
});
await aliasesLink.click();
const h1 = await page.getByRole("heading", { name: "aliases" });
await expect(h1).toBeVisible();
});

test("Should navigate to Deploying Widgets page", async ({ page }) => {
const deployingWidgetsButton = await page.getByRole("button", {
name: "Deploying Widgets",
});
await deployingWidgetsButton.click();
const h1 = await page.getByRole("heading", { name: "Deployment" });
await expect(h1).toBeVisible();
});

test("Should navigate to Web 4.0 Deployment page", async ({ page }) => {
const web4Button = await page.getByRole("button", {
name: "Web 4.0 Deployment",
});
await web4Button.click();
const h1 = await page.getByRole("heading", { name: "deploy to web4" });
await expect(h1).toBeVisible();
});

test("Should navigate to adding new resources page", async ({ page }) => {
const newResourcesButton = await page.getByRole("button", {
name: "Adding New Resources",
});
await newResourcesButton.click();
const h1 = await page.getByRole("heading", {
name: "Adding new Resources",
});
await expect(h1).toBeVisible();
});
});
Loading