Skip to content

Commit

Permalink
ci(tests): configure pipelines for automated testing
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhthomas committed Nov 15, 2023
1 parent 6249415 commit d068b0b
Show file tree
Hide file tree
Showing 5 changed files with 830 additions and 131 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: End-to-End Tests
name: Automated Tests
on:
push:
branches: [main, master]
Expand All @@ -17,11 +17,7 @@ jobs:
run: npm install -g pnpm && pnpm install
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm exec playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Run Integration Tests (Playwright)
run: pnpm run test:integration
- name: Run Unit Tests (Vitest)
run: pnpm run test:unit
134 changes: 69 additions & 65 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,71 @@
{
"name": "firefly-iii-svelte",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test": "vitest",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"api:generate": "openapi-generator-cli generate -g typescript-fetch -i ./src/lib/api/firefly-iii-2.0.10-v1.yaml -o ./src/lib/api"
},
"dependencies": {
"@iconify/svelte": "^3.1.4",
"@popperjs/core": "^2.11.8",
"@tanstack/svelte-query": "^4.36.1",
"ag-grid-community": "^30.2.0",
"ag-grid-svelte": "^0.3.0",
"chart.js": "^4.4.0",
"d3-scale-chromatic": "^3.0.0",
"dayjs": "^1.11.10",
"flowbite": "^2.0.0",
"flowbite-svelte": "^0.44.19",
"svelte-chartjs": "^3.1.2",
"svelte-modals": "^1.3.0",
"tailwind-merge": "^2.0.0",
"ts-pattern": "^5.0.5"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.7.0",
"@playwright/test": "^1.39.0",
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.25.2",
"@tailwindcss/forms": "0.5.6",
"@tailwindcss/typography": "0.5.10",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/d3-scale-chromatic": "^3.0.1",
"@types/node": "20.8.6",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"autoprefixer": "10.4.16",
"dotenv": "^16.3.1",
"eslint": "^8.51.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-no-relative-import-paths": "^1.5.3",
"eslint-plugin-svelte": "^2.34.0",
"eslint-plugin-unused-imports": "^3.0.0",
"postcss": "8.4.31",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"resolve": "^1.22.8",
"svelte": "^4.2.1",
"svelte-check": "^3.5.2",
"svelte-headless-table": "^0.17.7",
"tailwindcss": "3.3.3",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vite-plugin-tailwind-purgecss": "0.1.3",
"vitest": "^0.34.6"
}
"name": "firefly-iii-svelte",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test:integration": "playwright test",
"test:unit": "vitest",
"test": "run-s test:integration test:unit",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
"api:generate": "openapi-generator-cli generate -g typescript-fetch -i ./src/lib/api/firefly-iii-2.0.10-v1.yaml -o ./src/lib/api"
},
"dependencies": {
"@iconify/svelte": "^3.1.4",
"@popperjs/core": "^2.11.8",
"@tanstack/svelte-query": "^4.36.1",
"ag-grid-community": "^30.2.0",
"ag-grid-svelte": "^0.3.0",
"chart.js": "^4.4.0",
"d3-scale-chromatic": "^3.0.0",
"dayjs": "^1.11.10",
"flowbite": "^2.0.0",
"flowbite-svelte": "^0.44.19",
"svelte-chartjs": "^3.1.2",
"svelte-modals": "^1.3.0",
"tailwind-merge": "^2.0.0",
"ts-pattern": "^5.0.5"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.7.0",
"@playwright/test": "^1.39.0",
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.25.2",
"@tailwindcss/forms": "0.5.6",
"@tailwindcss/typography": "0.5.10",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/d3-scale-chromatic": "^3.0.1",
"@types/node": "20.8.6",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"autoprefixer": "10.4.16",
"dotenv": "^16.3.1",
"eslint": "^8.51.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-no-relative-import-paths": "^1.5.3",
"eslint-plugin-svelte": "^2.34.0",
"eslint-plugin-unused-imports": "^3.0.0",
"npm-run-all": "^4.1.5",
"postcss": "8.4.31",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"resolve": "^1.22.8",
"svelte": "^4.2.1",
"svelte-check": "^3.5.2",
"svelte-headless-table": "^0.17.7",
"tailwindcss": "3.3.3",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vite-plugin-tailwind-purgecss": "0.1.3",
"vitest": "^0.34.6",
"vitest-github-actions-reporter": "^0.10.0"
}
}
114 changes: 57 additions & 57 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,68 @@ import { defineConfig, devices } from '@playwright/test';
* 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',
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: process.env.CI ? 'github' : 'list',
/* 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://localhost:5173',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* 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'] },
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] }
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] }
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
{
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 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' },
// },
],
/* 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: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
/* Run your local dev server before starting the tests */
webServer: {
command: 'pnpm run dev',
url: 'http://localhost:5173',
reuseExistingServer: !process.env.CI
}
});
Loading

0 comments on commit d068b0b

Please sign in to comment.