Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename configuration option blacklistHosts to blocklistHosts #2861

Merged
merged 12 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .textlintrc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
["craziest", "most complex"],
["dumb", "unintended"],
["insane", "outrageous"],
["blacklist", "block"],
["whitelist", "allow"],

// Prefer American spelling
["behaviour", "behavior"],
Expand Down
2 changes: 1 addition & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"baseUrl": "http://localhost:2222",
"projectId": "ma3dkn",
"viewportWidth": 1500,
"blacklistHosts": ["trackcmp.net", "js.hs-analytics.net", "js.hs-scripts.com"]
"blocklistHosts": ["trackcmp.net", "js.hs-analytics.net", "js.hs-scripts.com"]
}
15,858 changes: 5,759 additions & 10,099 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion source/_changelogs/0.12.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
- Any issues related to `requestJSON` or `responseJSON` being duplicated are now fixed. Fixes {% issue 65 '#65' %}.
- Fully Qualified XHR's which should be proxied are now correctly transparently rewritten to prevent CORS problems.
- {% url `cy.route()` route %} - `onRequest` and `onResponse` callbacks are now called with `cy` as the context.
- Whitelisting assets which should never be stubbed has been improved. Now `.jsx` templates pass-through correctly.
- Filtering assets which should never be stubbed has been improved. Now `.jsx` templates pass-through correctly.
- CORS Network Errors are now correctly caught.

**Misc:**
Expand Down
2 changes: 1 addition & 1 deletion source/_changelogs/0.12.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
**Bugfixes:**

- Prevent passing `{multiple: true}` incorrectly showing up in Command Log. Fixes {% issue 88 '#88' %}.
- Properly whitelist resource like XHR's which have query params such as jquery's `{cache: false}` option.
- Properly allow resource like XHR's which have query params such as jquery's `{cache: false}` option.
- Correctly take into account `<base>` tag on XHR's. Fixes {% issue 89 '#89' %}.

3 changes: 1 addition & 2 deletions source/_changelogs/0.12.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@

- Rewrote error message which is displayed when Cypress cannot parse your test / spec file. Now a list of suggestions are given and an external link is provided which further explains how this may happen.
- Clarified the "Default Message" page when you have not {% url `cy.visit()` visit %} your application yet.
- Whitelisted `.coffee`, `.scss`, `.less` XHR's from displaying in the Command Log.

- Ignored `.coffee`, `.scss`, `.less` XHR's from displaying in the Command Log.
2 changes: 1 addition & 1 deletion source/_changelogs/0.17.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

**Features:**

