Created
June 15, 2022 21:11
-
-
Save jinan-kordab/40b3ca3edaeda292994a5650017b7fb4 to your computer and use it in GitHub Desktop.
Cypress spec E2E changefeed test with RethinkDb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference types="cypress" /> | |
import Chance from "Chance"; | |
const chance = new Chance(); | |
//Testing Changefeeds in RethinkDB | |
context("Admin page", () => { | |
beforeEach(() => { | |
cy.generalLogin(); | |
}); | |
it("navigate to admin page and add new sweet", () => { | |
//Navigate | |
cy.visit("http://localhost:3000/admin"); | |
cy.contains("Welcome!"); | |
//Generate random sweet ID | |
const randNum = chance.integer({ min: 2022, max: 9007199254740991 }); | |
// Add new sweet manually using POST | |
cy.request({ | |
method: "POST", | |
url: "/food/products/sweet/", | |
form: true, | |
body: { | |
color: "CYPRESS-Color", | |
property: "CYPRESS-Property", | |
id: "" + randNum + "", | |
name: "CYPRESS-Name", | |
}, | |
}).as("sweet"); | |
cy.get("@sweet").should((response) => { | |
cy.wait(500); | |
}); | |
// // //Check if our newly added sweet is found | |
cy.contains("" + randNum + ""); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment