mysterious-belgium-25713
10/10/2022, 6:02 PMlimited-barista-33480
10/10/2022, 6:10 PMmysterious-belgium-25713
10/10/2022, 6:14 PMlimited-barista-33480
10/10/2022, 6:17 PMlimited-agency-13286
10/10/2022, 7:55 PMvictorious-father-41976
10/11/2022, 6:02 AMcareful-cpu-45530
10/11/2022, 8:07 AMcy.get
cannot find anything in the DOM.
I am new to Cypress, so maybe my assumptions about how thing work are wrong. The code is in the comment.busy-dusk-58025
10/11/2022, 9:32 AMquick-school-90424
10/11/2022, 10:02 AMmysterious-belgium-25713
10/11/2022, 10:10 AMmysterious-belgium-25713
10/11/2022, 10:14 AMquick-school-90424
10/11/2022, 10:19 AMgray-kilobyte-89541
10/11/2022, 11:29 AMshould(callback)
https://glebbahmutov.com/cypress-examples/9.7.0/commands/assertions.html#should-with-callback-functionbusy-dusk-58025
10/11/2022, 12:22 PMgray-kilobyte-89541
10/11/2022, 12:53 PMmysterious-belgium-25713
10/11/2022, 12:54 PMbusy-dusk-58025
10/11/2022, 12:56 PMmysterious-belgium-25713
10/11/2022, 12:56 PMnutritious-army-46708
10/11/2022, 1:12 PMgray-father-52711
10/11/2022, 2:32 PMfresh-doctor-14925
10/11/2022, 2:39 PMcy.spy()
cy.intercept('/api/v1/tradeareas/states'), cy.spy().as('statesEndpoint'))
cy.get('@statesEndpoint').should('have.been.calledOnce')
I learned how to do this from @gray-kilobyte-89541 's advanced Cypress network testing exercises. I cannot recommend them enough https://cypress.tips/courses/network-testinggray-kilobyte-89541
10/11/2022, 2:52 PMhasAttribute
https://glebbahmutov.com/cypress-examples/9.7.0/recipes/or-attributes.htmlgray-father-52711
10/11/2022, 3:07 PMacceptable-solstice-90676
10/11/2022, 7:32 PMfresh-doctor-14925
10/11/2022, 8:32 PMrough-night-37887
10/12/2022, 6:42 AMThen('I set {string} field {string} to {string}', (page: string, locator: string, value: string) => {
searchGuestPage.getMyLocator().type(value);
// eslint-disable-next-line no-eval
(0,eval)(`${page}Page.get${locator}().type('${value}')`);
});
but I am getting a error that its not finding searchGuestPage, the previous line to the eval works properly and its exactly to what the eval will run, can someone guide me on how to make it work?acceptable-hamburger-48790
10/12/2022, 7:44 AMrough-night-37887
10/12/2022, 7:45 AMacceptable-hamburger-48790
10/12/2022, 7:48 AMrough-night-37887
10/12/2022, 7:51 AMThen('I set {string} field {string} to {string}', (page: string, locator: string, value: string) => {
// searchGuestPage.getMGMRewards().type(value);
cy.then(()=>{
// eslint-disable-next-line no-eval
eval(`${page}Page.get${locator}().type(${value})`);
}
);