bahmutov / cypress-select-tests

User space solution for picking Cypress tests to run
96 stars 14 forks source link

Does not work with cypress 3.4.1 #9

Closed ghost closed 5 years ago

ghost commented 5 years ago

I tried to use it on Win10 and Ubuntu - same result. Does not matter what value I input after "grep" tests are not filtered. Cypress runs all scenarios.

image

bahmutov commented 5 years ago

I have confirmed that it does work with v3.4.1 but to debug your issue, can you run tour command with environment variable DEBUG=cypress-select-tests to determine which tests it finds?

ghost commented 5 years ago

Thanks for checking on your machine. Here you have my logs. https://paste.ofcode.org/vAeK7aE8c9ih4GN8BrimGR 13 is the total number of all tests, not desired after using tag.

`root@DESKTOP-8L74VGI:~# sudo DEBUG=cypress* $(npm bin)/cypress run --env grep=login

cypress:cli cli starts with arguments ["/usr/bin/node","/root/node_modules/.bin/cypress","run","--env","grep=login"] +0ms cypress:cli NODE_OPTIONS is not set +0ms cypress:cli program parsing arguments +9ms cypress:cli running Cypress +2ms cypress:cli parsed cli options { env: 'grep=login' } +170ms cypress:cli verifying Cypress app +0ms cypress:cli checking environment variables +2ms cypress:cli checking if executable exists /root/.cache/Cypress/3.4.1/Cypress/Cypress +3ms cypress:cli Binary is executable? : true +4ms cypress:cli binaryDir is /root/.cache/Cypress/3.4.1/Cypress +1ms cypress:cli Reading binary package.json from: /root/.cache/Cypress/3.4.1/Cypress/resources/app/package.json +0ms cypress:cli Found binary version 3.4.1 installed in: /root/.cache/Cypress/3.4.1/Cypress +5ms cypress:cli { verified: true } +9ms cypress:cli is Verified ? true +5ms cypress:cli processing run options +0ms cypress:cli --key is not set, looking up environment variable CYPRESS_RECORDKEY +2ms cypress:cli run to spawn.start args ["--run-project","/root","--env","grep=login"] +1ms cypress:cli undefined DISPLAY environment variable +0ms cypress:cli Cypress will spawn its own Xvfb +0ms cypress:cli needs to start own Xvfb? true +0ms cypress:cli Starting Xvfb +5ms cypress:cli spawning, should retry on display problem? false +61ms cypress:cli passing DISPLAY :99 +5ms cypress:cli spawning Cypress with executable: /root/.cache/Cypress/3.4.1/Cypress/Cypress +1ms cypress:cli spawn args [ '--run-project', '/root', '--env', 'grep=login', '--cwd', '/root' ] { detached: false, stdio: [ 'inherit', 'inherit', 'pipe' ] } +5ms cypress:ts Running without ts-node hook in environment "production" +0ms cypress:server:cypress starting cypress with argv [ '/root/.cache/Cypress/3.4.1/Cypress/Cypress', '--run-project', '/root', '--env', 'grep=login', '--cwd', '/root' ] +0ms cypress:server:args argv array: [ '/root/.cache/Cypress/3.4.1/Cypress/Cypress', '--run-project', '/root', '--env', 'grep=login', '--cwd', '/root' ] +0ms cypress:server:args argv parsed: { : [ '/root/.cache/Cypress/3.4.1/Cypress/Cypress' ], runProject: '/root', env: 'grep=login', cwd: '/root', invokedFromCli: true } +8ms cypress:server:util:proxy found proxy environment variables {} +0ms cypress:server:args options { : [ '/root/.cache/Cypress/3.4.1/Cypress/Cypress' ], runProject: '/root', cwd: '/root', invokedFromCli: true, config: { env: { grep: 'login' } } } +4ms cypress:server:args argv options: { : [ '/root/.cache/Cypress/3.4.1/Cypress/Cypress' ], runProject: '/root', cwd: '/root', invokedFromCli: true, config: { env: { grep: 'login' } }, projectRoot: '/root', run: true } +0ms shared memfd open() failed: Function not implemented cypress:server:appdata path: /root/.config/Cypress/cy/production +0ms cypress:server:cypress starting in mode run +652ms cypress:server:appdata path: /root/.config/Cypress/cy/production +1s cypress:server:appdata path: /root/.config/Cypress/cy/production/cache +8ms cypress:server:appdata path: /root/.config/Cypress/cy/production/browsers +4s cypress:server:video using ffmpeg from /root/.cache/Cypress/3.4.1/Cypress/resources/app/packages/server/nodemodules/@ffmpeg-installer/linux-x64/ffmpeg +0ms cypress:server:run run mode ready with options { : [ '/root/.cache/Cypress/3.4.1/Cypress/Cypress' ], runProject: '/root', cwd: '/root', invokedFromCli: true, config: { env: { grep: 'login' } }, projectRoot: '/root', run: true } +0ms cypress:server:project Project created /root +0ms cypress:server:openproject opening project /root +0ms cypress:server:project opening project instance /root +1ms cypress:server:config setting support file /root/cypress/support +0ms cypress:server:config for project root /root +0ms cypress:server:config set support folder /root/cypress/support +4ms cypress:server:config setting plugins file /root/cypress/plugins +1ms cypress:server:config for project root /root +0ms cypress:server:config set pluginsFile to /root/cypress/plugins/index.js +1ms cypress:server:config set scaffold paths +1ms cypress:server:scaffold scaffolded files ["cypress/integration/examples/actions.spec.js","cypress/integration/examples/aliasing.spec.js","cypress/integration/examples/assertions.spec.js","cypress/integration/examples/connectors.spec.js","cypress/integration/examples/cookies.spec.js","cypress/integration/examples/cypress_api.spec.js","cypress/integration/examples/files.spec.js","cypress/integration/examples/local_storage.spec.js","cypress/integration/examples/location.spec.js","cypress/integration/examples/misc.spec.js","cypress/integration/examples/navigation.spec.js","cypress/integration/examples/network_requests.spec.js","cypress/integration/examples/querying.spec.js","cypress/integration/examples/spies_stubs_clocks.spec.js","cypress/integration/examples/traversal.spec.js","cypress/integration/examples/utilities.spec.js","cypress/integration/examples/viewport.spec.js","cypress/integration/examples/waiting.spec.js","cypress/integration/examples/window.spec.js","cypress/fixtures/example.json","cypress/support/commands.js","cypress/support/index.js","cypress/plugins/index.js"] +0ms cypress:server:config got file tree +7ms cypress:server:project get saved state +28ms cypress:server:saved_state noop saved state +0ms cypress:server:scaffold plugins folder /root/cypress/plugins +5ms cypress:server:scaffold verify scaffolding in /root/cypress/plugins +0ms cypress:server:scaffold folder /root/cypress/plugins already exists +1ms cypress:server:plugins plugins.init /root/cypress/plugins/index.js +0ms cypress:server:plugins:child pluginsFile: /root/cypress/plugins/index.js +0ms cypress:server:plugins:child require pluginsFile +3ms cypress:server:plugins:child run plugins function +762ms cypress:server:plugins:child register event _get:task:body with id 0 +1ms cypress:server:plugins:child register event _get:task:keys with id 1 +0ms cypress:browserify received user options: { browserifyOptions: { transform: [ [Array], [Array], [Function: itifyTransform] ] } } +0ms cypress:server:plugins:child register event file:preprocessor with id 2 +6ms cypress:server:plugins register plugins process event _get:task:body with id 0 +1s cypress:server:plugins register event '_get:task:body' +0ms cypress:server:plugins register plugins process event _get:task:keys with id 1 +1ms cypress:server:plugins register event '_get:task:keys' +0ms cypress:server:plugins register plugins process event file:preprocessor with id 2 +0ms cypress:server:plugins register event 'file:preprocessor' +0ms cypress:server:project plugin config yielded: null +1s cypress:server:buffers resetting buffers +0ms cypress:server:server Server listening on { address: '127.0.0.1', family: 'IPv4', port: 52980 } +0ms cypress:server:appdata path: /root/.config/Cypress/cy/production/proxy +2s cypress:https-proxy Created SNI HTTPS Proxy on port 52982 +0ms cypress:server:ensure-url checking that baseUrl is available { baseUrl: 'https://lab4.XXXXX.pl:8282/', delaysRemaining: [ 3000, 3000, 4000 ], retryIntervals: [ 3000, 3000, 4000 ] } +0ms cypress:network:connect beginning getAddress { hostname: 'lab4.XXXXX.pl', port: 8282 } +0ms cypress:network:connect got addresses { hostname: 'lab4.XXXXX.pl', port: 8282, addresses: [ { address: '5.187.55.24', family: 4 } ] } +19ms cypress:server:server Setting remoteAuth undefined +83ms cypress:server:cors Parsed URL { port: '8282', tld: 'pl', domain: 'XXXXX' } +0ms cypress:server:server Setting remoteOrigin https://lab4.XXXXX.pl:8282 +32ms cypress:server:server Setting remoteHostAndPort { port: '8282', tld: 'pl', domain: 'XXXXX' } +0ms cypress:server:server Setting remoteDocDomain XXXXX.pl +0ms cypress:server:server Getting remote state: { auth: undefined, props: { port: '8282', tld: 'pl', domain: 'XXXXX' }, origin: 'https://lab4.XXXXX.pl:8282', strategy: 'http', visiting: undefined, domainName: 'XXXXX.pl', fileServer: null } +0ms cypress:server:project project config: { baseUrl: 'https://lab4.XXXXX.pl:8282/', defaultCommandTimeout: 6000, pageLoadTimeout: 80000, env: { correctUsername: 'cypress-admin', incorrectUsername: 'Bobbbbb', correctPassword: 'Itcraft1', incorrectPassword: 'Oooooo', correctSMScode: '1111', incorrectSMScode: '2222', team1: 'cypress-team1', team2: 'cypress-team2', divisions: [ 'Warszawa', 'Gdańsk', 'Szczecin', 'Bydgoszcz', 'Poznań', 'Zielona Góra', 'Wrocław', 'Opole', 'Katowice', 'Kraków', 'Rzeszów', 'Lublin', 'Radom', 'Łódź', 'Białystok', 'Olsztyn' ], roles: [ 'Administrator Główny', 'Administrator Lokalny', 'Power User', 'Użytkownik aplikacji mobilnej' ], 'objectsBiałystok': [ 'kuba_guzik (UM)', 'Sonda Awaryjna (SONDA)', 'Sonda test test (SONDA)' ], grep: 'login' }, projectRoot: '/root', projectName: 'root', morgan: false, isTextTerminal: true, socketId: '8pyd1', report: true, port: 52980, hosts: null, projectId: null, userAgent: null, reporter: 'spec', reporterOptions: null, blacklistHosts: null, clientRoute: '//', xhrRoute: '/xhrs/', socketIoRoute: '/socket.io', socketIoCookie: 'socket.io', reporterRoute: '/cypress/reporter', ignoreTestFiles: '*.hot-update.js', testFiles: '*/.*', requestTimeout: 5000, responseTimeout: 30000, execTimeout: 60000, taskTimeout: 60000, video: true, videoCompression: 32, videoUploadOnPasses: true, modifyObstructiveCode: true, chromeWebSecurity: true, waitForAnimations: true, animationDistanceThreshold: 5, numTestsKeptInMemory: 0, watchForFileChanges: false, trashAssetsBeforeRuns: true, autoOpen: false, viewportWidth: 1000, viewportHeight: 660, fileServerFolder: '/root', videosFolder: '/root/cypress/videos', supportFile: '/root/cypress/support/index.js', fixturesFolder: '/root/cypress/fixtures', integrationFolder: '/root/cypress/integration', screenshotsFolder: '/root/cypress/screenshots', namespace: 'cypress', pluginsFile: '/root/cypress/plugins/index.js', javascripts: [], cypressEnv: 'production', parentTestsFolder: '/root/cypress', parentTestsFolderDisplay: 'root/cypress', supportFolder: '/root/cypress/support', integrationExampleName: 'examples', integrationExamplePath: '/root/cypress/integration/examples', scaffoldedFiles: [ { name: 'cypress', children: [Array] } ], state: {}, proxyUrl: 'http://localhost:52980', browserUrl: 'https://lab4.XXXXX.pl:8282//', reporterUrl: 'https://lab4.XXXXX.pl:8282/__cypress/reporter', xhrUrl: '__cypress/xhrs/' } +217ms cypress:server:reporter trying to load reporter: spec +0ms cypress:server:reporter spec is Mocha reporter +0ms cypress:server:project scaffolding project /root +15ms cypress:server:scaffold support folder /root/cypress/support, support file /root/cypress/support/index.js +1s cypress:server:scaffold verify scaffolding in /root/cypress/support +0ms cypress:server:scaffold folder /root/cypress/support already exists +1ms cypress:server:project attempt watch plugins file: /root/cypress/plugins/index.js +2ms cypress:server:specs looking for test specs in the folder: /root/cypress/integration +0ms cypress:server:profilecleaner found 0 root level profile matches: [] +0ms cypress:server:profilecleaner found 0 profile folders: [] +1ms cypress:server:profilecleaner found 1 profile folders: [ '/root/.config/Cypress/Partitions/run-2661' ] +1ms cypress:server:profilecleaner finding process by pid: 2661 +1ms cypress:launcher checking one browser chrome +0ms cypress:launcher looking up chrome on linux platform +1ms cypress:launcher finding version string using command "google-chrome --version" +1ms cypress:launcher checking one browser chrome +65ms cypress:launcher looking up chrome on linux platform +0ms cypress:launcher finding version string using command "chrome --version" +1ms cypress:launcher checking one browser chrome +68ms cypress:launcher looking up chrome on linux platform +0ms cypress:launcher finding version string using command "google-chrome-stable --version" +0ms cypress:launcher Received error detecting browser binary: "chrome" with error: spawn chrome ENOENT +81ms cypress:launcher browser chrome not installed +1ms cypress:server:profilecleaner removing old profile { pid: 2661, folder: '/root/.config/Cypress/Partitions/run-2661' } +301ms cypress:server:specs found spec file /root/cypress/integration/create_user/add_avatar_specs.js +334ms cypress:server:specs found spec file /root/cypress/integration/create_user/check_divisions_selector.js +0ms cypress:server:specs found spec file /root/cypress/integration/create_user/check_nick_specs.js +0ms cypress:server:specs found spec file /root/cypress/integration/create_user/check_objects_selector.js +1ms cypress:server:specs found spec file /root/cypress/integration/create_user/check_password_specs.js +1ms cypress:server:specs found spec file /root/cypress/integration/create_user/check_phonenumber_specs.js +1ms cypress:server:specs found spec file /root/cypress/integration/create_user/check_role_selector.js +1ms cypress:server:specs found spec file /root/cypress/integration/create_user/check_username_specs.js +1ms cypress:server:specs found spec file /root/cypress/integration/create_user/create_user_and_check.js +0ms cypress:server:specs found spec file /root/cypress/integration/login/login_command_values.js +2ms cypress:server:specs found spec file /root/cypress/integration/login/login_specs.js +1ms cypress:server:specs found spec file /root/cypress/integration/login/login_using_token_cookie_specs.js +0ms cypress:server:specs found spec file /root/cypress/integration/logout/logout_spec.js +1ms cypress:server:specs found 13 spec files: [ { name: 'create_user/add_avatar_specs.js', relative: 'cypress/integration/create_user/add_avatar_specs.js', absolute: '/root/cypress/integration/create_user/add_avatar_specs.js' }, { name: 'create_user/check_divisions_selector.js', relative: 'cypress/integration/create_user/check_divisions_selector.js', absolute: '/root/cypress/integration/create_user/check_divisions_selector.js' }, { name: 'create_user/check_nick_specs.js', relative: 'cypress/integration/create_user/check_nick_specs.js', absolute: '/root/cypress/integration/create_user/check_nick_specs.js' }, { name: 'create_user/check_objects_selector.js', relative: 'cypress/integration/create_user/check_objects_selector.js', absolute: '/root/cypress/integration/create_user/check_objects_selector.js' }, { name: 'create_user/check_password_specs.js', relative: 'cypress/integration/create_user/check_password_specs.js', absolute: '/root/cypress/integration/create_user/check_password_specs.js' }, { name: 'create_user/check_phonenumber_specs.js', relative: 'cypress/integration/create_user/check_phonenumber_specs.js', absolute: '/root/cypress/integration/create_user/check_phonenumber_specs.js' }, { name: 'create_user/check_role_selector.js', relative: 'cypress/integration/create_user/check_role_selector.js', absolute: '/root/cypress/integration/create_user/check_role_selector.js' }, { name: 'create_user/check_username_specs.js', relative: 'cypress/integration/create_user/check_username_specs.js', absolute: '/root/cypress/integration/create_user/check_username_specs.js' }, { name: 'create_user/create_user_and_check.js', relative: 'cypress/integration/create_user/create_user_and_check.js', absolute: '/root/cypress/integration/create_user/create_user_and_check.js' }, { name: 'login/login_command_values.js', relative: 'cypress/integration/login/login_command_values.js', absolute: '/root/cypress/integration/login/login_command_values.js' }, { name: 'login/login_specs.js', relative: 'cypress/integration/login/login_specs.js', absolute: '/root/cypress/integration/login/login_specs.js' }, { name: 'login/login_using_token_cookie_specs.js', relative: 'cypress/integration/login/login_using_token_cookie_specs.js', absolute: '/root/cypress/integration/login/login_using_token_cookie_specs.js' }, { name: 'logout/logout_spec.js', relative: 'cypress/integration/logout/logout_spec.js', absolute: '/root/cypress/integration/logout/logout_spec.js' } ] +0ms cypress:server:run found '13' specs using spec pattern 'null': [ 'create_user/add_avatar_specs.js', 'create_user/check_divisions_selector.js', 'create_user/check_nick_specs.js', 'create_user/check_objects_selector.js', 'create_user/check_password_specs.js', 'create_user/check_phonenumber_specs.js', 'create_user/check_role_selector.js', 'create_user/check_username_specs.js', 'create_user/create_user_and_check.js', 'login/login_command_values.js', 'login/login_specs.js', 'login/login_using_token_cookie_specs.js', 'logout/logout_spec.js' ] +2s cypress:launcher stdout: Google Chrome 76.0.3809.100 +206ms cypress:launcher setting major version for {"name":"chrome","family":"chrome","displayName":"Chrome","version":"76.0.3809.100","path":"google-chrome"} +0ms cypress:launcher browser chrome version 76.0.3809.100 major version 76 +1ms cypress:launcher stdout: Google Chrome 76.0.3809.100 +115ms cypress:launcher setting major version for {"name":"chrome","family":"chrome","displayName":"Chrome","version":"76.0.3809.100","path":"google-chrome-stable"} +0ms cypress:launcher browser chrome version 76.0.3809.100 major version 76 +0ms cypress:launcher checking one browser chromium +1ms cypress:launcher looking up chromium on linux platform +0ms cypress:launcher finding version string using command "chromium-browser --version" +0ms cypress:launcher checking one browser chromium +54ms cypress:launcher looking up chromium on linux platform +0ms cypress:launcher finding version string using command "chromium --version" +0ms cypress:launcher Received error detecting browser binary: "chromium-browser" with error: spawn chromium-browser ENOENT +60ms cypress:launcher browser chromium not installed +0ms cypress:launcher Received error detecting browser binary: "chromium" with error: spawn chromium ENOENT +1ms cypress:launcher browser chromium not installed +0ms cypress:launcher checking one browser canary +1ms cypress:launcher looking up canary on linux platform +0ms cypress:launcher finding version string using command "google-chrome-canary --version" +1ms cypress:launcher Received error detecting browser binary: "google-chrome-canary" with error: spawn google-chrome-canary ENOENT +60ms cypress:launcher browser canary not installed +1ms

====================================================================================================

(Run Starting)

┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Cypress: 3.4.1 │ │ Browser: Electron 61 (headless) │ │ Specs: 13 found (create_user/add_avatar_specs.js, create_user/check_divisions_selector.j… │ └────────────────────────────────────────────────────────────────────────────────────────────────┘

────────────────────────────────────────────────────────────────────────────────────────────────────

Running: create_user/add_avatar_specs.js... (1 of 13)`

