fresh-doctor-14925
08/04/2022, 9:48 AMgentle-accountant-4760
08/04/2022, 9:49 AMgray-kilobyte-89541
08/04/2022, 12:02 PMgentle-accountant-4760
08/04/2022, 12:03 PMincalculable-quill-48851
08/04/2022, 1:09 PMsparse-cpu-70188
08/04/2022, 1:27 PMadventurous-dream-20049
08/04/2022, 2:46 PM--tag
flag?adventurous-dream-20049
08/04/2022, 2:49 PMgray-kilobyte-89541
08/04/2022, 2:51 PMfresh-doctor-14925
08/04/2022, 2:51 PMadventurous-dream-20049
08/04/2022, 2:56 PMgorgeous-jordan-86065
08/04/2022, 3:01 PMwonderful-match-15836
08/04/2022, 3:24 PMfierce-lion-2381
08/04/2022, 3:38 PMgray-kilobyte-89541
08/04/2022, 4:51 PMbusy-ability-89181
08/04/2022, 5:02 PMexport function interceptAdminAjax(action: string, preWaitCallback?: CallableFunction ) {
cy.intercept('POST', '/wp-admin/admin-ajax.php', (req) => {
if (req.body.indexOf('action=' + action) > -1) {
req.alias = action;
}
});
if ('undefined' !== typeof preWaitCallback) {
preWaitCallback();
}
cy.wait( '@' + action ).should(({request, response}) => {
console.log(`${action} response:`, response?.body);
expect(response?.statusCode).to.eq(200)
expect(response?.body.success).to.eq(true)
})
}
busy-ability-89181
08/04/2022, 5:02 PMcy.interceptAdminAjax('create_new_class', ()={
cy.get('#confirm-add-class-btn').click()
})
busy-ability-89181
08/04/2022, 5:03 PMpreWaitCallback
was my lack luster attempt at doing this, where the idea is to call some kind of function/callback (or really some kind of cy
method) BEFORE calling the wait
busy-ability-89181
08/04/2022, 5:06 PM()={
durp should be ()=>{
busy-ability-89181
08/04/2022, 5:06 PMfierce-lion-2381
08/04/2022, 5:21 PMgray-kilobyte-89541
08/04/2022, 5:25 PMfierce-lion-2381
08/04/2022, 5:28 PMastonishing-byte-69184
08/04/2022, 9:57 PMastonishing-byte-69184
08/04/2022, 9:57 PMastonishing-byte-69184
08/04/2022, 10:20 PMbreezy-coat-40046
08/05/2022, 6:31 AMfresh-doctor-14925
08/05/2022, 7:05 AMnpx cypress open --e2e --browser electron // goes directly into the spec view
npx cypress open --component --browser electron // does the same for component tests
helpful-truck-53930
08/05/2022, 8:04 AMhallowed-florist-3643
08/05/2022, 8:05 AM