You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore: refactor postBuild
* feat: install cypress binary preBuild
* chore: run semantic release from beta branch
* trigger build without PR on Circle
* if debug is on, inherit stdio when installing Cypress binary
* update README examples
* add contributing guide, close#12
* add local Netlify setup
* fix missing quote
* add Cypress spec
* add link to netlify cli
* add link to CircleCI beta
* add local testing
* move index.js to src folder
* add wait-on parameter preBuild
* allow testing in preBuild step
* feat: allow testing preBuild site
* add example to README
* feat: add group name
* pass ci build id
* add tag support
* feat: use Netlify context as default tag
* fix: add tag to manifest
* fix: use default context for both tags if not specified
How to [code a plugin](https://github.com/netlify/build/blob/master/docs/creating-a-plugin.md)
2
+
3
+
## Testing and releasing a new version
4
+
5
+
If helps to install [Netlify CLI](https://github.com/netlify/cli) to test the plugin locally
6
+
7
+
```shell
8
+
npm install netlify-cli -g
9
+
netlify build
10
+
```
11
+
12
+
Try using `beta` branch to release new pre-release versions of the plugin by following [the semantic release guide](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/pre-releases.md). You can fork and test out new versions published to NPM using the [netlify-plugin-cypress-example](https://github.com/cypress-io/netlify-plugin-cypress-example) repository. Hope the `master` branch merged into `beta` does not bring features and fixes *already released*. Thus I suggest using `beta` branch for new features.
13
+
14
+
**Do not open pull request on CircleCI** while adding new features to the `beta` branch. If there is a pull request, semantic-release refuses to publish new versions. Instead just watch the [builds on CircleCI](https://circleci.com/gh/cypress-io/netlify-plugin-cypress/tree/beta) directly and open the PR after the new version has been tested.
Copy file name to clipboardExpand all lines: README.md
+51-3
Original file line number
Diff line number
Diff line change
@@ -76,12 +76,39 @@ publish = "build"
76
76
[[plugins]]
77
77
# local Cypress plugin will test our site after it is built
78
78
package = "netlify-plugin-cypress"
79
-
[plugins.config]
79
+
[plugins.inputs]
80
80
record = true
81
81
```
82
82
83
83
See [cypress-example-kitchensink](https://github.com/cypress-io/cypress-example-kitchensink) and recorded results at [](https://dashboard.cypress.io/#/projects/4b7344/runs)
84
84
85
+
#### group
86
+
87
+
You can change the group name for the recorded run using `group` parameter
88
+
89
+
```toml
90
+
[[plugins]]
91
+
# local Cypress plugin will test our site after it is built
92
+
package = "netlify-plugin-cypress"
93
+
[plugins.inputs]
94
+
record = true
95
+
group = "built site"
96
+
```
97
+
98
+
#### tag
99
+
100
+
You can give recorded run [tags](https://on.cypress.io/module-api#cypress-run) using a comma-separated string. If the tag is not specified, Netlify context will be used (`production`, `deploy-preview` or `branch-deploy`)
101
+
102
+
```toml
103
+
[[plugins]]
104
+
# local Cypress plugin will test our site after it is built
105
+
package = "netlify-plugin-cypress"
106
+
[plugins.inputs]
107
+
record = true
108
+
group = "built site"
109
+
tag = "nightly,production"
110
+
```
111
+
85
112
### spec
86
113
87
114
Run only a single spec or specs matching a wildcard
@@ -102,12 +129,29 @@ publish = "build"
102
129
[[plugins]]
103
130
# local Cypress plugin will test our site after it is built
104
131
package = "netlify-plugin-cypress"
105
-
[plugins.config]
132
+
[plugins.inputs]
106
133
spec = "cypress/integration/smoke*.js"
107
134
```
108
135
109
136
See [cypress-example-kitchensink](https://github.com/cypress-io/cypress-example-kitchensink) for instance.
110
137
138
+
### testing the site before build
139
+
140
+
By default this plugin tests static site _after build_. But maybe you want to run end-to-end tests against the _local development server_. You can start local server, wait for it to respond and then run Cypress tests by passing parameters to this plugin. Here is a sample config file
141
+
142
+
```toml
143
+
[[plugins]]
144
+
package = "netlify-plugin-cypress"
145
+
# let's run tests against development server
146
+
# before building it (and testing the built site)
147
+
[plugins.inputs.preBuild]
148
+
start = 'npm start'
149
+
wait-on = 'http://localhost:5000'
150
+
wait-on-timeout = '30'# seconds
151
+
```
152
+
153
+
Parameters you can place into `preBuild` inputs: `start`, `wait-on`, `wait-on-timeout`, `spec`, `record`, `group`, and `tag`. If there is `preBuild` and `postBuild` testing with different tags, the first one wins :)
154
+
111
155
## Debugging
112
156
113
157
Set environment variable `DEBUG=netlify-plugin-cypress` to see the debug logs. To see even more information, set `DEBUG=netlify-plugin-cypress,netlify-plugin-cypress:verbose`
@@ -141,4 +185,8 @@ Set environment variable `DEBUG=netlify-plugin-cypress` to see the debug logs. T
141
185
142
186
## License
143
187
144
-
This project is licensed under the terms of the [MIT license](/LICENSE.md).
188
+
This project is licensed under the terms of the [MIT license](LICENSE.md).
0 commit comments