Open YakovL opened 1 year ago
Ok, like I've reported in #764, I've added debugging in initialSetup
in synpress/commands/metamask.js:
async initialSetup(
playwrightInstance,
{
secretWordsOrPrivateKey,
network,
password,
enableAdvancedSettings,
enableExperimentalSettings,
},
) {
console.log(`YL debug point 1, process.env.NETWORK_NAME is ${process.env.NETWORK_NAME}`)
const isCustomNetwork =
(process.env.NETWORK_NAME &&
process.env.RPC_URL &&
process.env.CHAIN_ID &&
process.env.SYMBOL) ||
typeof network == 'object';
console.log(`YL debug point 1.1: isCustomNetwork is ${isCustomNetwork}`)
Suprisingly, it reports process.env.NETWORK_NAME
to be undefined
, although I've set it in .env. Do I have to load .env by myself?
PS Ok, I've installed dotenv
and used dotenv.config()
to fix this. Now execution doesn't seem to finish await playwright.init();
but also fails silently.
Making Synpress works with Cucumber id definitely a great idea! I will look into this issue when I have a chance. Thanks for sharing!
Right, so now that I've defeated several issues, the problem is boiled down to
The first one is quite a problem, as it slows down the feedback loop (when writing tests) to an extent that I'd call it "breaks it".
I'll update the repo to make it work as I have it working locally now (haven't done yet).
These might be related: https://github.com/Synthetixio/synpress/issues/404
Current DX is a total nightmare. The following 2 issues ruin the workflow:
cypress open
not working) means that the feedback loop for a change is several minutes, plus some of the info about errors is not available;Combined with the fact that some failures are randomly reproduced/not reproduced due to timeouts (I'm dealing with a complex DApp with behavior quirks), I'm getting the following DX problems:
cy.pause()
here and there trying to narrow down the issue (combine that with the random reproductivity to imagine the result).I'll do my best to provide a minimal reproducible example, but for now I'm just outlining the problems and asking to prioritize #417. I'm also looking for a way not to close Cypress window once it fails: this would help determining the step on which the problem occured and do some in-place debugging (like in the watch mode).
PS @kasparkallas I don't really see any connection. Why you think so?
Ok, looks like putting
afterEach(function() {
if (this.currentTest?.state === 'failed') {
cy.pause();
}
});
into a steps definition file is a working approach to beat the "not sure where the failure comes from" problem, as well as to access the sources by the stack trace). This helps a lot.
Another problem, a somewhat complicated one: https://github.com/cypress-io/cypress/issues/27437 – cy.visit
fails when using Synpress and Cucumber on a page that uses Chatbase. I'll probably create a separate issue for this here (in Synpress repo) as well, since removing Synpress removes the issue
The reason is that synpress is/was using async/await inside the before
hook.
My solution was to copy-paste-modify the original supports file and remove async-await:
before(() => {
if (!Cypress.env('SKIP_METAMASK_SETUP')) {
cy.setupMetamask();
}
});
Describe the bug I've successfully set up the Cucumber + Cypress bundle and now trying make Cucumber + Synpress work in a similar way.
However, I'm getting this error:
Stack trace is not very helpful:
My guess is, something's wrong with my config:
More precisely, I suspect that I should combine
synpressPlugins(on, config)
andawait addCucumberPreprocessorPlugin(on, config)
in a way so that the second command is only called once the first one finishes. However,await
doesn't help with that and generally I'm not sure how to combine them correctly. May be pass the rest as a callback tosynpressPlugins
as the second argument?To Reproduce
npm init i
,npm run test
(or justnpx cypress open
);Related repository https://github.com/YakovL/synpress-cucumber
Expected behavior The test should run.
Screenshots The error message and the stack trace covers it all, none informative screenshots.
Desktop (please complete the following information):
Additional context
414 looks related