ambitious-monkey-72386
11/04/2022, 10:01 AMambitious-monkey-72386
11/04/2022, 10:01 AMambitious-monkey-72386
11/04/2022, 10:01 AMhelpful-twilight-57608
11/04/2022, 10:28 AMfierce-beach-68131
11/04/2022, 11:21 AMhelpful-twilight-57608
11/04/2022, 11:50 AMCypress.Commands.add('mount', (component, componentPath, additionalRoutes, options = {}) => {
const { routerProps = { initialEntries: ['/'] }, ...mountOptions } = options
const wrapped = <MemoryRouter {...routerProps}>
<Routes>
<Route path={componentPath} element={component} />
{additionalRoutes}
</Routes>
</MemoryRouter>
return mount(wrapped, mountOptions)
})
Then when I called the mount command I added an additional route with some text that I can does or does not exist (meaning I am or am not on a different page)
cy.mount(<MyComponent />, '/my-component-path',
<Route path="/" element={<div>home page</div>}/>,
{routerProps: {initialEntries: ['/my-component-path']}}
)
cy.contains('home page').should('not.exist');
cy.get('img').click();
cy.contains('home page').should('exist');
šearly-article-61542
11/04/2022, 12:22 PMfull-application-86498
11/04/2022, 1:08 PMfuture-activity-69925
11/04/2022, 2:07 PMadorable-smartphone-87280
11/04/2022, 2:31 PMadorable-optician-37575
11/04/2022, 3:31 PMbest-flower-17510
11/04/2022, 3:31 PMmammoth-london-89983
11/04/2022, 5:38 PMquaint-agency-3022
11/04/2022, 6:53 PMcold-terabyte-52337
11/04/2022, 8:30 PMexperimentalModifyObstructiveThirdPartyCode
flag and using cy.origin
https://docs.cypress.io/guides/references/experiments#Configuration
https://docs.cypress.io/api/commands/originwooden-glass-9489
11/04/2022, 11:04 PMfancy-mechanic-10638
11/04/2022, 11:28 PMcy.get().then
against the table, then do a cy.wrap(table).find
for the first column I care about, then inside that do another cy.wrap(table).find
for the second column I care about, then then I can do my checks. That's a bunch of nesting. Feels like I must be doing something wrong.fancy-mechanic-10638
11/04/2022, 11:36 PMcy.get('table').its('rows').should('have.length', 2)
fail to find the propery, but cy.get('table').then(table => expect(Cypress.$(table).prop('rows')).to.have.length(2)
work correctly? Aren't they doing the same thing?gray-kilobyte-89541
11/05/2022, 5:19 PMred-toddler-79937
11/06/2022, 1:20 PM@loginResponse
cuz it contains the datagray-kilobyte-89541
11/06/2022, 1:21 PMcy.then
or an aliasmany-animal-60948
11/06/2022, 1:38 PMred-toddler-79937
11/06/2022, 1:44 PMreturn cy.get('@loginResponse').its('response.body.data');
is there a way to return this without the type being undefined?red-toddler-79937
11/06/2022, 1:45 PMred-toddler-79937
11/06/2022, 1:46 PMhelpful-dress-32337
11/06/2022, 4:01 PMcy.get('elementId').trigger('mousedown', { button: 0 }).trigger('mousemove', x, y }).trigger('mouseup', { button:0 })
but its not working, the test passes but the drag and drop doesnt succeed, im pretty sure the mouse moves where its supposed to go but when the mouseup event happens it returns to the elementId position for some reason? ( i also tried it on w3s website and it doesnt work, so the iframe is not the reason. i also tried using realevents, it didnt work )helpful-dress-32337
11/06/2022, 4:05 PMconst getIframeDocument = () => {
return cy.get(".gjs-frame").its("0.contentDocument").should("exist");
};
const getIframeBody = () => {
// get the document
return (
getIframeDocument()
// automatically retries until body is loaded
.its("body")
.should("not.be.undefined")
// wraps "body" DOM element to allow
// chaining more Cypress commands, like ".find(...)"
.then(cy.wrap)
);
};
getIframeBody().find("#wrapper").as("Target");
cy.get('[title="Url"]').drag("@Target");
but i get uncaught exception, cannot read properties of getsetData
anyone can help?stale-optician-85950
11/06/2022, 6:12 PMwhite-army-50288
11/07/2022, 8:35 AMalert-tomato-11305
11/07/2022, 8:39 AM