Riferimento rapido

Cheat Sheet Zombie.js

Guida rapida al testing con browser headless tramite Zombie.js in Node.js: navigazione pagine, interazione con form, query ed asserzioni.

· Pubblicato

Zombie.js è una soluzione leggera e completa per test headless in ambiente Node.js.

Automazione del browser

Esempio di flusso di lavoro

browser
  .visit("http://localhost:3000/", () => {})
  .fill("email", "[email protected]")
  .fill("password", "eat-the-living")
  .select("Born", "1985")
  .uncheck("Send newsletter")
  .clickLink("Link name")
  .pressButton("Sign", () => { ... })
  .text("H1")

Aspettative e asserzioni

expect(browser.query("#brains"))

expect(browser.body.queryAll(".hand")).length(2)

console.log(browser.html())
console.log(browser.html("table.parts"))

expect(Browser.text(".card-nopad small"), "Un modo migliore per spostarsi!")

Argomenti correlati