Skip to content

Commit a041e96

Browse files
authored
Clean up documentation and tooling (#387)
1 parent 46f7fa6 commit a041e96

File tree

5 files changed

+37
-353
lines changed

5 files changed

+37
-353
lines changed

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Welcome 💖
2+
3+
Before anything else, thank you for taking some of your precious time to help this project move forward. ❤️
4+
5+
If you're new to open source and feeling a bit nervous 😳, we understand! We recommend watching [this excellent guide](https://egghead.io/talks/git-how-to-make-your-first-open-source-contribution) to give you a grounding in some of the basic concepts. We want you to feel safe to make mistakes, and ask questions.
6+
7+
If anything in this guide or anywhere else in the codebase doesn't make sense to you, please let us know! It's through your feedback that we can make this codebase more welcoming, so we'll be glad to hear thoughts.
8+
9+
You can chat with us in the `#committers` channel in our [Community Discord](https://cucumber.io/community#discord), or feel free to [raise an issue](../../issues/new?assignees=&labels=%3Abank%3A+debt&template=developer_experience.md&title=) if you're experiencing any friction trying make your contribution.
10+
11+
## Getting started
12+
13+
First, install the dependencies and check the tests pass:
14+
15+
```shell
16+
npm install
17+
npm test
18+
```
19+
20+
We use [Ladle](https://ladle.dev/) to develop and test our components, which you can start up with:
21+
22+
```shell
23+
npm run start
24+
```

README.md

Lines changed: 11 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
> A set of React components for rendering Gherkin documents and Cucumber results.
44
5-
## Screenshot
5+
Preview and examples:
6+
https://cucumber-react-preview.netlify.app/
67

78
![Examples Tables](screenshots/examples-tables.png)
89

@@ -11,35 +12,21 @@
1112
- This package is distributed in ES module format only.
1213
- React 18 or above is required.
1314

14-
The source code for screenshots above is:
15+
The source code for the screenshot above is:
1516

1617
```jsx
17-
<EnvelopesWrapper envelopes={envelopes}>
18+
import { EnvelopesProvider, GherkinDocumentList } from '@cucumber/react-components'
19+
20+
<EnvelopesProvider envelopes={envelopes}>
1821
<GherkinDocumentList />
19-
</EnvelopesWrapper>
22+
</EnvelopesProvider>
2023
```
2124

22-
The [`<GherkinDocumentList>`](src/components/app/GherkinDocumentList.tsx) React component,
23-
is an accordion of [`<GherkinDocument>`](src/components/gherkin/GherkinDocument.tsx).
24-
25-
The `<GherkinDocument>` React component and any component nested within it (such as [`<Scenario>`](src/components/gherkin/Scenario.tsx)) can be rendered standalone.
26-
27-
## `<GherkinDocument>` features
28-
29-
The `<GherkinDocument>` React component is instantiated with a single `gherkinDocument` prop.
30-
The value must be a [GherkinDocument](../../cucumber-messages/messages.md#io.cucumber.messages.GherkinDocument) object.
31-
You can use the [Gherkin](../../gherkin) parser to generate a `GherkinDocument` object.
32-
33-
By default the `<GherkinDocument>` component will not display any coloured results, as the `GherkinDocument`
34-
message object does not contain results, only the [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) of the document.
35-
This is fine for simple use cases where results are not important.
36-
37-
To render a `<GherkinDocument>` with results and highlighted [Cucumber Expression parameters](https://cucumber.io/docs/cucumber/cucumber-expressions/) parameters it must be nested inside a
38-
[`<Wrapper>`](src/components/app/Wrapper.tsx) component.
25+
`envelopes` should be an array of [Cucumber Messages](https://github.com/cucumber/messages) that came from a test run. You can obtain these from most Cucumber implementations by using a "Message" formatter.
3926

4027
## Attachments
4128

42-
Attachments from test runs are shown with their corresponding steps. The baseline behaviour for attachments is a download button. However, we have some special handling for very common MIME types to make them more useful without leaving the report:
29+
Attachments from test runs are shown with their corresponding steps. The baseline behavior for attachments is a download button. However, we have some special handling for common MIME types to make them more useful without leaving the report:
4330

4431
- `image/*` - images are rendered with an `<img/>` tag
4532
- `video/*` - videos are rendered with a `<video/` tag
@@ -54,7 +41,7 @@ The standard styling comes without any extra providers or configuration. There a
5441

5542
### Theming
5643

57-
You can also provide your own theme with a small amount of CSS. Target the element above your highest-level usage of the components:
44+
You can provide your own theme with a small amount of CSS. Target the element above your highest-level usage of the components:
5845

5946
```jsx
6047
<div className="dark-theme">
@@ -136,78 +123,4 @@ Staying with the doc string example, you can use the same `overrides` prop, but
136123
In each case where you provide your own component, it will receive the same props as the default component, plus two more:
137124

138125
- `styles` - class names for the default styling, so you can still apply these to your custom component if it makes sense
139-
- `DefaultRenderer` - the default React component, useful if you only want to provide your own rendering for certain cases, and otherwise fall back to the default rendering (don't forget to pass it the props)
140-
141-
## Build / hack
142-
143-
Install dependencies
144-
145-
npm install
146-
147-
Run tests
148-
149-
npm test
150-
151-
Interactive development
152-
153-
npm start
154-
155-
## Ideas
156-
157-
### `ScenarioList` component
158-
159-
A component that renders a list of scenarios (possibly from multiple files, filtered by e.g. tag).
160-
161-
This component could be used to render relevant scenarios in 3rd-party tools, such as
162-
JIRA, Confluence and various issue trackers that support plugins.
163-
164-
### Link to JIRA
165-
166-
Configure with a regexp and url function, and tags will be rendered as JIRA issue links
167-
168-
### Search
169-
170-
Search by tag, but also by text. Could use http://elasticlunr.com/
171-
or https://lunrjs.com/ - or it could simply perform filtering on an array of `GherkinDocument` messages.
172-
173-
### Search results
174-
175-
Each scenario displayed underneath each other, grouped by feature file. The feature description is "collapsed",
176-
(unless it contains the search term) but can be opened.
177-
178-
### Filtering / sorting
179-
180-
* by tag
181-
* by duration (find slow ones)
182-
* by status
183-
* by recency (update timestamp) - exclude old ones
184-
* by flickeriness
185-
186-
### Tag search
187-
188-
* Render a tag cloud for all tags
189-
* Size: count
190-
* Color: pass/fail/undefined
191-
192-
### On-demand data
193-
194-
For large reports (especially with screenshots) it may be too heavy to store it all in the browser.
195-
The GUI should request data for the current document on demand. The GUI should also be able to filter
196-
what kind of events it wants. For example, to render the initial screen.
197-
198-
### Server / App
199-
200-
It should be easy to use. Just run the app (Electron). It will create a named pipe where
201-
it will listen. What's written here gets written straight to the React app (no websocket,
202-
it's in the same process). This app can be fairly small.
203-
204-
### Rerun tests
205-
206-
Add a message to represent a config+cwd+env for a run, so the GUI can rerun it.
207-
The config is essentially command line options. They can be modified in the gui.
208-
Rerun on file change can also be set up. This just makes the whole DX simple.
209-
210-
### Alerts
211-
212-
The app could use the OS to send screen messages (autotest like)
213-
126+
- `DefaultRenderer` - the default React component, useful if you only want to provide your own rendering for certain cases, and otherwise fall back to the default rendering (don't forget to pass it the props)

0 commit comments

Comments
 (0)