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

Fix negated assertions #3268

Closed
wants to merge 49 commits into from
Closed

Fix negated assertions #3268

wants to merge 49 commits into from

Conversation

kuceb
Copy link
Contributor

@kuceb kuceb commented Jan 31, 2019

fix #205 assertion negation bug

fixes a bug where this would be a passing assertion:

expect({}).to.not.have.html('')

(which should fail telling user {} is not a dom node), but our technique to "force" a failing assertion was not taking account whether the negation flag was set

however:

cy.get('.non-existent-sel').should('not.be.visible') 

will still pass as it does today 🎉 That way users tests will not break, because previously not.be.visible was behaving the same as not.exist

breaking changes:

  • negated dom assertions on non-dom subjects will now rightfully fail
    e.g expect([]).not.to.have.text('foobar')
  • negated dom assertions on non-existent selectors will now rightfully fail
    e.g. get('non-existent-el').should('not.have.value', 'bar') will now rightfully fail. this includes not.visible

tasks

  • fix specs that use should not.be.visible
  • include error message about changing not.visible to not.exist
  • allow not.be.visible to pass on non-existent selectors as before
  • split up docs PR
  • revert docs that say should('not.have.element') will pass with no DOM node

chrisbreiding and others added 30 commits December 3, 2018 11:38
* rename plugins to background

* rename missed directories named plugins

* fix snapshot

* fix plugins references in driver

* error when pluginsFile is used

* throw error when backgroundFile is default but plugins/index.js exists

* fix wrong usage of fs.pathExists

* update desktop-gui pluginsFIle use

* fix e2e spec

* background-guide -> background-process

* fix desktop-gui spec

* rename plugins to background
* Initial upgrade changes

* Some quick fixes

* More fixes

* Clean up exp logic and fix spread array failures

* Remove caret from package.json

* Add handling for proxies in isJquery

* iterate on flaky test, increase default command timeout
* rename ‘command:end’ to ‘internal:commandEnd’

* reanme ‘command:enqueued’ to ‘internal:commandEnqueue’

* rename ‘command:retry’ to ‘internal:commandRetry’

* rename ‘command:start’ to ‘internal:commandStart’

* rename ‘test:run:start’ to ‘test:start’

* rename ‘test:run:end’ to ‘test:end’

* rename ‘viewport:changed’ to ‘viewport:change’

* update page events to take details object

* fix issues with page event changes

* fix failing tests

* fix failing integration tests

* rename background events

* actually rename the background events

* fix tests
# Conflicts:
#	packages/driver/src/cy/commands/xhr.coffee
#	packages/driver/src/dom/jquery.coffee
#	packages/driver/test/cypress/integration/commands/xhr_spec.coffee
#
packages/server/test/support/fixtures/projects/e2e/cypress/integration/x
hr_spec.coffee
…'after:run' (#2331)

* implement before:spec, after:spec, and after:run plugin events

* ensure server events only executed if registered

* don’t execute plugin event if plugins process has been killed

* call default preprocessor directly instead of registering it as plugin

makes things more consistent because now plugins are only registered by the user. this was an exception where we registered it as a plugin, but it’s unnecessary because we can just call it directly

* fix unit tests

* await server events before proceeding

* add before:run plugin event

* pass run details to before:run event

* handle and report errors thrown in server event handlers

* wrap plugin execution in promise

* rename instances of plugin

* more rename fixes

* fix tests

* fix test

* rename events to use ‘start’ instead of ‘before’ and ‘end’ instead of ‘after’

* bump zunder to 6.3.2

* await run & spec events in interactive mode

* fix server unit tests

* fix desktop-gui tests

* fix e2e specs

* fix desktop-gui specs

* fix desktop-gui specs

* add server unit tests for run/spec events in interactive mode

* add/update desktop-gui integration tests for run/spec events

* remove console.log
@kuceb

This comment has been minimized.

@kuceb kuceb requested a review from brian-mann February 1, 2019 16:07
@kuceb kuceb changed the base branch from v3.2.0 to v4.0 February 1, 2019 16:18
@jennifer-shehane

This comment has been minimized.

@jennifer-shehane jennifer-shehane changed the base branch from v4.0 to v4.0-release May 17, 2019 07:41
@andrew-codes andrew-codes self-requested a review October 16, 2019 20:27
@kuceb kuceb changed the title Fix negated assertions [WIP] Fix negated assertions Oct 16, 2019
@kuceb kuceb changed the base branch from v4.0-release to develop October 16, 2019 20:33
cli/types/index.d.ts Show resolved Hide resolved
cli/types/index.d.ts Show resolved Hide resolved
packages/desktop-gui/src/lib/loader.jsx Show resolved Hide resolved
packages/desktop-gui/src/app/ui-blocker.jsx Show resolved Hide resolved
packages/desktop-gui/src/app/ui-blocker.scss Show resolved Hide resolved
@jennifer-shehane jennifer-shehane changed the base branch from develop to v4.0-release November 13, 2019 16:29
@brian-mann brian-mann changed the base branch from v4.0-release to develop February 3, 2020 15:59
@brian-mann brian-mann changed the base branch from develop to v4.0-release February 3, 2020 16:01
@chrisbreiding chrisbreiding changed the base branch from v4.0-release to v5.0 February 3, 2020 16:09
@chrisbreiding

This comment has been minimized.

@jennifer-shehane jennifer-shehane marked this pull request as draft April 21, 2020 06:31
@jennifer-shehane jennifer-shehane changed the title [WIP] Fix negated assertions Fix negated assertions Apr 21, 2020
@flotwig flotwig closed this Jun 18, 2020
@flotwig flotwig reopened this Jun 18, 2020
@flotwig flotwig changed the base branch from v5.0 to develop June 18, 2020 15:20
@jennifer-shehane
Copy link
Member

Closing due to inactivity. Reopen if work is to be continued on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: breaking change Requires a new major release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implicit should 'exist' assertion is not being applied on cy.get() when other assertion.
7 participants