-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
201 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
test("check if navbar with correct tag is present", async ({ page }) => { | ||
// Navigate to the page you want to test | ||
await page.goto("/"); | ||
|
||
// Check if the navbar with aria-label="Navbar" is present | ||
const navbar = await page.getByRole("tablist", { name: "Navbar" }); | ||
await expect(navbar).toBeVisible(); | ||
|
||
if (navbar) { | ||
const tagName = await navbar.evaluate((el) => el.tagName.toLowerCase()); | ||
expect(tagName).toBe("nav"); | ||
} | ||
}); | ||
|
||
test("open command menu", async ({ page }) => { | ||
// Navigate to the page you want to test | ||
await page.goto("/"); | ||
|
||
// Check if the navbar with aria-label="Navbar" is present | ||
const navbar = await page.getByRole("tablist", { name: "Navbar" }); | ||
await expect(navbar).toBeVisible(); | ||
|
||
// Locate the command menu button | ||
const commandMenuButton = page.getByLabel("Command Menu"); | ||
await expect(commandMenuButton).toBeVisible(); | ||
|
||
// Click the command menu button | ||
await commandMenuButton.click(); | ||
|
||
// Check if the command menu modal is visible | ||
const commandMenu = page.getByLabel("Command Menu⌘/Ctrl KEsc"); | ||
await expect(commandMenu).toBeVisible(); | ||
}); | ||
|
||
test("search for a command in the command menu", async ({ page }) => { | ||
// Navigate to the page you want to test | ||
await page.goto("/"); | ||
|
||
// Check if the navbar with aria-label="Navbar" is present | ||
const navbar = await page.getByRole("tablist", { name: "Navbar" }); | ||
await expect(navbar).toBeVisible(); | ||
|
||
// Locate the command menu button | ||
const commandMenuButton = page.getByLabel("Command Menu"); | ||
await expect(commandMenuButton).toBeVisible(); | ||
|
||
// Click the command menu button | ||
await commandMenuButton.click(); | ||
|
||
// Check if the command menu modal is visible | ||
const commandMenu = page.getByLabel("Command Menu⌘/Ctrl KEsc"); | ||
await expect(commandMenu).toBeVisible(); | ||
|
||
// Locate the search input | ||
const searchInput = commandMenu.getByPlaceholder("What do you need?"); | ||
await expect(searchInput).toBeVisible(); | ||
|
||
// Type a partial command in the search input | ||
await searchInput.fill("exp"); | ||
|
||
// Check if the command menu modal is still visible | ||
await expect(commandMenu).toBeVisible(); | ||
|
||
// Locate the first command in the list | ||
const firstCommand = commandMenu.getByLabel("Experience"); | ||
await expect(firstCommand).toBeVisible(); | ||
|
||
// Click the first command in the list | ||
await firstCommand.click(); | ||
|
||
// Check if the command menu modal is closed | ||
await expect(commandMenu).not.toBeVisible(); | ||
|
||
// Check if the URL is correct | ||
await expect(page).toHaveURL("/experience"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
test("check if navbar with correct tag is present", async ({ page }) => { | ||
// Navigate to the page you want to test | ||
await page.goto("/"); | ||
|
||
// Check if the navbar with aria-label="Navbar" is present | ||
const navbar = await page.getByRole('tablist', { name: 'Navbar' }); | ||
await expect(navbar).toBeVisible(); | ||
|
||
if (navbar) { | ||
const tagName = await navbar.evaluate((el) => el.tagName.toLowerCase()); | ||
expect(tagName).toBe("nav"); | ||
} | ||
}); | ||
|
||
test("go to experience page", async ({ page }) => { | ||
// Navigate to the page you want to test | ||
await page.goto("/"); | ||
|
||
// Locate the navbar with aria-label="Navbar" and tag <nav> | ||
const navbar = page.locator('nav[aria-label="Navbar"]'); | ||
await expect(navbar).toBeVisible(); | ||
|
||
// Check if each element of the navbar contains an "a" button with href="/experience" | ||
const anchor = navbar.locator('a[href="/experience"]'); | ||
await expect(anchor).toBeVisible(); | ||
|
||
// Click the anchor button and verify the URL | ||
await anchor.click(); | ||
await expect(page).toHaveURL("/experience"); | ||
}); | ||
|
||
test("go to project page", async ({ page }) => { | ||
// Navigate to the page you want to test | ||
await page.goto("/"); | ||
|
||
// Locate the navbar with aria-label="Navbar" and tag <nav> | ||
const navbar = page.locator('nav[aria-label="Navbar"]'); | ||
await expect(navbar).toBeVisible(); | ||
|
||
// Check if each element of the navbar contains an "a" button with href="/project" | ||
const anchor = navbar.locator('a[href="/project"]'); | ||
await expect(anchor).toBeVisible(); | ||
|
||
// Click the anchor button and verify the URL | ||
await anchor.click(); | ||
await expect(page).toHaveURL("/project"); | ||
}); | ||
|
||
test("go to blog page", async ({ page }) => { | ||
// Navigate to the page you want to test | ||
await page.goto("/"); | ||
|
||
// Locate the navbar with aria-label="Navbar" and tag <nav> | ||
const navbar = page.locator('nav[aria-label="Navbar"]'); | ||
await expect(navbar).toBeVisible(); | ||
|
||
// Check if each element of the navbar contains an "a" button with href="/blog" | ||
const anchor = navbar.locator('a[href="/blog"]'); | ||
await expect(anchor).toBeVisible(); | ||
|
||
// Click the anchor button and verify the URL | ||
await anchor.click(); | ||
await expect(page).toHaveURL("/blog"); | ||
}); | ||
|
||
test("go to stack page", async ({ page }) => { | ||
// Navigate to the page you want to test | ||
await page.goto("/"); | ||
|
||
// Locate the navbar with aria-label="Navbar" and tag <nav> | ||
const navbar = page.locator('nav[aria-label="Navbar"]'); | ||
await expect(navbar).toBeVisible(); | ||
|
||
// Check if each element of the navbar contains an "a" button with href="/stack" | ||
const anchor = navbar.locator('a[href="/stack"]'); | ||
await expect(anchor).toBeVisible(); | ||
|
||
// Click the anchor button and verify the URL | ||
await anchor.click(); | ||
await expect(page).toHaveURL("/stack"); | ||
}); | ||
|
||
test("go to contact page", async ({ page }) => { | ||
// Navigate to the page you want to test | ||
await page.goto("/"); | ||
|
||
// Locate the navbar with aria-label="Navbar" and tag <nav> | ||
const navbar = page.locator('nav[aria-label="Navbar"]'); | ||
await expect(navbar).toBeVisible(); | ||
|
||
// Check if each element of the navbar contains an "a" button with href="/contact" | ||
const anchor = navbar.locator('a[href="/contact"]'); | ||
await expect(anchor).toBeVisible(); | ||
|
||
// Click the anchor button and verify the URL | ||
await anchor.click(); | ||
await expect(page).toHaveURL("/contact"); | ||
}); |
This file was deleted.
Oops, something went wrong.