Closed admah closed 2 years ago
I can confirm this is an issue. After updating to cypress 10 if any string pattern is included in the grep
or grepTags
options it will break the new specPattern
config from cypress and it wont load any specs at all.
I think this goes some way to getting this working in Cypress 10: #128
Would love to get some thoughts
Also ran into this while trying to add cypress-grep
to our repo after upgrading to cypress 10.
Your configFile threw an error from: /Users/samanthablasbalg/repos/wistia/cypress.config.js
The error was thrown while executing your e2e.setupNodeEvents() function:
TypeError: Patterns must be a string or an array of strings
at assertPatternsInput (/Users/samanthablasbalg/repos/wistia/node_modules/globby/index.js:16:9)
at generateGlobTasks (/Users/samanthablasbalg/repos/wistia/node_modules/globby/index.js:41:2)
at AsyncFunction.module.exports.sync (/Users/samanthablasbalg/repos/wistia/node_modules/globby/index.js:139:20)
at cypressGrepPlugin (/Users/samanthablasbalg/repos/wistia/node_modules/cypress-grep/src/plugin.js:60:32)
at setupNodeEvents (/Users/samanthablasbalg/repos/wistia/cypress.config.js:33:41)
Thanks @joshuajtward - will take a look. We should get this working with 10.0 asap.
Hi! Is there any update on this topic so far? We would like to migrate to Cypress 10 but are blocked by not using cypress-grep as we need filters for our environment. Thanks!
@rene1039 I am planning to look into it this week.
is there an estimated time where we could get the plugin working with cypress 10.0.0 ? thank you for your help.
@devim1982 see my comment above. Work towards this is being done in #128.
@admah we can close this issue now that #128 has been merged?
Yep, seems this is released and working with Cypress 10 as of 3.x: https://github.com/cypress-io/cypress-grep/releases/tag/v3.0.0
Edit: I do not have permissions on this repo, someone else will need to close it.
Will there be anything cypress releases to work like, from the first try?
@aminao-transformdata have you tried the v 3 version of this plugin? https://github.com/cypress-io/cypress-grep/releases/tag/v3.0.0
When Cypress 10 came out, this plugin had yet to be updated, but now it is (v3) and should be :100:
@aminao-transformdata have you tried the v 3 version of this plugin? https://github.com/cypress-io/cypress-grep/releases/tag/v3.0.0
When Cypress 10 came out, this plugin had yet to be updated, but now it is (v3) and should be ð¯
I don't get what this plugin has to do?
My issue is that after plugins/index.js no longer exist, I have hard time moving this peace to e2e.js file:
const { downloadFile } = require('cypress-downloadfile/lib/addPlugin'); const { isFileExist, findFiles } = require('cy-verify-downloads');
/**
on
is used to hook into various events Cypress emits
// config
is the resolved Cypress config
on('task', {
log(message) {
console.log(message);
return null;
},
isFileExist,
findFiles,
downloadFile,
});
};Put those things inside of setupNodeEvents
in your cypress.config.js
:
export default {
e2e: {
setupNodeEvents (on, config) {
on('task' ...
}
}
}
Put those things inside of
setupNodeEvents
in yourcypress.config.js
:export default { e2e: { setupNodeEvents (on, config) { on('task' ... } } }
I'm running in an issue that I don't see anyone ever had.
Project structure:
cypress.config.js
const { defineConfig } = require("cypress");
const { downloadFile } = require('cypress-downloadfile/lib/addPlugin');
const { isFileExist, findFiles } = require('cy-verify-downloads');
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
on('task', {
log(message) {
console.log(message);
return null;
},
isFileExist,
findFiles,
downloadFile,
});
},
baseUrl: '',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
},
});
commands.js
import { addCustomCommand } from 'cy-verify-downloads';
import 'cypress-downloadfile/lib/downloadFileCommand';
import './utils/auth';
import compareColor from './utils/compareColor';
import enableGQLListeners from './utils/enableGQLListeners';
import './utils/inViewPort';
import './utils/localStorage';
Cypress.Commands.add('visitHome', () => {
cy.visit('/');
});
Cypress.Commands.overwrite('log', (subject, message) =>
cy.task('log', message)
);
Cypress.Commands.add('enableGQLListeners', enableGQLListeners);
Cypress.Commands.overwrite(
'should',
(originalFn, subject, expectation, ...args) => {
const customMatchers = {
'have.backgroundColor': compareColor(args[0], 'backgroundColor'),
'have.color': compareColor(args[0], 'color'),
'have.borderColor': compareColor(args[0], 'borderColor'),
};
// See if the expectation is a string and if it is a member of Jest's expect
if (typeof expectation === 'string' && customMatchers[expectation]) {
// @ts-ignore
return originalFn(subject, customMatchers[expectation]);
}
// @ts-ignore
return originalFn(subject, expectation, ...args);
}
);
// cy-verify-downloads
addCustomCommand();
e2e.js
// Import commands.js using ES2015 syntax:
// import './commands'
// Alternatively you can use CommonJS syntax:
require('./commands')
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
Cypress.on('uncaught:exception', (err) => {
/* returning false here prevents Cypress from failing the test */
if (resizeObserverLoopErrRe.test(err.message)) {
return false;
}
return true;
});
When running script in headless(yarn cypress run --config-file cypress.config.js --spec "cypress/e2e/InstallPage/rendering.jsâ), in deletes everything I have under cypress folder.
error:
Oops...we found an error preparing this test file:
> cypress/support/e2e.js
The error was:
Error: Webpack Compilation Error
multi ./cypress/support/e2e.js
Do you see anything wrong with config file?
It deletes everything? That is VERY unexpected. Is it this plugin that is causing the deletion?
Hello ð I'm writing on behalf of the Cypress DX team. We wanted to notify you that some changes may need to be made to this plugin to ensure that it works in Cypress 10.
For more information, here is our official plugin update guide.