Skip to content

Commit 368848b

Browse files
author
Jason Laster
committed
Add more documentation
1 parent dc52077 commit 368848b

5 files changed

Lines changed: 134 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ As a developer, you most likely want to enable hot reloading. This means you can
5454
* `npm run cypress-intermittents` - Runs tests 100 times and writes the output to cypress-run.log
5555
* `cypress open` - Run tests in the browser
5656

57-
**Notes:**
58-
* Firefox needs to be open and listening on port 6080 before the tests are run. You can start Firefox on the right port with this command `npm run firefox`.
59-
* Cypress needs to be installed before tests can be run. When you run cypress the first time, you will be prompted to install it. `cypress install`.
57+
[More information](./docs/integration-tests.md).
6058

6159
### Linting
6260
* `npm run lint` - Run CSS and JS linter
@@ -67,7 +65,7 @@ As a developer, you most likely want to enable hot reloading. This means you can
6765
* `npm run test-all` - Run unit tests, lints, and integration tests
6866

6967
### Storybook
70-
* `npm run storybook` - Open Storybook
68+
* `npm run storybook` - Open Storybook. [more info](./docs/local-development.md#storybook)
7169

7270
## Configuration
7371

@@ -77,6 +75,8 @@ You can see default config values in `config/development.json`, and override the
7775
* `chrome.debug` enable local chrome development
7876
* `features.sourceTabs` enable editor tabs
7977

78+
[More Information](./docs/local-development.md#configs)
79+
8080
## Misc
8181

8282
### Enabling remote debugging in Firefox

docs/integration-tests.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
## Integration Tests
2+
3+
Debugger.html integration test are end-to-end tests that simulate a user debugging an application.
4+
5+
The tests open two browser tabs, the debuggee and debugger, and go through the steps of debugging the debuggee.
6+
7+
Here's one test that pauses while creating a Todo.
8+
9+
```js
10+
debugPage("todomvc");
11+
goToSource("js/views/todo-view");
12+
toggleBreakpoint(33);
13+
14+
addTodo();
15+
16+
stepIn();
17+
stepOver();
18+
stepOut();
19+
```
20+
21+
#### Helpful Information
22+
+ `public/js/test/integration` - tests folder
23+
+ `public/js/test/cypress/commands` - test commands folder
24+
25+
#### Running tests
26+
+ `npm run firefox` - launch firefox
27+
+ `cypress run` - runs tests headlessly
28+
+ `cypress open` - opens cypress app
29+
30+
**Installing Cypress**
31+
Cypress needs to be installed before tests can be run.
32+
33+
```bash
34+
npm install -g cypress-cli
35+
cypress install
36+
```
37+
38+
[More Information](https://docs.cypress.io/docs/installing-and-running)
39+
40+
Notes:
41+
+ It's helpful to close the firefox debugger in other tabs as it might cause the tests to miss a firefox message.
42+
+ You can also test chrome by opening chrome and enabling the chrome test in `todomvc.js`.
43+
44+
#### Cypress
45+
46+
The Debugger.html project uses [Cypress](https://www.cypress.io/) for integration tests.
47+
48+
**Features**
49+
50+
+ [Commands](https://docs.cypress.io/docs/issuing-commands) that interact with the app (click, type, ...)
51+
+ [Selectors](https://docs.cypress.io/docs/finding-elements) that wait for elements to be available (get, contains)
52+
53+
**Pro Tips**
54+
+ `it.only` - will only run that test
55+
+ `file watching` - cypress re-runs tests on file changes.
56+
57+
#### Fixtures
58+
59+
We use Cypress to generate the fixtures that are used in the unit tests and storybook stories.
60+
61+
[Fixtures](../public/js/test/integration/fixtures.js) are written like other integration tests, with an extra step for saving a fixture.
62+
63+
+ `public/js/test/integration/fixtures.js` - fixtures file
64+
+ `public/js/test/fixtures` - Fixture folder
65+
66+
Steps:
67+
+ start the cypress server to save the fixtures - `node bin/cypress-server`
68+
+ enable the fixture tests - change `xdescribe` to `describe` in [fixtures.js](../public/js/test/integration/fixtures.js).
69+
+ run cypress - `cypress run`
70+
71+
72+
#### Screenshots
73+
74+
![](./screenshots/cypress-runner.png)

docs/local-development.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## Local Development
2+
3+
The easiest way to get started debugging firefox is with these two commands.
4+
5+
```bash
6+
`npm run firefox`
7+
`npm start`
8+
```
9+
10+
### Development Server
11+
12+
The development server does many things to help make local development easier.
13+
14+
+ uses webpack to bundle the debugger js and css assets
15+
+ uses webpack-express-middleware to update the bundle on page refresh
16+
+ can enable hot reloading for react components and css
17+
+ starts the firefox proxy, which passes messages between the debugger and debugged firefox browser.
18+
+ builds the set of environment and user config for the debugger.
19+
+ gets the list of chrome tabs that can be debugged.
20+
21+
### Configs
22+
23+
There are a couple types of configs for the debugger:
24+
25+
+ Feature flags - that can turn on/off experimental features
26+
+ Development flags - features like hot reloading or logging that can make it easier to develop
27+
+ Configuration - settings like the firefox websocket port, which set global configuration data.
28+
29+
**Local Configs**
30+
31+
You can easily override values locally for your own environment or development preferences.
32+
33+
Local changes go in a `local.json` file in config next to `development.json`.
34+
If that file does not exist, copy `local.sample.json`.
35+
36+
### Hot Reloading
37+
38+
Hot reloading lets you make changes in React components and CSS and see the changes immediately.
39+
Also, the changes will go into effect without changing the state of app.
40+
Hot reloading does not work all the time, but once you get a sense of its quirks it can be a huge productivity boon.
41+
42+
It can be turned on by setting `config/local.json` with the contents `{ "hotReloading: true" }`.
43+
44+
### StoryBook
45+
46+
Storybook is a local development environment for react components for viewing components in different states.
47+
48+
**Features:**
49+
+ toggle between different UI states
50+
+ quickly work on a component with hot reloading
51+
52+
**Getting Started:**
53+
+ start storybook `npm run storybook`
54+
+ edit a component story in `public/js/components/stories`
55+
56+
![](./screenshots/storybook.png)
208 KB
Loading

docs/screenshots/storybook.png

51.4 KB
Loading

0 commit comments

Comments
 (0)