|
1 | | -## Usage |
| 1 | +# twd-solid-example |
2 | 2 |
|
3 | | -Those templates dependencies are maintained via [pnpm](https://pnpm.io) via `pnpm up -Lri`. |
| 3 | +A showcase SolidJS + Vite application demonstrating end-to-end testing with [TWD (Test Web Dev)](https://brikev.github.io/twd/). This project includes a complete todo list application with comprehensive test coverage using TWD. |
4 | 4 |
|
5 | | -This is the reason you see a `pnpm-lock.yaml`. That being said, any package manager will work. This file can be safely be removed once you clone a template. |
| 5 | +## About TWD |
| 6 | + |
| 7 | +[Test Web Dev (TWD)](https://brikev.github.io/twd/) is a powerful testing framework for web applications. It provides seamless mocking, DOM interactions, and visual regression testing capabilities. This project showcases how easily TWD integrates with SolidJS applications. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +- **SolidJS + TypeScript**: Reactive, performant UI with full type safety |
| 12 | +- **Tailwind CSS**: Utility-first styling for responsive design |
| 13 | +- **Todo Application**: Full-featured todo list with create, read, and delete operations |
| 14 | +- **TWD Testing**: End-to-end tests demonstrating TWD capabilities with SolidJS |
| 15 | +- **Mock API Server**: JSON Server for local API mocking |
| 16 | +- **SolidJS Router**: Client-side routing with multiple pages |
| 17 | + |
| 18 | +## Recommended IDE Setup |
| 19 | + |
| 20 | +[VS Code](https://code.visualstudio.com/) + [Solid Language Support](https://marketplace.visualstudio.com/items?itemName=solid-js.solid-devtools-language-support) |
| 21 | + |
| 22 | +## Recommended Browser Setup |
| 23 | + |
| 24 | +- Chromium-based browsers (Chrome, Edge, Brave, etc.): |
| 25 | + - [Solid Devtools](https://chromewebstore.google.com/detail/solid-devtools/kmcfjchnmmaeeagadbhoofajiopoceel) |
| 26 | +- Firefox: |
| 27 | + - [Solid Devtools](https://addons.mozilla.org/en-US/firefox/addon/solid-devtools/) |
| 28 | + |
| 29 | +Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs) |
| 30 | + |
| 31 | +## Project Structure |
6 | 32 |
|
7 | | -```bash |
8 | | -$ npm install # or pnpm install or yarn install |
| 33 | +``` |
| 34 | +src/ |
| 35 | +├── pages/ # Page components (HelloWorld, Todos, NotFound) |
| 36 | +├── api/ # API client functions |
| 37 | +└── twd-tests/ # TWD end-to-end tests |
| 38 | + ├── helloWorld.twd.test.ts |
| 39 | + └── todoList.twd.test.ts |
| 40 | + └── mocks/ |
| 41 | + └── todoList.json |
9 | 42 | ``` |
10 | 43 |
|
11 | | -### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs) |
| 44 | +## Testing with TWD |
12 | 45 |
|
13 | | -## Available Scripts |
| 46 | +This project includes TWD tests for: |
| 47 | +- **Hello World Page**: Counter button functionality and page rendering |
| 48 | +- **Todo List**: CRUD operations (Create, Read, Delete) with mock API requests |
| 49 | + |
| 50 | +Run tests by executing TWD in your testing environment. Refer to the [TWD documentation](https://brikev.github.io/twd/) for detailed testing instructions. |
14 | 51 |
|
15 | | -In the project directory, you can run: |
| 52 | +## Project Setup |
16 | 53 |
|
17 | | -### `npm run dev` or `npm start` |
| 54 | +```sh |
| 55 | +npm install # or pnpm install or yarn install |
| 56 | +``` |
| 57 | + |
| 58 | +Those template dependencies are maintained via [pnpm](https://pnpm.io) via `pnpm up -Lri`. This is the reason you see a `pnpm-lock.yaml`. That being said, any package manager will work. |
| 59 | + |
| 60 | +### Compile and Hot-Reload for Development |
| 61 | + |
| 62 | +```sh |
| 63 | +npm run serve:dev |
| 64 | +``` |
| 65 | + |
| 66 | +This command runs both the development server and the mock API server in parallel. The app will be available at `http://localhost:5173` and the API at `http://localhost:3001`. |
18 | 67 |
|
19 | | -Runs the app in the development mode.<br> |
20 | | -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. |
| 68 | +### Run Tests with TWD |
21 | 69 |
|
22 | | -The page will reload if you make edits.<br> |
| 70 | +```sh |
| 71 | +npm run dev |
| 72 | +``` |
| 73 | + |
| 74 | +TWD is automatically initialized in development mode and will be available in the browser. |
| 75 | + |
| 76 | +### Compile and Minify for Production |
23 | 77 |
|
24 | | -### `npm run build` |
| 78 | +```sh |
| 79 | +npm run build |
| 80 | +``` |
| 81 | + |
| 82 | +Builds the app for production to the `dist` folder. It correctly bundles Solid in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes. |
25 | 83 |
|
26 | | -Builds the app for production to the `dist` folder.<br> |
27 | | -It correctly bundles Solid in production mode and optimizes the build for the best performance. |
| 84 | +## Available Scripts |
28 | 85 |
|
29 | | -The build is minified and the filenames include the hashes.<br> |
30 | | -Your app is ready to be deployed! |
| 86 | +- **`npm run dev`** or **`npm start`**: Run the Vite dev server only at http://localhost:5173 |
| 87 | +- **`npm run build`**: Build for production |
| 88 | +- **`npm run serve`**: Run the mock API server only at http://localhost:3001 |
| 89 | +- **`npm run serve:dev`**: Run both dev server and API server in parallel |
31 | 90 |
|
32 | 91 | ## Deployment |
33 | 92 |
|
|
0 commit comments