Skip to content

Commit

Permalink
Navbar reg tests (#424)
Browse files Browse the repository at this point in the history
* test-btn-fix

* toggle gateway urls

* New changes in design implemented

* Network button implementation

* Login and Logout tests

* Image Uploader module

* Implemented Files component

* lp-reg-tests

* start project and explore projects changes in redirection

* added the assertion for login and changed the structure

* added wait

* connect-btn-test-fix

* added wait for create project title

* navbar-reg-tests

* added page visiblity assertions

* fixed source btn locator

---------

Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>
  • Loading branch information
Eren-Yeaager and elliotBraem authored Jun 20, 2024
1 parent eae0df2 commit 3c5847f
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 128 deletions.
128 changes: 0 additions & 128 deletions playwright-tests/tests/landing-page.spec.js

This file was deleted.

80 changes: 80 additions & 0 deletions playwright-tests/tests/navbar.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { expect, test } from "@playwright/test";
import { ROOT_SRC } from "../util/constants";

test.describe("Navbar", () => {
test.use({
storageState: "playwright-tests/storage-states/wallet-connected.json",
});
test.beforeEach(async ({ page }) => {
await page.goto(`/${ROOT_SRC}`);
});

test("Notifications", async ({ page }) => {
const notificationsButton = page.locator("i.bi.bi-bell").nth(0);
await page.waitForTimeout(1000);
await notificationsButton.click();
await expect(page).toHaveURL(/.*\?page=notifications/);
});

test("View source", async ({ page }) => {
const btn = page.locator("i.bi.bi-three-dots");
await page.waitForTimeout(1000);
await expect(btn).toBeVisible();
await btn.click();
const viewSourceOption = page.getByText("View source", { exact: true });
await page.waitForTimeout(1000);
await expect(viewSourceOption).toBeVisible();
await viewSourceOption.click();
await expect(page).toHaveURL(
/.*\?page=inspect&widgetPath=builddao.testnet\/widget\/page.home.Index/,
);
await page.waitForTimeout(2000);
expect(
page.locator("a.btn.btn-sm.btn-outline-secondary.border-0").nth(0),
).toHaveText("Source");
});

test("Edit Code", async ({ page }) => {
const btn1 = page.locator("i.bi.bi-three-dots");
await page.waitForTimeout(1000);
await expect(btn1).toBeVisible();
await btn1.click();
const editCodeOption = page.getByText("Edit code", { exact: true });
await page.waitForTimeout(1000);
await expect(editCodeOption).toBeVisible();
await editCodeOption.click();
await expect(page).toHaveURL(/.*\/edit\//);
});
test("Network Button -Mainet", async ({ page }) => {
const networkButton = page.getByText("Network", { exact: true });
await page.waitForTimeout(1000);
await expect(networkButton).toBeVisible();
await networkButton.click();
const mainetOption = page.getByText("Mainnet", { exact: true });
await page.waitForTimeout(1000);
await expect(mainetOption).toBeVisible();
await mainetOption.click();
await page.waitForTimeout(1000);
if (page.url().includes(ROOT_SRC)) {
expect(page.url()).toContain("/builddao.near/widget/Index");
} else {
expect(page.url()).toContain("https://www.nearbuilders.org/");
}
});
test("Network Button -Testnet", async ({ page }) => {
const networkButton = page.getByText("Network", { exact: true });
await page.waitForTimeout(1000);
await expect(networkButton).toBeVisible();
await networkButton.click();
const testnetOption = page.getByText("Testnet", { exact: true });
await page.waitForTimeout(1000);
await expect(testnetOption).toBeVisible();
await testnetOption.click();
await page.waitForTimeout(1000);
if (page.url().includes(ROOT_SRC)) {
expect(page.url()).toContain(`/${ROOT_SRC}`);
} else {
expect(page.url()).toContain("https://test.nearbuilders.org/");
}
});
});

0 comments on commit 3c5847f

Please sign in to comment.