Commit Graph

16 Commits

Author SHA1 Message Date
Chris Breiding d1fe365eca Add cy.task() command (#1422)
* server: handle undefined values from plugins

* server: have plugins process inherit stdio

so console.logs and such from plugins file come through

* add cy.task()

* server: fix config spec

* driver: fix task spec

* server: change ‘task’ to ‘task:requested’

* server: have ‘task’ event take object literal instead of function

* server: document how to run individual integration and e2e tests

* fix cy.task specs

* server: fix task e2e spec

* ensure stack trace comes through for task error

* don’t show stack for ‘known’ user errors

* add types for cy.task

* @sandbox -> sinon

* add e2e spec for task returning undefined

* update readme re: e2e —spec

* timedout -> timedOut

* new Promise + setTimeout -> Promise.delay

* improve cy.task() error messages

* fix specs
2018-05-15 20:49:20 -04:00
Brian Mann 40813b1954 Issue 416 431 681 980 1248 (#1583)
* extract random string to util

* run specs in isolation, aggregate totalFailures, display output per spec, enable globbing for specs

* extract electron app ready into its own module

* WIP: e2e tests around spec isolation, snapshots, stdout, and complete test results

* removed unused and deprecated remove id's feature

* move fs_warn to fs util to promisify an fs singleton

* create a glob singleton util

* cleanup dead removeIds code

* extract files controller specs into its own file

* extract finding specs out of project instance into its own utility with no state

* use glob util singleton

* use fs util singleton

* lots of formatting and cleanup

* fixes failing headless specs

* fixes all failing unit tests

* fixes failing integration test

* WIP: temporarily throw old error msg

* WIP: skip failing --record integration tests for now

* fix failing e2e tests
2018-04-14 23:13:44 -04:00
Brian Mann 81294562e3 server: fix snapshots, and don't print warnings when socket has been ended 2018-01-06 18:15:10 -05:00
Brian Mann 191dbfb354 server: fixes #691, add event for exposing browser launch args (#1078)
* server: fixes #691, add event for exposing browser launch args

- enable special handling of ‘—load-extension’
- add e2e / integration / unit tests
- handle both chrome + electron cases

* server: iterate on failing tests, don't strip electron options else we lose valuable properties

- add better debugging

* server: fix failing tests, browsers needed

* server: send in a complete browser object for 'before:browser:launch'

- useful for doing conditional things with version and/or path
2017-12-17 16:57:26 -05:00
Jamie 875e378930 feature: Update cy.visit to allow for visiting non-2xx response pages when option set (#982)
* Update requestUrl method to accept options param

* Update requestUrl to only throw error when failOnStatusCode option is true

* Set the default option value for failOnStatusCode to true

* Pass options to requestUrl call

* Update _onResolveUrl to take an options param

* Update _onResolveUrl to set domain for invalid status codes when visitable

* Update socket delegator to pass options arg to onResolveUrl

* Add server test case for new functionality around resolving non-2xx responses

* Add new driver test routes

* Add driver pkg test case for visiting non-2xx pages

* Add error test for edge case when non-2xx and non html response

* driver: normalize error messages by reducing 2 or more new lines into only 2 new lines

* driver: make test server routes clearer, remove unused route

* driver: simplify accepting bad status codes logic

- keep the isOkStatusCode logic in the server only, instead of also
putting it in the driver
- update the tests accordingly
- remove test that was unnecessary

* driver: add error message for explaining how to test bad status codes

* server: fix failing snapshot tests due to error message changes new line normalization
2017-12-03 17:10:49 -05:00
Chris Breiding 915264f834 Fix firing 'watched:file:changed' twice on change (#975)
* server: upgrade browserify preprocessor to 1.0.1

* server: rename preprocessor config to file object

* server: normalize path when removing preprocessor file

* server: only add one listener for file:updated in socket

previously, a listener would be added for every spec file opened, linearly increasing how many watched:file:changed events would be fired when a single file changed
2017-11-29 13:33:12 -05:00
Chris Breiding 1ec6f7815f Create plugins API and add preprocessor plugin support (#888)
* fix broken menu specs

* extract browserify code and create preprocessor abstraction

* server: remove unused code

* server: implement logic for importing preprocessor

* server: add eslintrc and ignore test fixtures

* server: implement plugins API

* server: add node_cache module to manage clearing a package and its dependencies

* server: clear plugins file from cache to re-require it

* server: set pluginsFile to absolute path

* server: add debug logging to plugins

* server: watch pluginsFile

* server: throw the right error when requiring plugins file

* server: organize config folders and keys visually

* server: scaffold plugins file

* server: require plugins file via nodeCache.require

* server: update browserify preprocessor name and point to github for now

* server: remove redundant integration tests

* server: always scaffold plugins file, except when falsey

* server: add plugins file test to scaffold spec

* server: always provide util.fileUpdated to preprocessor

* server: update browserify-preprocessor dep

* server: fix integration tests

* server: remove redundant logic

* server: catch errors thrown synchronously by plugins function

* server: reduce chances of flakyness in async test

* driver: fix broken spec

* server: don’t check for dirname of supportFile and pluginFile when we know they’re already a directory

* driver: there is no dist

* server: update default options sent to browserify preprocessor

* server: send config into browserify instead of options

* server: add test around default preprocessor

* server: update browserify preprocessor

* server: refactor events spec to better handle multiple calls to handleEvent

* server: add tests around project:open events

* server/desktop-gui: handle errors when plugins file changes

* server: fix events spec

* server: allow any file types to be spec files

* server: validate config.pluginsFile

* server: remove link to error doc

* server: improve plugins error message

* server: simplify example plugins file

* server: on:spec:file:preprocessor -> file:preprocessor

* server: wrap plugins in a child process

* server: rename specsGlob to testFiles

* server: bump browserify-preprocessor ‘version’

* server: fix references left by merge

* server: fix incorrect function names

* server: fix plugin error serialization

* server: display error if plugins process has an uncaught exception or unhandled rejection

* server: reset domain on reset

* server: exit early on plugin error headlessly

* server: add e2e tests for plugins/preprocessors

* server: remove obselete node cache file

* server: fix integration tests

* server: log plugins error before exiting

* server: use npm version of browserify preprocessor

* server: extract string-splitting function

* socket: use path.join in spec

* server: eslint ignore scaffold files

* server: fix scaffolded plugins file links, add snapshot test

* server: if app_spec runs, cause a failure [skip ci]

- tested locally
2017-11-19 23:20:54 -05:00
Brian Mann e9a08bfee3 driver, server: normalize backend:request and automation:request API's 2017-08-13 22:44:15 -04:00
Brian Mann 4089c5c240 driver: WIP continued converting navigation specs
- make existingState local to socket listening
- consolidated preserve:run:state as backend request
- fix state bugs with runner
- make navigation work across domain changes
2017-08-07 01:06:59 -04:00
Brian Mann 81e759544e driver: must set log props default to empty obj 2017-07-17 01:14:57 -04:00
Brian Mann 4a1e371775 driver: normalize backend:request events, promisification, error handling, socket messaging 2017-07-13 22:15:03 -04:00
Chris Breiding 143d5ac990 server: pass through project path so state gets saved per-project 2017-06-29 16:45:20 -04:00
Gleb Bahmutov 77cbe7c599 server: do not try to bundle __all spec - there is no spec, close #137 (#138)
* server: do not try to bundle __all spec - there is no spec, close #137

* server: fix socket 'save:app:state not correctly saving state in project

* server: fix broken socket_specs

* server: add simple unit test to socket __all test file watch
2017-06-07 09:55:58 -04:00
Gleb Bahmutov 98e804990c WIP: rework saved state to be saved per project (#101)
* server: use package name to hash state folder

* unit test saved state hash utility

* server: use package name to hash state folder

* unit test saved state hash utility

* server: update unit tests to per-project state

* server: fix remaining unit tests after changing state to per project

* start e2e tests for saved state

* force state save and check if file was saved

* server: integration test for state saved per project, close #113
2017-06-01 00:02:48 -04:00
Brian Mann 817758e4b6 all: symlink all cypress packages in root node_modules for easy access 2017-05-31 12:51:35 -04:00
Brian Mann 71f07c2512 server: rename packages/app -> packages/server 2017-05-09 13:51:45 -04:00