create-react-adam 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -0
- package/bin/index.js +245 -0
- package/package.json +43 -0
- package/template/.e2e-deps.json +11 -0
- package/template/.github/renovate.json +24 -0
- package/template/.github/workflows/check.yml +36 -0
- package/template/.github/workflows/e2e.yml +48 -0
- package/template/.nvmrc +2 -0
- package/template/.prettierrc +3 -0
- package/template/README.md +83 -0
- package/template/e2e/README.md +94 -0
- package/template/e2e/example.spec.ts +14 -0
- package/template/eslint.config.js +54 -0
- package/template/index.html +12 -0
- package/template/package-lock.json +6571 -0
- package/template/package.json +47 -0
- package/template/playwright.config.ts +25 -0
- package/template/src/App.tsx +17 -0
- package/template/src/app.css +29 -0
- package/template/src/main.tsx +13 -0
- package/template/src/pages/About/index.no-utils.tsx +39 -0
- package/template/src/pages/About/index.tsx +97 -0
- package/template/src/pages/Home/index.no-utils.tsx +53 -0
- package/template/src/pages/Home/index.tsx +94 -0
- package/template/src/pages/NotFound/index.tsx +23 -0
- package/template/src/utils/Internet.ts +22 -0
- package/template/src/utils/Storage.ts +86 -0
- package/template/src/utils/classNames.ts +3 -0
- package/template/src/utils/useUrlState.ts +27 -0
- package/template/src/vite-env.d.ts +1 -0
- package/template/tsconfig.json +21 -0
- package/template/vite.config.ts +9 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# E2E Testing
|
|
2
|
+
|
|
3
|
+
This project uses [Playwright](https://playwright.dev/) for end-to-end testing.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Install Playwright and dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx playwright install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add these scripts to your `package.json`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test:e2e": "playwright test",
|
|
18
|
+
"test:e2e:ui": "playwright test --ui",
|
|
19
|
+
"test:e2e:report": "allure generate ./allure-results --clean && allure open"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Running Tests
|
|
24
|
+
|
|
25
|
+
**Run all tests (headless):**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run test:e2e
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Run with UI mode (interactive):**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm run test:e2e:ui
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Run in headed mode (see browser):**
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm run test:e2e -- --headed
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Run specific test file:**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm run test:e2e -- example.spec.ts
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Debug mode:**
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm run test:e2e -- --debug
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## View Reports
|
|
56
|
+
|
|
57
|
+
**HTML report (generated after test run):**
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx playwright show-report
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Allure report:**
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm run test:e2e:report
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Writing Tests
|
|
70
|
+
|
|
71
|
+
Tests are located in the `e2e/` directory. See `example.spec.ts` for a basic example.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { test, expect } from "@playwright/test";
|
|
75
|
+
|
|
76
|
+
test("my test", async ({ page }) => {
|
|
77
|
+
await page.goto("/");
|
|
78
|
+
await expect(page.getByRole("heading")).toBeVisible();
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Configuration
|
|
83
|
+
|
|
84
|
+
The test configuration is in `playwright.config.ts`:
|
|
85
|
+
|
|
86
|
+
- Dev server automatically starts before tests
|
|
87
|
+
- Tests run on `http://localhost:5173`
|
|
88
|
+
- Chromium browser is used by default
|
|
89
|
+
|
|
90
|
+
To add more browsers, edit `playwright.config.ts` and install them:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npx playwright install firefox webkit
|
|
94
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { expect, test } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
test("basic navigation works", async ({ page }) => {
|
|
4
|
+
await page.goto("/");
|
|
5
|
+
|
|
6
|
+
await expect(page.getByRole("heading", { name: /welcome/i })).toBeVisible();
|
|
7
|
+
|
|
8
|
+
await page.getByRole("link", { name: /about/i }).click();
|
|
9
|
+
await expect(page).toHaveURL("/about");
|
|
10
|
+
await expect(page.getByRole("heading", { name: /about/i })).toBeVisible();
|
|
11
|
+
|
|
12
|
+
await page.getByRole("link", { name: /home/i }).click();
|
|
13
|
+
await expect(page).toHaveURL("/");
|
|
14
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import prettier from "eslint-config-prettier";
|
|
3
|
+
import deMorgan from "eslint-plugin-de-morgan";
|
|
4
|
+
import importPlugin from "eslint-plugin-import";
|
|
5
|
+
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
6
|
+
import promisePlugin from "eslint-plugin-promise";
|
|
7
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
8
|
+
import reactRefresh from "eslint-plugin-react-refresh";
|
|
9
|
+
import unicorn from "eslint-plugin-unicorn";
|
|
10
|
+
import tseslint from "typescript-eslint";
|
|
11
|
+
|
|
12
|
+
export default tseslint.config({
|
|
13
|
+
extends: [
|
|
14
|
+
eslint.configs.recommended,
|
|
15
|
+
...tseslint.configs.recommended,
|
|
16
|
+
...tseslint.configs.strict,
|
|
17
|
+
prettier,
|
|
18
|
+
promisePlugin.configs["flat/recommended"],
|
|
19
|
+
importPlugin.flatConfigs.recommended,
|
|
20
|
+
importPlugin.flatConfigs.typescript,
|
|
21
|
+
unicorn.configs["unopinionated"],
|
|
22
|
+
deMorgan.configs.recommended,
|
|
23
|
+
],
|
|
24
|
+
plugins: {
|
|
25
|
+
"jsx-a11y": jsxA11y,
|
|
26
|
+
"react-hooks": reactHooks,
|
|
27
|
+
"react-refresh": reactRefresh,
|
|
28
|
+
},
|
|
29
|
+
languageOptions: {
|
|
30
|
+
parserOptions: {
|
|
31
|
+
ecmaFeatures: {
|
|
32
|
+
jsx: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
rules: {
|
|
37
|
+
"@typescript-eslint/no-unused-vars": [
|
|
38
|
+
"error",
|
|
39
|
+
{
|
|
40
|
+
argsIgnorePattern: "^_",
|
|
41
|
+
varsIgnorePattern: "^_",
|
|
42
|
+
caughtErrorsIgnorePattern: "^_",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
...jsxA11y.flatConfigs.strict.rules,
|
|
46
|
+
...reactHooks.configs.recommended.rules,
|
|
47
|
+
"react-refresh/only-export-components": [
|
|
48
|
+
"warn",
|
|
49
|
+
{ allowConstantExport: true },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
files: ["**/*.{ts,tsx}"],
|
|
53
|
+
ignores: ["dist"],
|
|
54
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>__PROJECT_NAME__</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|