Skip to content

Instantly share code, notes, and snippets.

@matteocollina
Last active October 11, 2019 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matteocollina/ad61536e3e15c47d29d3250a905e6989 to your computer and use it in GitHub Desktop.
Save matteocollina/ad61536e3e15c47d29d3250a905e6989 to your computer and use it in GitHub Desktop.
Seminario su cypress
Usa JS, supportato solo su Chrome.
Vantaggio di cypress vs altri framework: non è fragile, infatti verifica che gli elementi siano nella viewport
(es. un bottone verifica che sia visible e cliccabile).
Intercettare chiamate http, fare tipo poxy, possibile mochare le chiamate
(quindi settare alcuni parametri nella risposta dal microservizio).
Testare come se fossi un utente.
GET: Faccio una query sulla base del testo che contiene (oppure data-test-id)
In aggiunta a cypress si può usare il tool "enzime" (prende react e lo esegue senza il browser - molto più veloce)
Ogni step (che inizia con "cy") è async, quindi i comandi non li esegue una dopo l'altro.
cypress-testing-library: extend di cypress
Browserstack: provider che mi permette di testare su altri browser.
Definire gli happy path: quelli fondamentali
It usarlo come nome delle sentenze : es. "it should ..."
Non usare fixture per credenziali, es. prendere un utente di tipo club-manager e poi generare un token per fare la login.
Test API con test a parte, solo sulle api.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment