salmon-agent-14439
01/17/2023, 10:54 PMcy.window()
seems to not be returning its promise, and causing tests to timeout. Upon further investigation using Cypress 7.7.0 (an older version because the newer ones significantly increase test times), I discovered that in the Electron window's console (after the tests pass), cy
commands do not get run at all sometimes!
See the attached screenshot - test
got incremented only once, and from then on it wouldn't increment again. And this applies to any further cy.
commands - none of them work anymore (for example, cy.get('#foo').click()
wouldn't work).
Anyone knows what's going on?lively-match-61863
01/18/2023, 5:38 AMaloof-petabyte-2674
01/18/2023, 7:48 AMcy.task('log') timed out after waiting 60000ms
on('task', {
generateOTP: require('cypress-otp'),
log(msg) {
console.log(`[${new Date().toLocaleTimeString()}]: ${msg}`);
return null;
},
helpful-truck-53930
01/18/2023, 8:31 AMpurple-afternoon-2408
01/18/2023, 10:25 AMfilter
as per https://docs.cypress.io/api/commands/filter but it seems that it's not doing what I need. Here is example code:
cy.get('div').filter('label').filter('input');
I expect the statement above to yeld those div
elements. Considering that filter
is not helping, is there alternative?lively-balloon-98986
01/18/2023, 10:52 AMaloof-quill-23445
01/18/2023, 11:01 AMechoing-napkin-22534
01/18/2023, 11:09 AMUncaught SyntaxError: Unexpected token '.'
or Uncaught SyntaxError: invalid property id .
(dependending on the browser Cypress uses). But this only happens if the website is visited with Cypress. Using the website with a standard end-user browser shows no problems.
Does Cypress somehow change the JavaScript it loads in a way that could lead to such a SyntaxError? I have absolutely no clue how to debug this issue. The error position points to somewhere within the minified third-party source which is of no help. And, again, the source loads fine in other browsers.
Any hints for how to debug this problem? Thanks!breezy-pilot-11152
01/18/2023, 11:26 AMnpx cypress open
it just opens cypress and keeps loading.
Not sure if I configured it incorrectly. Can someone help?prehistoric-whale-53486
01/18/2023, 1:25 PMfaint-journalist-59022
01/18/2023, 2:17 PMripe-vr-94086
01/18/2023, 3:21 PMvisit
)? We're currently seeing some intermittent issues on navigating to our website and our backend folks have asked us to log the results of that command (to check the cookies, etc).
I'm also currently using https://github.com/archfz/cypress-terminal-report to log any messages from the browser console to our Cypress runs as well, which means if I can get the information on the browser console automatically, our Cypress CI runs will be able to log that info.
Thanks in advance!flat-rocket-60743
01/18/2023, 5:53 PMmillions-pizza-46232
01/18/2023, 7:09 PMawait cy.task()
does not seem to work, but it hopefully explains what I am trying to do. Does anyone have any ideas on how to do this? Thank you 🙂refined-rose-98234
01/18/2023, 8:12 PMcy.get("div").contains("hdp") and it seems like it finds it but when I try to add '.click()' even with force:true
and I get this result (screenshot 1)
Here's what the structure of the code looks like (screenshot 2)
I have tried .should
statements with various commands about containing text, adding cy.wait
before the get to make sure it's there but it seems like it's trying to find elements from the root document instead of the modal so any advice would be appreciated 🙂 thanks, new to Cypress.prehistoric-lion-87710
01/18/2023, 8:15 PMjavascript
const route = useRoute();
if (route.params.modelId) {
Cannot read properties of undefined (reading 'params')
what can I do ? useRoute() shouldn’t be undefined, should it ?narrow-jewelry-82430
01/19/2023, 12:35 AMjs
const cypress = require('cypress');
function runCypressTest() {
return cypress
.run({
headed: true,
env: {
url: 'my_url',
},
spec: './cypress/e2e/test.cy.js'
})
.then((results) => {
return results
})
.catch((err) => {
console.error(err)
})
}
runCypressTest().then((results) => {
console.log(results); // I need the element conents here
});
And this is my spec:
js
describe('has class', () => {
it('passes', () => {
cy.visit(Cypress.env('url'))
cy.get(".my_class").then(function($elem) {
cy.log($elem.text())
})
})
})
So currently I'm logging out the text of the element with cy.log($elem.text())
and the caller receives standard Cypress result of the test. I would need to somehow pass the value of an element back to the node function.
How can I do this? Is it possible to archive without using files to transfer the data between test and node function?chilly-magician-65885
01/19/2023, 1:52 AMchilly-magician-65885
01/19/2023, 1:58 AMancient-sundown-28754
01/19/2023, 3:17 AMheaders: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin',
},
Which works great and we test the browser by checking the window.crossOriginIsolated
which after setting the headers becomes true (https://developer.mozilla.org/en-US/docs/Web/API/crossOriginIsolated)
Now I want to use cypress to test some functionality around the SharedArrayBuffer, but could not find a place to set these headers. I disabled the chromeWebSecurity
but that didn't help either
I appreciate any help
PS: I found this comment, but not sure where to add the headers: https://github.com/cypress-io/cypress/issues/19912#issuecomment-1024276051average-yak-99766
01/19/2023, 3:57 AMlocalhost:3000
which lets them enter their organisation subdomain, ie. test-org
. When they submit the form and the API responds with the found organisation, we use window.location.host = ${data.subdomain}.${import.meta.env.VITE_REACT_STATIC_HOSTNAME}
which forces a page refresh, and thus they are at their given organisation which takes them to the login page ie. http://test-org.localhost:3000/login
The issue I'm experiencing is that when the window.location.host
occurs Cypress states test-org.localhost didn't return any data
and eventually times out.
VITE_REACT_STATIC_HOSTNAME
= localhost:3000
basic e2e test:
describe('E2E : Subdomain Page', () => {
it('should find the subdomain and direct user to the organisations login page', () => {
cy.visit('/')
// Input test organisation
const input = cy.get('input[type="text"]').should('have.attr', 'placeholder', 'domain')
input.type('test-org')
// Submit for
cy.get('button').contains('Continue').click()
})
})
config:
export default defineConfig({
hosts: {
'*.localhost': '127.0.0.1',
},
e2e: {
baseUrl: 'http://localhost:3000',
},
})
Any help to why this would be happening would be appreciated, thank you!
Have found a similar issue https://github.com/cypress-io/cypress/issues/18881 but didn't seem to work.adamant-agency-73481
01/19/2023, 7:52 AMstraight-microphone-66008
01/19/2023, 9:26 AMstocky-insurance-27750
01/19/2023, 9:41 AMe2e: { setupNodeEvents() { } }
and I'm wondering if it's possible put them in their own file(s) and then have an import in the setupNodeEvents...to keep it looking clean and tidy/easier to read?quaint-dusk-70197
01/19/2023, 1:38 PMkind-van-46599
01/19/2023, 1:39 PMcy.window().then((window) => {
const queryClient = window.queryClient;
/* javascript code to getQueriesData and modify it */
queryClient.setQueriesData();
});
colossal-balloon-20815
01/19/2023, 2:17 PMlively-balloon-98986
01/19/2023, 2:26 PMhelpful-coat-87654
01/19/2023, 3:26 PMechoing-tent-95037
01/19/2023, 4:59 PMshould('not.be.visible')
for the svg elements of the animation but it always passes even though the animation is still going. Any input on how to handle this is much appreciated.
If it helps our svg for this is:
<svg xmlns="http://www.w3.org/2000/svg" width="80px" height="80px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
<circle cx="50" cy="50" fill="none" stroke="#3F80F3" stroke-width="10" r="30" stroke-dasharray="141.37166941154067 49.12388980384689" transform="rotate(182.503 50 50)">
<animateTransform attributeName="transform" type="rotate" calcMode="linear" values="0 50 50;360 50 50" keyTimes="0;1" dur="2s" begin="0s" repeatCount="indefinite" />
</circle>
</svg>