Skip to content

Commit

Permalink
refactor base url
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrodri committed Apr 4, 2024
1 parent 790fb3e commit 17309ca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 3 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { defineConfig, devices } from '@playwright/test';
*/
require('dotenv').config();

const BASE_URL = process.env.PLAYWRIGHT_TEST_BASE_URL || "http://localhost:3000";

/**
* See https://playwright.dev/docs/test-configuration.
*/
Expand All @@ -24,7 +26,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
baseURL: BASE_URL,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand Down
12 changes: 5 additions & 7 deletions tests/disconnected/homepage/desktop.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { test, expect } from "@playwright/test";
import { test } from "@playwright/test";

const BASE_URL =
process.env.PLAYWRIGHT_TEST_BASE_URL || "http://localhost:3000";
const validTenants = ["optimism", "ens", "etherfi", "lyra"];
const tenant: string = process.env.NEXT_PUBLIC_AGORA_INSTANCE_NAME || "";

Expand All @@ -15,14 +13,14 @@ if (!validTenants.includes(tenant)) {

test.describe('homepage desktop', () => {
test('connect wallet button', async ({ page }) => {
await page.goto(BASE_URL);
await page.getByText('Connect Wallet').click();
await page.goto('/');
await page.getByText('Connect Wallet').first().click();
await page.getByRole('button', { name: 'MetaMask' }).click();
await page.getByLabel('Close').click();
await page.getByText('Connect Wallet').click();
await page.getByText('Connect Wallet').first().click();
await page.getByRole('button', { name: 'Coinbase Wallet' }).click();
await page.getByLabel('Close').click();
await page.getByText('Connect Wallet').click();
await page.getByText('Connect Wallet').first().click();
await page.getByRole('button', { name: 'Other Wallets' }).click();
await page.getByLabel('Close').click();
});
Expand Down
6 changes: 3 additions & 3 deletions tests/disconnected/homepage/metadata.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { test, expect } from "@playwright/test";

// TODO: frh -> move all this into a fixture
const BASE_URL =
process.env.PLAYWRIGHT_TEST_BASE_URL || "http://localhost:3000";
// TODO: frh -> typescript
// TODO: frh -> tests are failing on other browsers and connect wallet
const validTenants = ["optimism", "ens", "etherfi", "lyra"];
const tenant: string = process.env.NEXT_PUBLIC_AGORA_INSTANCE_NAME || "";

Expand All @@ -16,7 +16,7 @@ if (!validTenants.includes(tenant)) {


test('homepage metadata', async ({ page }) => {
await page.goto(BASE_URL);
await page.goto('/');

// TODO: frh -> WIP this should be automatically get from multitenancy and check better what each tag is for
const title = await page.title();
Expand Down

0 comments on commit 17309ca

Please sign in to comment.