- *All CORS related issues should finally be fixed now.* Cypress now internally switches to the domain that you used in your {% url `cy.visit()` visit %}. This means that the correct domain will display in the URL based on the application currently under test. Your application's code will run under the current domain at all times. Previously we implemented an endless amount of hacks and internal translations to figure out the domain you were *supposed* to be on without actually being on the domain. This caused code to behave different and caused subtle issues. Those issues should now be resolved. The entire proxy layer has been rewritten to handle all HTTPS certificates flawlessly, continue to inject (even on HTTPS pages), and still know when to automatically bypass injection so you can open other tabs while testing in Cypress. These new proxy changes also unlock the ability to do things like whitelisting or blacklisting specific 3rd party domains, or even be able to stub not just XHR's but any kind of HTTP request.
- *All CORS related issues should finally be fixed now.* Cypress now internally switches to the domain that you used in your {% url `cy.visit()` visit %}. This means that the correct domain will display in the URL based on the application currently under test. Your application's code will run under the current domain at all times. Previously we implemented an endless amount of hacks and internal translations to figure out the domain you were *supposed* to be on without actually being on the domain. This caused code to behave different and caused subtle issues. Those issues should now be resolved. The entire proxy layer has been rewritten to handle all HTTPS certificates flawlessly, continue to inject (even on HTTPS pages), and still know when to automatically bypass injection so you can open other tabs while testing in Cypress. These new proxy changes also unlock the ability to do things like allowing or blocking specific 3rd party domains, or even be able to stub not just XHR's but any kind of HTTP request.
- `window.fetch` now works correctly. Stubbing these does not yet work but it is now possible for us to implement stubbing in a future version. Addresses {% issue 95 '#95' %}.
- The list of tests now automatically refresh when test files are renamed, deleted, or added. In addition, because the list of tests is now displayed in the desktop application, we now synchronize the state of the current running spec.
- {% url `cy.visit()` visit %} has better error messages. Cypress now programmatically determines why a {% url `cy.visit()` visit %} failed and gives you a ridiculously accurate error message. Addresses {% issue 138 '#138' %}.
Expand Down
2 changes: 1 addition & 1 deletion source/_changelogs/0.19.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- There is a new {% url 'Dashboard' https://on.cypress.io/dashboard %} service that displays your recorded runs.
- The {% url 'Dashboard' https://on.cypress.io/dashboard %} enables you to view your recorded runs, manage projects, create organizations, invite users and set permissions.
- Projects are either **public** with their runs being publicly viewable by anyone, or **private** which restricts their access to only users you've invited. All **existing** projects were set to **private** by default.
- When you invite users (from the Dashboard) we will **automatically** whitelist them. This means you can invite all of your teammates (or anyone else). They can start using Cypress without talking to us.
- When you invite users (from the Dashboard) we will **automatically** allow them. This means you can invite all of your teammates (or anyone else). They can start using Cypress without talking to us.
- We now list all of the recorded runs directly in the Test Runner under a new `Runs` tab. Fixes {% issue 236 '#236' %}.
- Your list of projects in the Test Runner now displays their last recorded run status - passing, failing, pending, running, etc.
- We've changed the "Config" tab to now be called "Settings". We added two new sections to the "Settings" tab which displays your `projectId` and your Record Key. These sections do a much better job explaining what these are and how you use them.
Expand Down
2 changes: 1 addition & 1 deletion source/_changelogs/0.5.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- {% url `.as()` as %} can now alias primitives and objects other than routes or DOM.
- {% url `.as()` as %} automatically assigns this alias to `runnable.ctx` which makes it available synchronously.
- {% url `.as()` as %} blacklists several reserved words and will throw if you attempt to alias as one of them.
- {% url `.as()` as %} does not allow several reserved words and will throw if you attempt to alias as one of them.
- {% url `cy.get()` get %} can now accept all alias types and will display the labels in the UI differently based on the alias type.
- Cypress now displays a message when the Desktop App update is actually being applied instead of doing nothing and looking like it's crashed.

Expand Down
2 changes: 1 addition & 1 deletion source/_changelogs/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

**Bugfixes:**

- {% url "`blacklistHosts`" configuration#Browser %} would occasionally not work if you were blacklisting a host that had previously cached a file. In this case, the browser would serve it from disk and not make an actual HTTP request. This issue has been solved by clearing the cache when the browser opens. Fixes {% issue 1154 %}.
- {% url "`blacklistHosts`" configuration#Browser %} would occasionally not work if you were blocking a host that had previously cached a file. In this case, the browser would serve it from disk and not make an actual HTTP request. This issue has been solved by clearing the cache when the browser opens. Fixes {% issue 1154 %}.
- {% url "`blacklistHosts`" configuration#Browser %} is now correctly accepted via the `--config` CLI flag.
- Spies and Stubs created with {% url "`cy.stub()`" stub %} and {% url "`cy.spy()`" spy %} will now retry their assertions when utilized from an {% url "alias" as %}. Fixes {% issue 1156 %}.
- Basic auth is working again in Chrome 63 and Chrome 64. We "for real" fixed it this time by adding auth headers automatically at the network proxy layer and bypassed the browser altogether. We automatically apply auth headers if you provide a username/password in the URL of a `cy.visit(url)`. We also added a new `auth` option to specify the `username/password` using `cy.visit(url, options)`. All of the requests that match the origin of the URL will have the `Authorization: Basic <...>` headers added. Fixes {% issue 1288 %}.
Expand Down
2 changes: 1 addition & 1 deletion source/_changelogs/3.1.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
- The Test Runner's search now resets when switching between projects. Fixes {% issue 2512 %}.
- Fixed internal Cypress tests. Fixes {% issue 2606 %}.
- Replaced use of `new Buffer` with `Buffer.from`. Fixes {% issue 2626 %}.
- Whitelisted `autoScrollingEnabled` to be saved in `state.json`. Fixes {% issue 2476 %}.
- Allowed `autoScrollingEnabled` to be saved in `state.json`. Fixes {% issue 2476 %}.
- Fixed internal test error `beforeSpecRun is not a function`. Fixes {% issue 2401 %}.
- Switched our internal tests to use CircleCI workspaces. Fixes {% issue 2398 %}.
- Update TypeScript definition for {% url "`cy.screenshot()`" screenshot %} to include screenshot specific options. Fixes {% issue 2654 %}.
Expand Down
4 changes: 2 additions & 2 deletions source/_changelogs/3.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- {% url "`cy.request()`" request %} now allows any valid HTTP `method` to be used including `TRACE`, `COPY`, `LOCK`, `MKCOL`, `MOVE`, `PURGE`, `PROPFIND`, `PROPPATCH`, `UNLOCK`, `REPORT`, `MKACTIVITY`, `CHECKOUT`, `MERGE`, `M-SEARCH`, `NOTIFY`, `SUBSCRIBE`, `UNSUBSCRIBE`, `SEARCH`, and `CONNECT`. Addresses {% issue 1302 %}
- The {% url "`--browser` argument" command-line#cypress-run-browser-lt-browser-name-or-path-gt %} of the {% url "Command Line" command-line %} and the {% url "`browser` argument" module-api#cypress-run %} of the {% url "Module API" module-api %} have been updated to allow passing a `<path>`. Addresses {% issue 1026 %}.
- {% url "`cy.type()`" type %} now accepts `{home}` and `{end}` special character sequences to move the cursor to the start or end of a line. Addresses {% issue 2033 %}.
- The Cypress Chrome extension now has a static ID of `caljajdfkjjjdehjdoimjkkakekklcck`. This allows Cypress to be added to extension whitelists for those working under corporate policies that prohibit extensions. Addresses {% issue 3673 %}, {% issue 1239 %} and {% issue 2494 %}.
- The Cypress Chrome extension now has a static ID of `caljajdfkjjjdehjdoimjkkakekklcck`. This allows Cypress to be added to your allowed extensions for those working under corporate policies that prohibit extensions. Addresses {% issue 3673 %}, {% issue 1239 %} and {% issue 2494 %}.

**Bugfixes:**

Expand Down Expand Up @@ -46,7 +46,7 @@
- Updated {% url "docs" launching-browsers %} on explain how to run Chrome and Chromium browsers {% url "#1339" https://github.com/cypress-io/cypress-documentation/issues/1339 %}
- Added `{home}` and `{end}` character sequences to {% url "cy.type()" type } doc. Also wrote better description of what `{downarrow}` and `{uparrow}` character sequences actually do. {% url "#1347" https://github.com/cypress-io/cypress-documentation/pull/1347 %}
- Added all newly supported HTTP methods to {% url "`cy.request()`" request %} doc.
- Add new section to {% url "Debugging" debugging#Chrome-extension-whitelisting %} doc explaining whitelisting the Cypress Chrome extension.
- Add new section to {% url "Troubleshooting" troubleshooting#Allow-the-Cypress-Chrome-extension %} doc explaining how to allow the Cypress Chrome extension.
- Fixed code example for google analytics stubbing {% url "#1454" https://github.com/cypress-io/cypress-documentation/issues/1454 %}

**Dependency Updates**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
To send the data and results of your tests to the [Dashboard](https://on.cypress.io/dashboard-introduction), Cypress needs free access to some URLs.

If you are running the tests from within a restrictive VPN you will need to add some URLs to your whitelist so that Cypress can have effective communication with the Dashboard.
If you are running the tests from within a restrictive VPN you will need to allow some URLs so that Cypress can have effective communication with the Dashboard.

**The URLs are the following:**

Expand Down
10 changes: 5 additions & 5 deletions source/api/commands/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Option | Default | Description
`onAnyRequest` | `undefined` | callback function called when any request is sent
`onAnyResponse` | `undefined` | callback function called when any response is returned
`urlMatchingOptions` | `{ matchBase: true }` | The default options passed to `minimatch` when using glob strings to match URLs
`whitelist` | function | Callback function that whitelists requests from ever being logged or stubbed. By default this matches against asset-like requests such as for `.js`, `.jsx`, `.html`, and `.css` files.
`whitelist` | function | Callback function that filters requests from ever being logged or stubbed. By default this matches against asset-like requests such as for `.js`, `.jsx`, `.html`, and `.css` files.

## Yields {% helper_icon yields %}

Expand All @@ -70,7 +70,7 @@ Option | Default | Description
### After starting a server:

- Any request that does **NOT** match a {% url `cy.route()` route %} will {% url 'pass through to the server' network-requests#Don’t-Stub-Responses %}.
- Any request that matches the `options.whitelist` function will **NOT** be logged or stubbed. In other words it is "whitelisted" and ignored.
- Any request that matches the `options.whitelist` function will **NOT** be logged or stubbed. In other words it is filtered and ignored.
- You will see requests named as `(XHR Stub)` or `(XHR)` in the Command Log.

```javascript
Expand Down Expand Up @@ -179,20 +179,20 @@ cy.server({
})
```

### Change the default whitelisting
### Change the default filtering

`cy.server()` comes with a `whitelist` function that by default filters out any requests that are for static assets like `.html`, `.js`, `.jsx`, and `.css`.

Any request that passes the `whitelist` will be ignored - it will not be logged nor will it be stubbed in any way (even if it matches a specific {% url `cy.route()` route %}).

The idea is that we never want to interfere with static assets that are fetched via Ajax.

**The default whitelist function in Cypress is:**
**The default filter function in Cypress is:**

```javascript
const whitelist = (xhr) => {
// this function receives the xhr object in question and
// will whitelist if it's a GET that appears to be a static resource
// will filter if it's a GET that appears to be a static resource
return xhr.method === 'GET' && /\.(jsx?|html|css)(\?.*)?$/.test(xhr.url)
}
```
Expand Down
16 changes: 8 additions & 8 deletions source/api/cypress-api/cookies.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: Cypress.Cookies

Cypress automatically clears all cookies **before** each test to prevent state from building up.

You can take advantage of `Cypress.Cookies.preserveOnce()` or even *whitelist* cookies by their name to preserve values across multiple tests. This enables you to preserve sessions through several tests.
You can take advantage of `Cypress.Cookies.preserveOnce()` or even preserve cookies by their name to preserve values across multiple tests. This enables you to preserve sessions through several tests.

# Syntax

Expand All @@ -30,7 +30,7 @@ Names of cookies to be preserved. Pass an unlimited number of arguments.

**{% fa fa-angle-right %} options** ***(Object)***

Set defaults for all cookies, such as whitelisting a set of cookies to bypass being cleared before each test.
Set defaults for all cookies, such as preserving a set of cookies to bypass being cleared before each test.

# Examples

Expand Down Expand Up @@ -121,22 +121,22 @@ describe('Dashboard', () => {

### Set global default cookies

You can modify the global defaults and whitelist a set of Cookies which will always be preserved across tests.
You can modify the global defaults and preserve a set of Cookies which will always be preserved across tests.

Any change you make here will take effect immediately for the remainder of every single test.

{% note info %}
A great place to put this configuration is in your `cypress/support/index.js` file, since it is loaded before any test files are evaluated.
{% endnote %}

### Whitelist accepts:
### `whitelist` accepts:

- String
- Array
- RegExp
- Function

### Whitelist String
### Preserve String

```javascript
// now any cookie with the name 'session_id' will
Expand All @@ -146,7 +146,7 @@ Cypress.Cookies.defaults({
})
```

### Whitelist Array
### Preserve Array

```javascript
// now any cookie with the name 'session_id' or 'remember_token'
Expand All @@ -156,7 +156,7 @@ Cypress.Cookies.defaults({
})
```

### Whitelist RegExp
### Preserve RegExp

```javascript
// now any cookie that matches this RegExp
Expand All @@ -166,7 +166,7 @@ Cypress.Cookies.defaults({
})
```

### Whitelist Function
### Preserve Function

```javascript
Cypress.Cookies.defaults({
Expand Down
2 changes: 1 addition & 1 deletion source/api/cypress-api/cypress-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Cypress.Server.defaults({
delay: 500,
force404: false,
whitelist: (xhr) => {
// handle custom logic for whitelisting
// handle custom logic for filtering XHR requests
}
})
```
Expand Down
4 changes: 2 additions & 2 deletions source/api/cypress-api/isbrowser.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ it('test', () => {
If you want to target a test or suite to run or be excluded when run in a specific browser, we suggest passing the `browser` within the {% url "test configuration" configuration#Test-Configuration %}. The `browser` option accepts the same {% urlHash "arguments" Arguments %} as `Cypress.isBrowser()`.

```js
it('Download extension in Firefox', { browser: 'firefox' } => {
it('Download extension in Firefox', { browser: 'firefox' }, () => {
cy.get('#dl-extension')
.should('contain', 'Download Firefox Extension')
})
```

```js
it('Show warning outside Chrome', { browser: '!chrome' } => {
it('Show warning outside Chrome', { browser: '!chrome' }, () => {
cy.get('.browser-warning')
.should('contain', 'For optimal viewing, use Chrome browser')
})
Expand Down
4 changes: 2 additions & 2 deletions source/faq/questions/dashboard-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ In order to avoid any interruption in service, we recommend that you review your
4. Review your organization’s usage
5. Scroll down and select *Upgrade* under your plan of choice

## {% fa fa-angle-right %} I'm working at a restrictive VPN. Which subdomains do I have to whitelist on my VPN for the Dashboard to work properly?
## {% fa fa-angle-right %} I'm working at a restrictive VPN. Which subdomains do I have to allow on my VPN for the Dashboard to work properly?

{% partial vpn_whitelist_list %}
{% partial vpn_allowed_list %}
4 changes: 2 additions & 2 deletions source/faq/questions/using-cypress-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Yes. {% url "You can override this with `userAgent` in your configuration file (

## {% fa fa-angle-right %} Can I block traffic going to specific domains? I want to block Google Analytics or other providers.

Yes. {% url "You can set this with `blacklistHosts` in your configuration file (`cypress.json` by default)." configuration#Browser %}
Yes. {% url "You can set this with `blockHosts` in your configuration file (`cypress.json` by default)." configuration#Browser %}

Also, check out our {% url 'Stubbing Google Analytics Recipe' recipes#Stubbing-and-spying %}.

Expand Down Expand Up @@ -414,7 +414,7 @@ We have an {% issue 685 'open proposal' %} to expand the APIs to support "switch

By default, Cypress automatically {% url "clears all cookies **before** each test" clearcookies %} to prevent state from building up.

You can whitelist specific cookies to be preserved across tests using the {% url "Cypress.Cookies api" cookies %}:
You can preserve specific cookies across tests using the {% url "Cypress.Cookies api" cookies %}:

```javascript
// now any cookie with the name 'session_id' will
Expand Down
4 changes: 2 additions & 2 deletions source/guides/core-concepts/writing-and-organizing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ it(name, config, fn)
specify(name, config, fn)
```

### Whitelisted config values
### Allowed config values

{% partial test_config_whitelist %}
{% partial allowed_test_config %}

### Suite of test configuration

Expand Down
1 change: 1 addition & 0 deletions source/guides/guides/continuous-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ module.exports = (on, config) => {
})
}
```

## Xvfb

When running on Linux, Cypress needs an X11 server; otherwise it spawns its own X11 server during the test run. When running several Cypress instances in parallel, the spawning of multiple X11 servers at once can cause problems for some of them. In this case, you can separately start a single X11 server and pass the server's address to each Cypress instance using `DISPLAY` variable.
Expand Down
Loading