Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added in modifications from original playwright branch to this one #113

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Playwright Tests
on:
pull_request:
branches: [ develop]
jobs:
playwright-test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci #equivalent to npm ci
- name: Install Playwright Browsers #install browsers
run: pnpm playwright install --with-deps
- name: Run Playwright tests
run: pnpm playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

*storybook.log
*storybook.log

#playwright
/blob-report/
/playwright/.cache/
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,25 @@ Run Storybook in the project root
```
npm run storybook
```

## React Testing Library (RTL) && Jest

Run RTL && Jest in the project root

```
pnpm test
```

## Playwright Testing


Run all Playwright tests

```
pnpm playwright test
```

Run single Playwright tests

```
pnpm playwright test (name of file)
111 changes: 56 additions & 55 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
{
"private": true,
"version": "0.1.0",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"test": "jest --passWithNoTests",
"test:watch": "jest --watchAll --passWithNoTests",
"storybook-docs": "storybook dev --docs",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"@radix-ui/react-slot": "^1.0.2",
"@supabase/ssr": "latest",
"@supabase/supabase-js": "latest",
"autoprefixer": "10.4.15",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"geist": "^1.2.2",
"lucide-react": "^0.312.0",
"next": "latest",
"postcss": "8.4.29",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwind-merge": "^2.2.2",
"tailwindcss": "3.3.3",
"tailwindcss-animate": "^1.0.7",
"typescript": "5.1.3"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.2.25",
"@storybook/addon-essentials": "^8.0.4",
"@storybook/addon-interactions": "^8.0.4",
"@storybook/addon-links": "^8.0.4",
"@storybook/addon-onboarding": "^8.0.4",
"@storybook/blocks": "^8.0.4",
"@storybook/nextjs": "^8.0.4",
"@storybook/react": "^8.0.4",
"@storybook/test": "^8.0.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.2",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"@types/node": "20.3.1",
"@types/react": "18.2.8",
"@types/react-dom": "18.2.5",
"encoding": "^0.1.13",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"storybook": "^8.0.4",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"typescript": "5.1.3"
}
"private": true,
"version": "0.1.0",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"test": "jest --passWithNoTests",
"test:watch": "jest --watchAll --passWithNoTests",
"storybook-docs": "storybook dev --docs",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"@radix-ui/react-slot": "^1.0.2",
"@supabase/ssr": "latest",
"@supabase/supabase-js": "latest",
"autoprefixer": "10.4.15",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"geist": "^1.2.2",
"lucide-react": "^0.312.0",
"next": "latest",
"postcss": "8.4.29",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwind-merge": "^2.2.2",
"tailwindcss": "3.3.3",
"tailwindcss-animate": "^1.0.7",
"typescript": "5.1.3"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.2.25",
"@playwright/test": "^1.42.1",
"@storybook/addon-essentials": "^8.0.4",
"@storybook/addon-interactions": "^8.0.4",
"@storybook/addon-links": "^8.0.4",
"@storybook/addon-onboarding": "^8.0.4",
"@storybook/blocks": "^8.0.4",
"@storybook/nextjs": "^8.0.4",
"@storybook/react": "^8.0.4",
"@storybook/test": "^8.0.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.2",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"@types/node": "20.3.1",
"@types/react": "18.2.8",
"@types/react-dom": "18.2.5",
"encoding": "^0.1.13",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"storybook": "^8.0.4",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"typescript": "5.1.3"
}
}
68 changes: 68 additions & 0 deletions playwright-report/index.html

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { defineConfig, devices } from '@playwright/test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './',
/* 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'] },
},
],

});
35 changes: 35 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions tests/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test, expect } from '@playwright/test';

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

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/);
});

test('get started link', async ({ page }) => {
await page.goto('https://playwright.dev/');

// Click the get started link.
await page.getByRole('link', { name: 'Get started' }).click();

// Expects page to have a heading with the name of Installation.
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
});
Loading