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

Updates for events overhaul #967

Closed
wants to merge 86 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
8d4076c
plugins / events overhaul
chrisbreiding Sep 13, 2018
addaef6
fix tests
chrisbreiding Sep 13, 2018
97d0976
add migration guide
chrisbreiding Sep 17, 2018
0ed36cc
Merge branch 'develop' into issue-890-background-updates
chrisbreiding Sep 17, 2018
1f8188c
fix tests
chrisbreiding Sep 17, 2018
76587c0
update events docs per Rich’s excellent feedback
chrisbreiding Sep 17, 2018
e405bc8
Merge branch 'develop' into issue-890-background-updates
jennifer-shehane Sep 18, 2018
e1c8ed0
update api test to not use first link in sidebar
jennifer-shehane Sep 18, 2018
cf5a2fe
Minor updates for Background Process page
jennifer-shehane Sep 18, 2018
c62054f
package-lock
jennifer-shehane Sep 18, 2018
73d805d
more minor changes to pages
jennifer-shehane Sep 18, 2018
7510fc7
Normalize titles + 'environments' of each event page
jennifer-shehane Sep 18, 2018
f883941
Normalize arguments across event pages
jennifer-shehane Sep 18, 2018
b223e87
Normalize usage across all event docs
jennifer-shehane Sep 18, 2018
62856f7
Add 'See also' links to every event page
jennifer-shehane Sep 18, 2018
2d96f81
revert changelog changes / convert obselete urls to plain text
chrisbreiding Sep 18, 2018
8fba26e
missed an obsolete changelog url
chrisbreiding Sep 18, 2018
3e4007e
fix urls
chrisbreiding Sep 18, 2018
d780c3d
note default location of background and file and configurabiliity
chrisbreiding Sep 18, 2018
1753661
fixes for grammar / consistency
chrisbreiding Sep 18, 2018
556352f
fix tests
chrisbreiding Sep 18, 2018
241bc48
remove links in event files to own doc
jennifer-shehane Sep 19, 2018
51de0fa
Fix padding of th to match td, add style for grey icon if we want it
jennifer-shehane Sep 19, 2018
fc7d90e
fix link
chrisbreiding Sep 19, 2018
556cb51
set up aliases for moved pages
chrisbreiding Sep 19, 2018
e480cbe
Merge branch 'develop' into issue-890-background-updates
jennifer-shehane Sep 24, 2018
caacdc7
package-lock
jennifer-shehane Sep 24, 2018
a22faf1
remove conflict
jennifer-shehane Sep 24, 2018
87081da
Add more context to 'environment' section of events
jennifer-shehane Sep 24, 2018
de8b33b
package-lock changes
chrisbreiding Nov 2, 2018
033d3a0
add error message for mocha overspecified error
chrisbreiding Nov 2, 2018
171386b
Merge branch 'develop' into issue-890-background-updates
chrisbreiding Nov 6, 2018
d2866df
ensure api sidebar doesn’t expand all
chrisbreiding Nov 13, 2018
5f68a77
fix typo
chrisbreiding Nov 13, 2018
28d8305
change Catalog of Events to All Events
chrisbreiding Nov 15, 2018
189ca2c
fix references to old events
chrisbreiding Nov 15, 2018
253cad5
split up events table into two tables
chrisbreiding Nov 15, 2018
0cb9aa7
fix event environment table layout
chrisbreiding Nov 15, 2018
e199d1c
update ‘remote page’ to ‘page’
chrisbreiding Nov 16, 2018
967ad6b
Add Chai changes to migration guide
lilaconlee Nov 30, 2018
7ecc59e
Merge branch 'develop' into issue-890-background-updates
jennifer-shehane Dec 3, 2018
f1cb1e1
Merge branch 'develop' into issue-890-background-updates
lilaconlee Dec 3, 2018
37ca0be
Add sinon upgrade notes to migration guide
lilaconlee Dec 3, 2018
939dd55
Merge branch 'issue-890-background-updates' of github.com:cypress-io/…
chrisbreiding Jan 23, 2019
44868ce
Merge branch 'develop' into issue-890-background-updates
chrisbreiding Jan 23, 2019
aafab54
package-lock changes
chrisbreiding Jan 23, 2019
e60a482
window:alert -> page:alert
chrisbreiding Jan 23, 2019
0540642
window:confirm -> page:confirm
chrisbreiding Jan 23, 2019
3202028
before:window:load -> page:start
chrisbreiding Jan 23, 2019
36f02b0
add changed events to migration guide
chrisbreiding Jan 23, 2019
caf248c
window:load -> page:ready
chrisbreiding Jan 23, 2019
56b60e1
window:unload -> page:end
chrisbreiding Jan 23, 2019
f9532c7
update page events with updated arguments
chrisbreiding Jan 23, 2019
f99ff43
url:changed -> page:urlChange
chrisbreiding Jan 23, 2019
dd34701
file:preprocessor -> browser:filePreprocessor
chrisbreiding Jan 23, 2019
a9aa125
before:browser:launch -> browser:launch
chrisbreiding Jan 23, 2019
e9eb6d9
command:end -> internal:commandEnd
chrisbreiding Jan 25, 2019
645955b
command:enqueued -> internal:commandEnqueue
chrisbreiding Jan 25, 2019
b337703
command:retry -> internal:commandRetry
chrisbreiding Jan 25, 2019
295b44d
command:start -> internal:commandStart
chrisbreiding Jan 25, 2019
7590994
before:test:run -> test:start
chrisbreiding Jan 25, 2019
4de2f7a
after:test:run -> test:end
chrisbreiding Jan 25, 2019
342669f
before:run -> run:start
chrisbreiding Jan 25, 2019
58f22d6
after:run -> run:end
chrisbreiding Jan 25, 2019
a291c2a
after:screenshot -> screenshot
chrisbreiding Jan 25, 2019
e1ff757
before:spec -> spec:start
chrisbreiding Jan 25, 2019
9a9c507
after:spec -> spec:end
chrisbreiding Jan 25, 2019
7a25654
before:test:run -> test:start
chrisbreiding Jan 25, 2019
a5c1452
fail -> test:fail
chrisbreiding Jan 25, 2019
468ac1f
viewport:changed -> viewport:change
chrisbreiding Jan 25, 2019
0a35710
format table
chrisbreiding Jan 25, 2019
75f2934
update migration guide with details about background process
chrisbreiding Jan 25, 2019
b2f918b
fix api spec
chrisbreiding Jan 25, 2019
4797ab9
fix event names / re-alphabetize
chrisbreiding Jan 25, 2019
f2c64a3
fix file name
chrisbreiding Jan 25, 2019
f8836d7
fix file names
chrisbreiding Jan 25, 2019
7777a20
Merge branch 'develop' into issue-890-background-updates
chrisbreiding Jan 25, 2019
60f1fdc
log:added -> internal:log
chrisbreiding Feb 6, 2019
d7a0dea
log:changed -> internal:logChange
chrisbreiding Feb 6, 2019
161dcff
alphabetize
chrisbreiding Feb 6, 2019
97ac201
Merge pull request #1404 from cypress-io/issue-1387-log-event-changes
chrisbreiding Feb 6, 2019
4f6edc2
Merge branch 'develop' into issue-890-background-updates
chrisbreiding Feb 7, 2019
2b1c475
Merge branch 'issue-890-background-updates' into issue-1077-mocha-ove…
chrisbreiding Feb 7, 2019
56dbe84
move mocha promise/done callback section to migration guide
chrisbreiding Feb 7, 2019
38c1ee9
Merge pull request #1105 from cypress-io/issue-1077-mocha-overspecifi…
chrisbreiding Feb 7, 2019
79ca22c
Merge branch 'develop' into issue-890-background-updates
chrisbreiding Mar 22, 2019
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
6 changes: 6 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ alias:

