user
03/25/2022, 1:06 AMadorable-smartphone-87280
03/25/2022, 1:42 AMuser
03/25/2022, 3:14 AMadorable-smartphone-87280
03/25/2022, 3:26 AMadorable-smartphone-87280
03/25/2022, 3:26 AMuser
03/25/2022, 3:34 AMadorable-smartphone-87280
03/25/2022, 3:37 AMuser
03/25/2022, 3:44 AMWhether Cypress should automatically retry status code errors under the hood. Cypress will retry a request up to 4 times if this is set to true
adorable-smartphone-87280
03/25/2022, 3:48 AMfierce-stone-88794
03/28/2022, 8:43 AMshy-country-15366
03/28/2022, 4:07 PMshy-country-15366
03/28/2022, 4:10 PMshy-country-15366
03/28/2022, 4:11 PMshy-country-15366
03/28/2022, 4:11 PM// stub an empty response to requests for books
cy.intercept('GET', '/books', []).as('getBooks')
cy.get('#search').type('Peter Pan')
// wait for the first response to finish
cy.wait('@getBooks')
// the results should be empty because we
// responded with an empty array first
cy.get('#book-results').should('be.empty')
// now the request (aliased again as `getBooks`) will return one book
cy.intercept('GET', '/books', [{ name: 'Peter Pan' }]).as('getBooks')
cy.get('#search').type('Peter Pan')
// when we wait for 'getBooks' again, Cypress will
// automatically know to wait for the 2nd response
cy.wait('@getBooks')
// we responded with one book the second time
cy.get('#book-results').should('have.length', 1)
shy-country-15366
03/28/2022, 4:16 PM// stub an empty response to requests for books
cy.intercept('GET', '/books').as('getBooks')
cy.get('#search').type('No book...')
// API call is made, wait spinner or something to disappear (= api has responded)
// the results should be empty because we
// responded with an empty array first
cy.get('#book-results').should('be.empty')
cy.get('#search').type('Peter Pan')
// when we wait for 'getBooks' again,
cy.wait('@getBooks').its('response.statusCode').should('eq', 200)
// we responded with one book the second time
cy.get('#book-results').should('have.length', 1)
shy-country-15366
03/28/2022, 4:19 PM.its('response.statusCode').should('eq', 200)
Cypress isn't going to wait for the response because it has already received a response from 'getBooks', but if I add the .its('response.statusCode').should('eq', 200)
it will wait for a new response before continuing. Am I getting it right?tall-airplane-97209
03/28/2022, 9:13 PMpowerful-orange-86819
03/29/2022, 10:38 AMjs
cy.intercept({
method: "GET",
pathname: "/api/v1/request-transaction",
query: {
paymentStatus: "PENDING",
},
times: 1,
}).as("getRequest");
shy-country-15366
03/29/2022, 1:45 PMshy-country-15366
03/29/2022, 1:46 PMpowerful-orange-86819
03/29/2022, 1:52 PMshy-country-15366
03/29/2022, 2:18 PMadorable-smartphone-87280
03/29/2022, 2:20 PMtimes: 1
in the second intercept
if using the same data? Do you re-use the same alias name in the second intercept
?powerful-orange-86819
03/29/2022, 2:24 PMadorable-smartphone-87280
03/29/2022, 3:06 PMcrooked-vase-82118
03/30/2022, 1:02 PMts
describe('Already accepted', () => {
it('When policy is already accepted, then skip ToS page', () => {
cy.wrap(
Storage.set({ key: 'tosTimestamp', value: new Date().toISOString() })
);
cy.visit('/');
cy.url().should('include', '/tabs/home');
});
});
However, the test fails with a generic error message:
The following error originated from your test code, not from Cypress.
> Unexpected token '<'
Furthermore, I discovered that the Storage plugin from Capacitor and the the localStorage API are not aligned, in the sense that if I try setting a key/value entry using the localStorage, then Capacitor is not able to read it.
Thank you for any suggestions!brief-agency-15720
04/01/2022, 7:00 PMpowerful-gigabyte-69168
04/03/2022, 12:42 PMacoustic-finland-93241
04/03/2022, 5:04 PMgray-agent-80430
04/04/2022, 5:33 AM