Skip to content

Commit

Permalink
chore: initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jvbriones committed May 22, 2024
1 parent 5b914b6 commit f501596
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# E2E PLAYWRIGHT VALUES
# PWDEBUG=1
E2E_BASE_URL=
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @jvbriones
27 changes: 27 additions & 0 deletions .github/workflows/validate_changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Validate changes
on:
push:
branches: main
pull_request:

jobs:
E2E-scenarios:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm install -g yarn && yarn
- name: Install Playwright Browsers
run: yarn playwright install --with-deps chromium
- name: 🧪 Run Playwright tests
run: E2E_BASE_URL=https://portfolio.metamask.io/ yarn test:e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-tests-report
path: test-results/
retention-days: 15
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/node_modules
.env
.DS_Store
.vscode/*
.idea
/test-results/
/playwright-report/

11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# tmpqachallenge1
# E2E demo project

## Setup
> yarn
## Run tests in local
> npx playwright test --grep '@tag'
## CI pipeline
Github workflow under /.github/workflows/validate_changes.yml
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "e2e-demo-project",
"version": "0.0.1",
"license": "UNDEFINED",
"devDependencies": {
"@playwright/test": "^1.44.0",
"@types/node": "^20.12.12"
},
"scripts": {
"test:e2e-smoke": "xvfb-run yarn playwright test -g @e2e"
},
"dependencies": {
"dotenv": "^16.4.5"
}
}
34 changes: 34 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { defineConfig, devices } from '@playwright/test';
require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: process.env.CI ? 2 : 1,
reporter: [
['list'],
['html', { outputFolder: 'test-results/e2e-html-report', open: 'never' }],
['junit', { outputFile: 'test-results/e2e-junit.xml' }],
],
outputDir: 'test-results/e2e-test-artifacts',
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.E2E_BASE_URL + '/',
screenshot: 'on',
video: 'on-first-retry',
trace: 'on-first-retry',
userAgent: 'Playwright E2E Tests',
},

projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
}
],
});
14 changes: 14 additions & 0 deletions tests/feature1.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
});

test('Watch account @smoke', async ({ page }) => {
await page.goto('.');
await page.getByPlaceholder('Wallet address or ENS name').fill('vitalik.eth');
await page.getByRole('button', { name: 'Watch address' }).click();
await page.locator('#sidebar-item-Dashboard').click();
await page.locator('tr').filter({ hasText: 'Ethereum' }).first().click()
});
46 changes: 46 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@playwright/test@^1.44.0":
version "1.44.0"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.44.0.tgz#ac7a764b5ee6a80558bdc0fcbc525fcb81f83465"
integrity sha512-rNX5lbNidamSUorBhB4XZ9SQTjAqfe5M+p37Z8ic0jPFBMo5iCtQz1kRWkEMg+rYOKSlVycpQmpqjSFq7LXOfg==
dependencies:
playwright "1.44.0"

"@types/node@^20.12.12":
version "20.12.12"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.12.tgz#7cbecdf902085cec634fdb362172dfe12b8f2050"
integrity sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==
dependencies:
undici-types "~5.26.4"

dotenv@^16.4.5:
version "16.4.5"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f"
integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==

[email protected]:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

[email protected]:
version "1.44.0"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.44.0.tgz#316c4f0bca0551ffb88b6eb1c97bc0d2d861b0d5"
integrity sha512-ZTbkNpFfYcGWohvTTl+xewITm7EOuqIqex0c7dNZ+aXsbrLj0qI8XlGKfPpipjm0Wny/4Lt4CJsWJk1stVS5qQ==

[email protected]:
version "1.44.0"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.44.0.tgz#22894e9b69087f6beb639249323d80fe2b5087ff"
integrity sha512-F9b3GUCLQ3Nffrfb6dunPOkE5Mh68tR7zN32L4jCk4FjQamgesGay7/dAAe1WaMEGV04DkdJfcJzjoCKygUaRQ==
dependencies:
playwright-core "1.44.0"
optionalDependencies:
fsevents "2.3.2"

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

0 comments on commit f501596

Please sign in to comment.