-
Notifications
You must be signed in to change notification settings - Fork 22
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
12 changed files
with
377 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Playwright Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- development | ||
- noah/playwright | ||
pull_request: | ||
branches: | ||
- main | ||
- development | ||
- noah/playwright | ||
|
||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: yarn | ||
- run: yarn install | ||
- name: Install Playwright browsers | ||
run: yarn playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: yarn test:e2e | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: apps/dapp/playwright-report/ | ||
retention-days: 30 |
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,87 @@ | ||
// GNU AFFERO GENERAL PUBLIC LICENSE Version 3. Copyright (C) 2022 DAO DAO Contributors. | ||
// See the "LICENSE" file in the root directory of this package for more copyright information. | ||
import { defineConfig, devices } from '@playwright/test' | ||
import dotenv from 'dotenv' | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
dotenv.config() | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './tests', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: 'html', | ||
/* 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', | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
|
||
/* Test against mobile viewports. */ | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 5'] }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 12'] }, | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
// { | ||
// name: 'Microsoft Edge', | ||
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
], | ||
|
||
/* Build and run server before starting the tests */ | ||
webServer: { | ||
command: 'yarn build && yarn start', | ||
url: 'http://127.0.0.1:3000', | ||
reuseExistingServer: !process.env.CI, | ||
// allow 10 minutes for the server to build | ||
timeout: 10 * 60 * 1000, | ||
}, | ||
|
||
expect: { | ||
// Default expect timeout to 20 seconds. | ||
timeout: 20 * 1000, | ||
}, | ||
}) |
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,21 @@ | ||
// GNU AFFERO GENERAL PUBLIC LICENSE Version 3. Copyright (C) 2022 DAO DAO Contributors. | ||
// See the "LICENSE" file in the root directory of this package for more copyright information. | ||
|
||
import { expect, test } from '@playwright/test' | ||
|
||
import './setup' | ||
|
||
test('create DAO page renders', async ({ page }) => { | ||
await page.goto('/dao/create') | ||
|
||
// Expect "New DAO" header to exist. | ||
await expect( | ||
page.locator('div.header-text').filter({ hasText: 'New DAO' }).first() | ||
).toBeVisible() | ||
|
||
// Expect "Log in" button to exist. | ||
await expect(page.getByRole('button', { name: 'Log in' })).toBeVisible() | ||
|
||
// Expect "Continue" button to exist. | ||
await expect(page.getByRole('button', { name: 'Continue' })).toBeVisible() | ||
}) |
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,110 @@ | ||
// GNU AFFERO GENERAL PUBLIC LICENSE Version 3. Copyright (C) 2022 DAO DAO Contributors. | ||
// See the "LICENSE" file in the root directory of this package for more copyright information. | ||
|
||
import { expect, test } from '@playwright/test' | ||
|
||
import './setup' | ||
|
||
test('DAO home tab renders', async ({ page }) => { | ||
await page.goto( | ||
'/dao/juno1vh0xndu9pj8g0lat6k3500mxusfduh804sf9hj7jpt4kgj0gmreq3jmqj4' | ||
) | ||
|
||
// Expect no 404 error. | ||
await expect(page.getByText('404: Not Found')).not.toBeVisible({ | ||
timeout: 5000, | ||
}) | ||
|
||
// Expect description to exist. | ||
await expect(page.getByText('Worship the moon.')).toBeVisible() | ||
}) | ||
|
||
test('DAO proposals tab renders', async ({ page }) => { | ||
await page.goto( | ||
'/dao/juno1vh0xndu9pj8g0lat6k3500mxusfduh804sf9hj7jpt4kgj0gmreq3jmqj4/proposals' | ||
) | ||
|
||
// Expect no 404 error. | ||
await expect(page.getByText('404: Not Found')).not.toBeVisible({ | ||
timeout: 5000, | ||
}) | ||
|
||
// Expect description to exist. | ||
await expect(page.getByText('Worship the moon.')).toBeVisible() | ||
|
||
// Expect "New proposal" button to exist. | ||
await expect(page.getByText('New proposal', { exact: true })).toBeVisible() | ||
}) | ||
|
||
test('DAO treasury tab renders', async ({ page }) => { | ||
await page.goto( | ||
'/dao/juno1vh0xndu9pj8g0lat6k3500mxusfduh804sf9hj7jpt4kgj0gmreq3jmqj4/treasury' | ||
) | ||
|
||
// Expect no 404 error. | ||
await expect(page.getByText('404: Not Found')).not.toBeVisible({ | ||
timeout: 5000, | ||
}) | ||
|
||
// Expect description to exist. | ||
await expect(page.getByText('Worship the moon.')).toBeVisible() | ||
|
||
// Expect "Copy address" button to exist. | ||
await expect(page.getByText('Copy address', { exact: true })).toBeVisible() | ||
|
||
// Expect "Tokens" title to exist. | ||
await expect(page.getByText('Tokens', { exact: true })).toBeVisible() | ||
}) | ||
|
||
test('DAO subDAOs tab renders', async ({ page }) => { | ||
await page.goto( | ||
'/dao/juno1vh0xndu9pj8g0lat6k3500mxusfduh804sf9hj7jpt4kgj0gmreq3jmqj4/subdaos' | ||
) | ||
|
||
// Expect no 404 error. | ||
await expect(page.getByText('404: Not Found')).not.toBeVisible({ | ||
timeout: 5000, | ||
}) | ||
|
||
// Expect description to exist. | ||
await expect(page.getByText('Worship the moon.')).toBeVisible() | ||
|
||
// Expect "New SubDAO" button to exist. | ||
await expect(page.getByText('New SubDAO', { exact: true })).toBeVisible() | ||
}) | ||
|
||
test('DAO members tab renders', async ({ page }) => { | ||
await page.goto( | ||
'/dao/juno1vh0xndu9pj8g0lat6k3500mxusfduh804sf9hj7jpt4kgj0gmreq3jmqj4/members' | ||
) | ||
|
||
// Expect no 404 error. | ||
await expect(page.getByText('404: Not Found')).not.toBeVisible({ | ||
timeout: 5000, | ||
}) | ||
|
||
// Expect description to exist. | ||
await expect(page.getByText('Worship the moon.')).toBeVisible() | ||
|
||
// Expect member voting power title to exist. | ||
await expect( | ||
page.getByText('Voting power', { exact: true }).first() | ||
).toBeVisible() | ||
}) | ||
|
||
test('DAO apps tab renders', async ({ page }) => { | ||
await page.goto( | ||
'/dao/juno1vh0xndu9pj8g0lat6k3500mxusfduh804sf9hj7jpt4kgj0gmreq3jmqj4/apps' | ||
) | ||
|
||
// Expect no 404 error. | ||
await expect(page.getByText('404: Not Found')).not.toBeVisible({ | ||
timeout: 5000, | ||
}) | ||
|
||
// Expect description to exist. | ||
await expect(page.getByText('Worship the moon.')).toBeVisible() | ||
|
||
// Expect member voting power title to exist. | ||
await expect(page.getByRole('button', { name: 'Go' }).first()).toBeVisible() | ||
}) |
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,36 @@ | ||
// GNU AFFERO GENERAL PUBLIC LICENSE Version 3. Copyright (C) 2022 DAO DAO Contributors. | ||
// See the "LICENSE" file in the root directory of this package for more copyright information. | ||
|
||
import { expect, test } from '@playwright/test' | ||
|
||
import './setup' | ||
|
||
test('home page renders', async ({ page }) => { | ||
await page.goto('/') | ||
|
||
// Expect "Log in" button to exist. | ||
await expect(page.getByRole('button', { name: 'Log in' })).toBeVisible() | ||
|
||
// Expect "Chain governance" title to exist. | ||
await expect( | ||
page.getByText('Chain governance', { exact: true }) | ||
).toBeVisible() | ||
|
||
// Expect "Featured DAOs" title to exist. | ||
await expect(page.getByText('Featured DAOs', { exact: true })).toBeVisible() | ||
}) | ||
|
||
test('chain-specific home page renders', async ({ page }) => { | ||
await page.goto('/juno') | ||
|
||
// Expect "Log in" button to exist. | ||
await expect(page.getByRole('button', { name: 'Log in' })).toBeVisible() | ||
|
||
// Expect "Chain governance" title to exist. | ||
await expect( | ||
page.getByText('Chain governance', { exact: true }) | ||
).toBeVisible() | ||
|
||
// Expect "Featured DAOs" title to exist. | ||
await expect(page.getByText('Featured DAOs', { exact: true })).toBeVisible() | ||
}) |
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,16 @@ | ||
// GNU AFFERO GENERAL PUBLIC LICENSE Version 3. Copyright (C) 2022 DAO DAO Contributors. | ||
// See the "LICENSE" file in the root directory of this package for more copyright information. | ||
|
||
/** | ||
* Set up tests. | ||
*/ | ||
|
||
import { test } from '@playwright/test' | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.addInitScript(() => { | ||
// Mark beta warning as approved so it doesn't appear and block the rest of | ||
// the page. | ||
window.localStorage.setItem('betaWarningAccepted', 'true') | ||
}) | ||
}) |
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,15 @@ | ||
// GNU AFFERO GENERAL PUBLIC LICENSE Version 3. Copyright (C) 2022 DAO DAO Contributors. | ||
// See the "LICENSE" file in the root directory of this package for more copyright information. | ||
|
||
import { expect, test } from '@playwright/test' | ||
|
||
import './setup' | ||
|
||
test('status page renders', async ({ page }) => { | ||
await page.goto('/status') | ||
|
||
// Expect "Status" header to exist. | ||
await expect( | ||
page.locator('p.header-text').filter({ hasText: 'Status' }) | ||
).toBeVisible() | ||
}) |
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 |
---|---|---|
@@ -1,10 +1,15 @@ | ||
// GNU AFFERO GENERAL PUBLIC LICENSE Version 3. Copyright (C) 2022 DAO DAO Contributors. | ||
// See the "LICENSE" file in the root directory of this package for more copyright information. | ||
|
||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | ||
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ | ||
module.exports = { | ||
moduleDirectories: ['node_modules', '<rootDir>'], | ||
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'], | ||
testPathIgnorePatterns: [ | ||
'<rootDir>/.next/', | ||
'<rootDir>/node_modules/', | ||
// playwright e2e tests, not jest. jest unit tests are spread throughout | ||
'<rootDir>/apps/dapp/tests/' | ||
], | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
} |
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
Oops, something went wrong.