brave-doctor-62978
12/12/2022, 4:28 PMbrave-doctor-62978
12/12/2022, 4:28 PMbrave-doctor-62978
12/12/2022, 4:34 PMconst customMount = (component, options) => {
return cy.mount(
<DndContext>
<IntlProvider locale="en-US">
<Intl>
{ component }
</Intl>
</IntlProvider>
</DndContext>
, options);
};
Cypress.Commands.add('mount', customMount);
brave-doctor-62978
12/12/2022, 4:37 PMbrave-doctor-62978
12/12/2022, 5:03 PMkind-photographer-81911
12/12/2022, 8:57 PMcy.intercept(
'POST',
`**/${Cypress.env('API_BASE_URL')}/v2/sessions`,
(res) => {
const { host } = new URL(res.headers.referer);
const urlchain = host.split('.');
const subdomain = urlchain[0];
const targetDomain = session.user.site_entity.subdomain;
const statusCode = targetDomain === subdomain ? 200 : 418;
const body = statusCode === 200 ? session : 'redirect';
res.reply({
statusCode,
host: `http://${session.user.site_entity.subdomain}.localhost"`,
token: session.token,
body,
});
},
).as('postSessions');
});
});
Because it says on res.headers.referer Type 'string[]' is missing the following properties from type 'URL': hash, host, hostname, href, and 9 more.ts(2345)
I tried to add req to the parameter and test on that since it seems like it would be request and not reply, and then i tried to format the param passed to URL in a way that would. make typescript happy, but I just kept running into more and more typescript issues no matter how I wrote it. Just trying to get rid of this linting error, it's not failing.gray-kilobyte-89541
12/12/2022, 9:57 PMstraight-chef-47891
12/12/2022, 11:07 PM// @ts-ignore
so I don't need to include it in every spec files having the grep tags?gray-kilobyte-89541
12/12/2022, 11:36 PMworried-lifeguard-15953
12/13/2022, 12:00 AM<tr>
elements. I'm trying to tests rearranging them in Cypress following what the docs say here https://docs.cypress.io/api/commands/trigger#jQuery-UI-Sortable. The test passes, but it's not actually dragging & dropping the <tr>
that I'm indicating. Am I missing something?cool-businessperson-62347
12/13/2022, 1:22 AMcy.get('[data-cy="test-id"]').should(
'have.text',
'orange',
)
Is there anywhere I can change the case for the text I am fetching?gray-kilobyte-89541
12/13/2022, 1:27 AMcy.contains
instead, which can ignore case https://glebbahmutov.com/cypress-examples/9.7.0/commands/querying.html#cy-contains
With Cypress v12 queries and cypress-map
plugin you can also do cy.get('...').map('innerText').invoke('toUpperCase').should('equal', ['ORANGE'])
or if there is just one element cy.get('...').first()...
cuddly-jordan-61375
12/13/2022, 8:51 AMfresh-doctor-14925
12/13/2022, 9:10 AMTS
will be compiled into javascript, as browsers don't read typescript
This free course helped me to get a better understanding of how TS works when used in conjunction with cypress
https://testautomationu.applitools.com/cypress-with-typescript/cuddly-jordan-61375
12/13/2022, 9:15 AMdelightful-waiter-56869
12/13/2022, 12:46 PMswift-spoon-76449
12/13/2022, 1:04 PMrough-oxygen-26641
12/13/2022, 1:20 PMsquare-shampoo-53343
12/13/2022, 1:45 PMswift-spoon-76449
12/13/2022, 1:50 PMsquare-shampoo-53343
12/13/2022, 1:53 PMrefined-architect-49921
12/13/2022, 2:58 PMcuddly-jordan-61375
12/13/2022, 3:06 PMcuddly-jordan-61375
12/13/2022, 3:08 PMbitter-fountain-36713
12/13/2022, 3:25 PMmany-salesclerk-22087
12/13/2022, 3:51 PMcy.intercept(`${root}/**`, (req) => {
req.headers['Authorization'] = `Bearer ${bearerToken}`;
req.on('before:response', (res) => {
res.headers['cache-control'] = 'no-store';
console.log(res)
});
console.log(req)
});
Only the first console.log(req)
from the request before the redirect is called. It should be called twice.
Am I doing something wrong? How could make this work?quick-wolf-87390
12/13/2022, 4:00 PMcold-cat-63632
12/13/2022, 4:14 PMcold-cat-63632
12/13/2022, 4:15 PM