You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to access the redux store when doing the e2e test (may sound weird but there is no way to reach the HTML element as it renders as WebGL layers on a canvas), now the pretty strange thing is that:
for the same test code running at
localhost against the server of localhost
localhost against the server of the deployed dev env website
localhost against the server of the deployed staging env website
github actions CI against the server of the deployed dev env website
all succeeded without any problem, but only when running at github actions CI against the server of the deployed staging env website failed with one single test case.
Here is my code, I am trying to compare the road highlight length before and after the CREATE operation. The length should be +1 if the code works as expected.
// get redux store comandCypress.Commands.add('getReduxStore',(key: string)=>{returncy.window().its('store').invoke('getState').then(state=>state[key])})// test codecy.getReduxStore('road').then(({ list })=>{constlengthBefore=list.length// CREATE operation ...cy.wait('@addRoad').then(interception=>{// the data is mocked so the response is consistent despite envsconst{ response }=interception// request succeededexpect(response.statusCode).eq(200)expect(response.body.status).eq('success')// check react state if the new avoid data existscy.getReduxStore('road').then(({ list })=>{// A new road should be added to the stateexpect(list.length).eq(lengthBefore+1)// -> failed hereconstids=Cypress._.map(list,'roadId')// avoidId should match the responseexpect(ids).include(response.body.roadId)})// should show success notificationcy.matchNotification(/success/i)})})
I know this sounds very crazy ( and it does drive me crazy), but from the downloaded video, visually you can tell that the test should pass.
This is the state before CREATE operation, which will increase the highlight on a certain road.
This is the state after CREATE operation, and it shows the highlight is added as expected.
This does not make any sense since the highlight roads are reactive to the road list in the redux store, it cannot be visually changed if the store does not change, and the test failed as the road list length somehow did NOT change, which is contradictory.
Here is the CI workflow, the only difference is the baseUrl as it points to different domains for tests against each env.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to access the redux store when doing the e2e test (may sound weird but there is no way to reach the HTML element as it renders as WebGL layers on a canvas), now the pretty strange thing is that:
for the same test code running at
all succeeded without any problem, but only when running at github actions CI against the server of the deployed staging env website failed with one single test case.
Here is my code, I am trying to compare the road highlight length before and after the CREATE operation. The length should be +1 if the code works as expected.
I know this sounds very crazy ( and it does drive me crazy), but from the downloaded video, visually you can tell that the test should pass.
This is the state before CREATE operation, which will increase the highlight on a certain road.
This is the state after CREATE operation, and it shows the highlight is added as expected.
This does not make any sense since the highlight roads are reactive to the road list in the redux store, it cannot be visually changed if the store does not change, and the test failed as the road list length somehow did NOT change, which is contradictory.
Here is the CI workflow, the only difference is the baseUrl as it points to different domains for tests against each env.
As I cannot reproduce this in other envs, I am not sure what is going on and what should be the problem.
If there are any similar issues/hints it would be really appreciated!
Or may have to consider visual testing instead of peeking at the redux store...
Beta Was this translation helpful? Give feedback.
All reactions