diff --git a/.gitignore b/.gitignore index d4819365..7b002d87 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,8 @@ yarn-error.log* next-env.d.ts .idea/ +node_modules/ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ diff --git a/bun.lockb b/bun.lockb index 6ab9498f..e8752d9c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/e2e/landing.spec.ts b/e2e/landing.spec.ts new file mode 100644 index 00000000..f3a203ee --- /dev/null +++ b/e2e/landing.spec.ts @@ -0,0 +1,6 @@ +import { test, expect } from '@playwright/test'; + +test('has title', async ({ page }) => { + await page.goto('/'); + await expect(page).toHaveTitle(/Alberto - Blockchain App/); +}); diff --git a/package.json b/package.json index 3e98d793..2b33852a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ }, "dependencies": { "@chain-registry/assets": "^1.64.83", - "@liftedinit/manifestjs": "0.0.1-alpha.19", "@cosmjs/cosmwasm-stargate": "0.32.4", "@cosmjs/stargate": "npm:@liftedinit/stargate@0.32.4-ll.3", "@cosmos-kit/react": "2.18.0", @@ -40,6 +39,7 @@ "@headlessui/react": "^1.7.18", "@heroicons/react": "^2.1.5", "@interchain-ui/react": "1.23.31", + "@liftedinit/manifestjs": "0.0.1-alpha.19", "@react-three/drei": "^9.114.0", "@react-three/fiber": "^8.17.8", "@tanstack/react-query": "^5.55.0", @@ -76,6 +76,7 @@ }, "devDependencies": { "@happy-dom/global-registrator": "^15.7.3", + "@playwright/test": "^1.49.0", "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/forms": "^0.5.3", "@tailwindcss/typography": "^0.5.8", @@ -85,13 +86,14 @@ "@types/bad-words": "^3.0.3", "@types/crypto-js": "^4.2.2", "@types/identicon.js": "^2.3.4", + "@types/node": "^22.9.1", "@types/react": "18.3.5", "@types/react-dom": "18.3.0", "@types/react-scroll": "^1.8.10", "@types/three": "^0.169.0", "bun-types": "^1.1.29", "codecov": "^3.8.3", - "eslint": "8.56.0", + "eslint": "8.57.1", "eslint-config-next": "13.0.5", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 00000000..88b8fd43 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,83 @@ +import { defineConfig, devices } from '@playwright/test'; + +/** + * Read environment variables from file. + * https://github.com/motdotla/dotenv + */ +// import dotenv from 'dotenv'; +// import path from 'path'; +// dotenv.config({ path: path.resolve(__dirname, '.env') }); + +/** + * See https://playwright.dev/docs/test-configuration. + */ +export default defineConfig({ + testDir: './e2e', + /* 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 Chrome (landscape)', + use: { ...devices['Pixel 5 landscape'] }, + }, + // { + // 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' }, + // }, + ], + + /* Run your local dev server before starting the tests */ + webServer: { + command: 'bun run start', + url: 'http://127.0.0.1:3000', + reuseExistingServer: !process.env.CI, + }, +});