bahmutov commented 5 years ago

I don't see any messages from the plugin though - there are no DEBUG log with cypress-select-tests

Have you installed this plugin and added a line to the plugins file https://github.com/bahmutov/cypress-select-tests#mocha-like-selection ?

ghost commented 5 years ago

Yes, thats how my index.js looks like:

image

I tried to use comand:

sudo DEBUG=cypress-select-tests $(npm bin)/cypress run --env grep=login

but that way I did not get any debug logs.

bahmutov commented 5 years ago

@puszcza3a your plugins file is incorrect, look how there are 2 module.exports! Just replace entire file with

const selectTestsWithGrep = require('cypress-select-tests/grep')
module.exports = (on, config) => {
  on('file:preprocessor', selectTestsWithGrep(config))
}

and you should be good to go

ghost commented 5 years ago

Unfortunately, that did not solve the problem. I see in files, that module is installed, but does not matter what I put after fgrep or grep - cypress always runs all the tests.

I tried to run Debug command, but it seems to does not work with my project:

image

ghost commented 5 years ago

I finally managed to run the plugin but it does not work properly.

image

As you can see, it finds out that I want to run only login_specs.js. But after this test, it runs all another 12 test files.

bahmutov commented 5 years ago

Please try to run with with DEBUG variable set so you can see what the plugin does and why it does not filter files / specs the way you expect it to.

bahmutov commented 5 years ago

closing for lack of information