From a058424b2d8b29b50fa907b75b8d0d58d517641d Mon Sep 17 00:00:00 2001 From: "Felix C. Morency" <1102868+fmorency@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:11:12 -0500 Subject: [PATCH] test: playwright boilerplate --- .gitignore | 5 +++ bun.lockb | Bin 556468 -> 558644 bytes e2e/landing.spec.ts | 6 ++++ package.json | 6 ++-- playwright.config.ts | 83 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 e2e/landing.spec.ts create mode 100644 playwright.config.ts 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 6ab9498fa29559db9c2d5768714f0eadefe75015..e8752d9c5835e39f7d6ef20e4c6e50a51099f2e1 100755 GIT binary patch delta 6669 zcmeHMc~lfvzOL%-D!b4Qiz1sS8f|42P^@M^M2yC$7*QiQxFL!f6&;NcTpmPYT#jTQ z75yQCpr8?#xG~e3Gdg*hoG2m+nsL;CYgCNEEs1N?_x-wyBxhdUzwfW9b3VTNefM|Q zy0_|fQT42I)!HukVSxh&xVEi1Uv~T3DKj6cA$=w-Z?3Do{-(9g(yrE%`Zj-AvBE6y z6F5vVzQ>LcRc~@94Z`QPVQ?rH2 zJW+6kp8>Xj(>`?a{C5^io{u_5K)b^a`LnZpJhU71XWDz+yLoo;HLwxxTV@83QW zg?7kPHBs;cTftn|N7J5mx8}G(Dv&QxuMfCtohSr=`>Yp*){Zb|+lQgKFRjQ~eBRWw z^mjsM%%7SycWOGuBovB*2lDHX&v6r>x!xP#SHO4RbAF><{>lc2&dEKC1UJ--$>4t0 z=(@{BQRo2O8tetW0rmyIEE0t_;QV4yXbV1y3b~>58KE;WGv){t7ywU35tt`;-qa~m zdD4A1Im=~$*|&f#s5v)%dfKd+7{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GO&8U{+d;DG)^IAL7x90$x7rw0pawf3(-yLW5)jWs!7fPq!s#9T2HXYizzUa& zE;F2wBjV)Qy?U79Xv*aXf%VoYlOCdrs!1DaO@ua;QCg%4G^S-y2uygR2B{Tvi^_o{}1c%b&Bm zr_dkE8Qebq!BPJlJ#?+wA9Kn6rzJ;M%Q54i%%OArew2@y+6t$(GQVK+Pn)k=dRmIX z=H&iq^fYz@vpFL%0;GBTsWid!dYP%$Jt$bhkSVFS)cPJJy0j5+Z~b9$D4ckxvL z%MoNv*jw{fj98uXDrX2|pPrFITr7u{J<^^fd>lPu+N%=g#%U^oY9vS2{;cH8|1aYM z*wnLGhP`YKyqx0W7!{(=}@oi>Z|yg__MQ zrB+HY_r!@^uf=^HTgY7Na1SgeqA3@@U47s{c?cQ_HLseALKasi#Ry*)v7$Q3U#Kl& zKh#M%Vl9qlY?*C= { + 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, + }, +});