continuous-integration.html: guides/guides/continuous-integration.html

guides/tooling/plugins-guide.html: guides/tooling/background-process.html
api/plugins/writing-a-plugin.html: guides/tooling/background-process.html
api/plugins/configuration-api.html: api/events/configuration-event.html
api/plugins/preprocessors-api.html: api/events/browser-filepreprocessor-event.html
api/plugins/browser-launch-api.html: api/events/browser-launch-event.html
api/plugins/after-screenshot-api.html: api/events/after-screenshot-event.html

# Include/Exclude Files/Folders
include:
Expand Down
14 changes: 7 additions & 7 deletions cypress/integration/api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@ import { improveUrl } from '../support/repo'
const API_PATH = '/api/api/table-of-contents'
const API_HTML = `${API_PATH}.html`

const FIRST_PAGE = 'table-of-contents.html'
const NEXT_PAGE = 'catalog-of-events.html'
const PAGE = '/api/events/catalog-of-events.html'

describe('API', () => {
context('Catalog of events', () => {
beforeEach(() => {
cy.visit(PAGE)
cy.visit('/api/events/all-events.html')
})

it('loads catalog of events', () =>
cy.get('.article-title')
.contains('Catalog of Events')
.contains('All Events')
)
})

Expand Down Expand Up @@ -178,11 +174,15 @@ describe('API', () => {
})

context('Pagination', () => {
const FIRST_PAGE = 'api/commands/and.html'
const NEXT_PAGE = 'api/commands/as.html'

beforeEach(() => {
cy.visit(`${API_PATH}.html`)
cy.visit(FIRST_PAGE)
})

it('does not display Prev link on first page', () => {
cy.visit('api/api/table-of-contents.html')
cy.get('.article-footer-prev')
.should('not.exist')
})
Expand Down
14 changes: 14 additions & 0 deletions lib/tags/html.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function wrapStart (hexo, args) {
const [className, tag] = args
return `<${tag || 'div'} class="${className}">`
}

function wrapEnd (hexo, args) {
const [tag] = args
return `</${tag || 'div'}>`
}

module.exports = {
wrapStart,
wrapEnd,
}
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ hexo.extend.helper.register('doc_sidebar', function (className) {

// IF the sidebar's categories aren't that many,
// just expand them all, since it's more of a hassle to expand one by one
if (_.keys(sidebar).length <= 6) {
// but don't expand all for the API since it has a lot of pages
if (_.keys(sidebar).length <= 6 && type !== 'api') {
expandAll = true
}

Expand Down
5 changes: 5 additions & 0 deletions scripts/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const _ = require('lodash')
const Promise = require('bluebird')
const beepAndLog = require('../lib/beep')
const { wrapStart, wrapEnd } = require('../lib/tags/html')
const partial = require('../lib/tags/partial')
const note = require('../lib/tags/note')
const yields = require('../lib/tags/yields')
Expand All @@ -21,6 +22,10 @@ const history = require('../lib/tags/history')
const aliases = require('../lib/tags/aliases')

const tags = {
// html
wrap_start: wrapStart,
wrap_end: wrapEnd,

// partials
partial: partial,

Expand Down
9 changes: 4 additions & 5 deletions source/_changelogs/0.20.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@
- We've added a new {% url "`Cypress.Commands`" custom-commands %} interface to handle adding your own custom commands. Fixes {% issue 436 %}.
- You can now overwrite existing commands with {% url "`Cypress.Commands.overwrite`" custom-commands %}. <OPEN A NEW ISSUE>
- We removed an artificial delay that was being set in between commands. This means test commands now run faster.
- You can now {% url "disable Cypress global exception handlers" catalog-of-events %} for your application. Fixes {% issue 254 %}
- You can now {% url "disable Cypress global exception handlers" all-events %} for your application. Fixes {% issue 254 %}
- Uncaught errors appearing in your spec files or support files are now properly caught, have the right exit code, and display correctly. Fixes {% issue 345 %}
- Cypress will now scroll past multiple elements that cover up an element to be interacted with. It also now factors in elements with `position: sticky`. Fixes {% issue 571 %} and {% issue 565 %}.
- Cypress now scrolls all parent containers (not just `window`) when attempting to {% url "check an element's actionability" interacting-with-elements#Actionability %}. Fixes {% issue 569 %}.
- Using {% url "Chai.js's `assert` interface" assertions#TDD-Assertions %} now works correctly in your specs. <OPEN AN ISSUE>
- Screenshots are now taken during each runnable that fails. Errors in tests will happen there. Errors in hooks will also happen there. Previously a screenshot would only happen after everything (including hooks) ran. Fixes {% issue 394 %}
- {% url "`cy.screenshot()`" screenshot %} now synchronizes its state with the reporter. This means you should see error messages (on the left side) on automatic screenshot errors.
- Using mocha's async `done` callback now works properly.
- You can now programmatically {% url "intercept and potentially turn off uncaught application errors" catalog-of-events %} from failing your tests.
- You can now programmatically control whether you accept or cancel {% url "`window.confirm()`" catalog-of-events %} calls from your application.
- You can now programmatically {% url "intercept and potentially turn off uncaught application errors" all-events %} from failing your tests.
- You can now programmatically control whether you accept or cancel {% url "`window.confirm()`" all-events %} calls from your application.

**Dependencies:**

Expand Down Expand Up @@ -158,7 +158,7 @@

Note: we are still updating all of the docs to reflect all the 0.20.0 changes.

- {% url 'New "Catalog of Events"' catalog-of-events %}
- {% url 'New "Catalog of Events"' all-events %}
- {% url 'New "Cypress.Commands"' custom-commands %}
- {% url 'New "Cypress.log"' cypress-log %}
- {% url 'New ".trigger()"' trigger %}
Expand All @@ -171,4 +171,3 @@ Note: we are still updating all of the docs to reflect all the 0.20.0 changes.
- {% url 'Updated "Debugging"' debugging %}
- {% url 'Updated "Assertions"' assertions %}
- {% url 'Updated "Interacting with Elements"' interacting-with-elements %}

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

**Documentation Changes:**

- {% url 'Added examples for "Catalog of Events"' catalog-of-events %}
- {% url 'Added examples for "Catalog of Events"' all-events %}
- {% url 'Added / Updated FAQ for "Using Cypress"' using-cypress-faq %}

5 changes: 2 additions & 3 deletions source/_changelogs/3.0.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
- We now append `(failed)` to the screenshot filename of screenshots taken automatically during test failure. Fixes {% issue 1923 %}.
- If multiple screenshots are taken during a test that will result in the same filename, their file paths are now appended with a number, i.e. `test name (1).png`. This prevents screenshot files with the same name from being overwritten. Fixes {% issue 1766 %}.
- Screenshot `onAfterScreenshot` and `onBeforeScreenshot` callbacks ar enow invoked for failed tests. They include a `testFailure` property to distinguish between automatic ones and your own use of `cy.screenshot()`. Fixes {% issue 2040 %}.
- There's now an {% url "`after:screenshot` plugin event" after-screenshot-api %} you can use in your `pluginsFile` to work with screenshots after they are taken. This enables you to rename them, move their location, resize them, send them to a service, etc. Fixes {% issue 2039 %}.
- There's now an {% url "`after:screenshot` plugin event" after-screenshot-event %} you can use in your `pluginsFile` to work with screenshots after they are taken. This enables you to rename them, move their location, resize them, send them to a service, etc. Fixes {% issue 2039 %}.
- Added `Cypress.browser` object which contains information about the currently running browser. Fixes {% issue 1919 %} and {% issue 1961 %}.
- Added `Cypress.spec` object which contains information about the currently running spec. Fixes {% issue 1918 %}.
- Urls displayed in the Command Log during {% url "`cy.visit()`" visit %} are no longer arbitrarily truncated at a set width. Fixes {% issue 1995 %}.
Expand All @@ -56,5 +56,4 @@
- {% url 'Updated "Command Line" doc to include new cache commands' command-line %}
- {% url 'Added `Cypress.browser` doc.' browser %}
- {% url 'Added `Cypress.spec` doc.' spec %}
- {% url 'Added `after:screenshot` plugin event doc.' after-screenshot-api %}

- {% url 'Added `after:screenshot` plugin event doc.' after-screenshot-event %}
40 changes: 31 additions & 9 deletions source/_data/sidebar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ guides:
web-security: web-security.html
tooling:
intelligent-code-completion: intelligent-code-completion.html
plugins-guide: plugins-guide.html
background-process: background-process.html
reporters: reporters.html
typescript-support: typescript-support.html

Expand All @@ -52,13 +52,12 @@ guides:
trade-offs: trade-offs.html
# contributing: contributing.html
changelog: changelog.html
migration-guide: migration-guide.html
roadmap: roadmap.html

api:
api:
table-of-contents: table-of-contents.html
events:
catalog-of-events: catalog-of-events.html
assertions:
all-assertions: assertions.html
commands:
Expand Down Expand Up @@ -149,6 +148,35 @@ api:
minimatch: minimatch.html
moment: moment.html
promise: promise.html
events:
all-events: all-events.html
browser-filepreprocessor-event: browser-filepreprocessor-event.html
browser-launch-event: browser-launch-event.html
configuration-event: configuration-event.html
internal-commandend-event: internal-commandend-event.html
internal-commandenqueue-event: internal-commandenqueue-event.html
internal-commandretry-event: internal-commandretry-event.html
internal-commandstart-event: internal-commandstart-event.html
internal-log-event: internal-log-event.html
internal-logchange-event: internal-logchange-event.html
page-alert-event: page-alert-event.html
page-confirm-event: page-confirm-event.html
page-end-event: page-end-event.html
page-ready-event: page-ready-event.html
page-start-event: page-start-event.html
page-urlchange-event: page-urlchange-event.html
run-end-event: run-end-event.html
run-start-event: run-start-event.html
screenshot-event: screenshot-event.html
scrolled-event: scrolled-event.html
spec-end-event: spec-end-event.html
spec-start-event: spec-start-event.html
task-event: task-event.html
test-end-event: test-end-event.html
test-fail-event: test-fail-event.html
test-start-event: test-start-event.html
uncaught-exception-event: uncaught-exception-event.html
viewport-change-event: viewport-change-event.html
cypress-api:
custom-commands: custom-commands.html
cookies: cookies.html
Expand All @@ -164,12 +192,6 @@ api:
platform: platform.html
spec: spec.html
version: version.html
plugins:
writing-a-plugin: writing-a-plugin.html
configuration-api: configuration-api.html
preprocessors-api: preprocessors-api.html
browser-launch-api: browser-launch-api.html
after-screenshot-api: after-screenshot-api.html

plugins:
plugins: index.html
Expand Down
13 changes: 6 additions & 7 deletions source/api/commands/screenshot.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: screenshot

---

Take a screenshot of the application under test and, optionally, the {% url "Cypress Command Log" test-runner#Command-Log %}.
Expand Down Expand Up @@ -42,15 +41,15 @@ Pass in an options object to change the default behavior of `.screenshot()`.

Option |Default | Description
--- | --- | ---
`log` | `true` | {% usage_options log %}
`blackout` | `[]` | Array of string selectors used to match elements that should be blacked out when the screenshot is taken. Does not apply to `runner` captures.
`capture` | `'fullPage'` | Which parts of the Test Runner to capture. This value is ignored for element screenshot captures. Valid values are `viewport`, `fullPage`, or `runner`. When `viewport`, the application under test is captured in the current viewport. When `fullPage`, the application under test is captured in its entirety from top to bottom. When `runner`, the entire browser viewport, including the Cypress Command Log, is captured. For screenshots automatically taken on test failure, capture is always coerced to `runner`.
`clip` | `null` | Position and dimensions (in pixels) used to crop the final screenshot image. Should have the following shape: `{ x: 0, y: 0, width: 100, height: 100 }`
`disableTimersAndAnimations` | `true`| When true, prevents JavaScript timers (`setTimeout`, `setInterval`, etc) and CSS animations from running while the screenshot is taken.
`scale` | `false` | Whether to scale the app to fit into the browser viewport. This is always coerced to `true` when `capture` is `runner`.
`timeout` | {% url `responseTimeout` configuration#Timeouts %} | {% usage_options timeout .screenshot %}
`log` | `true` | {% usage_options log %}
`onBeforeScreenshot` | `null` | A callback before a (non-failure) screenshot is taken. For an element capture, the argument is the element being captured. For other screenshots, the argument is the `$el`.
`onAfterScreenshot` | `null` | A callback after a (non-failure) screenshot is taken. For an element capture, the first argument is the element being captured. For other screenshots, the first argument is the `$el`. The second argument is properties concerning the screenshot, including the path it was saved to and the dimensions of the saved screenshot.
`scale` | `false` | Whether to scale the app to fit into the browser viewport. This is always coerced to `true` when `capture` is `runner`.
`timeout` | {% url `responseTimeout` configuration#Timeouts %} | {% usage_options timeout .screenshot %}

For more details on these options and to set some as defaults across all uses of `.screenshot()`, see the {% url 'Cypress.Screenshot API doc' screenshot-api %}.

Expand Down Expand Up @@ -174,9 +173,9 @@ describe('my tests', function () {
})
```

## `after:screenshot` plugin event
## `screenshot` background event

You can get details about any given screenshot and manipulate it after it has been written to disk with the {% url '`after:screenshot` plugin event' after-screenshot-api %}.
You can get details about any given screenshot and manipulate it after it has been written to disk with the {% url '`screenshot` background event' screenshot-event %}.

## Test Failures

Expand Down Expand Up @@ -247,7 +246,7 @@ When clicking on `screenshot` within the command log, the console outputs the fo
# See also

- {% url `Cypress.Screenshot` screenshot-api %}
- {% url 'After Screenshot API' after-screenshot-api %}
- {% url '`screenshot`' screenshot-event %}
- {% url `cy.debug()` debug %}
- {% url 'Dashboard Service' dashboard-service %}
- {% url 'Screenshots and Videos' screenshots-and-videos %}
Expand Down
Loading