Necesito dar una lógica para automatizar el caso de prueba para el siguiente escenario. Pero no estoy seguro de cómo abordarlo. Ofrezco cada vez una nueva cantidad aleatoria, y necesito dar una condición de que la cantidad ofertada aleatoriamente no debe ser menor que la última cantidad ofertada en DB, si es menor que la cantidad en el sistema, debería darme una alerta, etc. Este es mi enfoque:
const minval = 100; const maxval = 100000; // divide by 100, then round down, then multiply by 100, eg: 1234 / 100 = 12.34, floor(12.34) = 12, 12 * 100 = 1200. Need these two steps because floor(1234) = 1234 const placeBidAmount = Math.floor((Math.random() * maxval) / 100) * 100 + minval; // in response body we have price amount and that should be equal const listPrice = placeBidAmount; const vehicleId = "aaaa"; const platformId = "xxx"; const platformUserId = 0;[![enter image description here][1]][1] it.only("place a bid on the selected auction", () => { cy.request({ method: "POST", url: `${Cypress.env('apiHostForEndpoints')}/bid`, headers: { Authorization: Cypress.env("token"), "content-type": Cypress.env("contentType"), }, body: { id: vehicleId, bid: placeBidAmount, auctionPlatformId: platformId, auctionPlatformUserId: platformUserId, }, failOnStatusCode: false, }).should((res) => { expect(res.status).to.eq(200); expect(res.body.id).eq(vehicleId); expect(res.body).to.have.property("id", vehicleId); expect(res.body).to.have.property("price", placeBidAmount); expect(res.body).to.have.property("winningBidPlatformId", platformId); expect(res.body.price).to.be.equal(listPrice); // assert // .isNotNull(res.body.id, "is not null") // .and.isNotNull(res.body.createdAt, "is not null"); }); });