chilly-quill-34099
09/06/2022, 2:49 PMit()
.
Maybe let me try to describe what I would like to do. The header of my website, which has several tests to be run, needs to be tested with different values for visit
.
In context of your image. I would like to run everything what is inside the describe('my test scope: dashboard page' ...
with several different values inside visit
.nutritious-army-46708
09/06/2022, 2:50 PMmelodic-ocean-83158
09/06/2022, 2:53 PMmelodic-ocean-83158
09/06/2022, 2:56 PMmelodic-ocean-83158
09/06/2022, 2:57 PMfierce-engineer-40904
09/06/2022, 2:57 PMfix
Error: Webpack Compilation Error
./cypress/e2e/twilioVoice.cy.ts
Module not found: Error: Can't resolve '@twilio/voice-sdk' in '/opt/atlassian/pipelines/agent/build/cypress/e2e'
resolve '@twilio/voice-sdk' in '/opt/atlassian/pipelines/agent/build/cypress/e2e'
melodic-ocean-83158
09/06/2022, 3:00 PMmelodic-ocean-83158
09/06/2022, 3:08 PMnutritious-army-46708
09/06/2022, 3:19 PMnutritious-army-46708
09/06/2022, 3:21 PMchilly-quill-34099
09/06/2022, 3:24 PMsticky-piano-45805
09/06/2022, 5:10 PMcy.origin()
but I tried to use that scheme and I couldn't managed it to work. π¦
The problem is that firstly I need to visit my application URL (baseURL) to be redirected to another domain. This step is necessary, as if the user has no valid session, it is directly redirected to the login form on another domain with additional information in a link, such as origin application and state for further token challenge (generated before redirecting and saved in session). After user submits the login form it is automatically redirected back to the page. So let's say we have something like this:
js
cy.visit('/');
cy.origin('https://amazinglogin.test', () => {
// Filling up the form and clicking submit
})
This isn't working in that case, as page never return load event (because it is programmatically moved to another domain) and test fails stuck on loaded page with form. In all examples that I saw Cypress always was loading a page, and then clicking a magic
"login" button, which redirected to another domain - this would work fine.
Do you know if there is some workaround for that or maybe this is a Cypress limitation for this moment? In worst case I will try to change login flow to using cy.request()
to get token for the tests, but I will really like to avoid that, as this will increase complexity of the whole flow.
And if you read this far, I hope you have a great day/evening! πnutritious-army-46708
09/06/2022, 5:24 PMsticky-piano-45805
09/06/2022, 5:27 PMcy.origin()
. So it would look like that:
js
cy.origin('https://amazinglogin.test', () => {
cy.visit('/'); // This visits https://amazinglogin.test, which I don't want
cy.visit('https://mysuperbapplication.me'); // This fails, as I'm trying to access another domain with visit, even if exactly that was set as baseUrl before
})
nutritious-army-46708
09/06/2022, 5:30 PMnutritious-army-46708
09/06/2022, 5:33 PMsticky-piano-45805
09/06/2022, 5:39 PMhttps://mysuperbapplication.me
- My main application, which redirects on startup to login page (also said as a baseUrl, which if I understand correctly sets it as origin for every test)
https://amazinglogin.test
- Login panelsticky-piano-45805
09/06/2022, 5:40 PMhttps://amazinglogin.test
directly, as it will result in error code because of lacking additional arguments in URLnutritious-army-46708
09/06/2022, 5:46 PMsticky-energy-17458
09/06/2022, 9:34 PMmodern-addition-58981
09/07/2022, 7:42 AMfierce-engineer-40904
09/07/2022, 8:12 AMjs
it('Should open widget with loading state', () => {
cy.get('[data-cy="twilio-widget"]').click({ force: true })
cy.get('[data-cy="call-button"]').should('exist')
})
I would like to when I press the button, pass in the prop state of Loading to be true, so I can see the loading modal instead of my default one.
js
if (isLoading) {
return (
<Modal
isOpen={isOpen}
onClose={onClose}
size="xl"
cy-data="modal-loading"
>
<Flex direction="column" m={4}>
<Skeleton height="30px" />
<SkeletonText mt={4} />
<Skeleton height="50px" mt={4} />
<Flex justify="center" mt={4}>
<Skeleton height="50px" width="120px" />
</Flex>
</Flex>
</Modal>
)
}
Anyone know how to do that with cypress?modern-addition-58981
09/07/2022, 9:02 AMacoustic-secretary-90500
09/07/2022, 9:15 AMacoustic-secretary-90500
09/07/2022, 9:15 AMacoustic-secretary-90500
09/07/2022, 9:16 AMrefined-painter-56677
09/07/2022, 2:22 PM/rpc/dags/int
is not found.
Here a log from my server docker container.
I noticed that there is no statusCode for the request and in the video,
the request never resolves and timeouts as "No request occured".
I am not sure if this happens becase the express server has a middleware on this route or not.
Other API calls on the server worked, like /fire/auth/sign
(another request before, worked)
request http: ####### Server API Request #######
request http: OPTIONS /fire/auth/sign 204
request http: ####### Server API Request #######
request http: POST /fire/auth/sign 200
(the failing request)
request http: ####### Server API Request #######
request http: POST /rpc/dags/int -
I am doing a:
in before:
cy.intercept({
method: "POST",
path: "/rpc/dags/int",
}).as("trigger")
in the body:
cy.wait("@trigger").then(({ response }) => {
expect(response.statusCode).to.eq(200)
})
But somehow the intercepted call is not found. Maybe someone knows the issue.
Locally the request resolves:
request http: ####### Server API Request #######
request http: POST /rpc/dags/int 200
I am not sure what's wrong, I have boot up the same environment as in github actions.
Best, Minhaloof-student-42798
09/07/2022, 2:26 PMstale-optician-85950
09/07/2022, 2:30 PMimport cypressGrep from 'cypress-grep';
Tagged test:
it(`Most important test ever`, { tags: ['@smoke'] }, () => {
CLI command:
yarn cypress run --browser chrome --env grepTags="@smoke",grepOmitFiltered=true
swift-rain-28843
09/07/2022, 3:40 PM