Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Visual Regression Testing

Yosuke Kurami
November 25, 2017

Introduction to Visual Regression Testing

For nodefest 17.
How introduce Visual Regression Testing into out products.

Yosuke Kurami

November 25, 2017
Tweet

More Decks by Yosuke Kurami

Other Decks in Programming

Transcript

  1. 1. How assert components ? w *Gtype: B XIBULJOEQSPQFSUZEPZPVBTTFSU 


    nodeName or textContent, classList <template> <class="greeting" div> <div v-if="type === 'A'"> Good evening, {{name}}. </div> <div class="type-b" v-else-if="type === 'B'"> Bon soir, {{name}}. </div> <div v-else>Other...</div> </div> </template>
  2. 1. How assert DOM ? w 0WFSBTTFSUJPO-PXNBJOUBJOBCJMJUZʜ
 'FXBTTFSUJPO6OFBTJOFTTʜ w 4P

    l4OBQTIPUUFTUJOHz ƭ The latest snapshot (DOM String) ƭ The actual snapshot (DOM String) Update if snapshot is accepted Assertion
  3. 2. We want to test Styles w 0VSVTFSTBSFOPUJOUFSFTUFEJO$44DMBTTOBNF .hoge {

    padding: 15px; color: #808080; border: 1px solid currentColor; } <div class="hoge"> ABCDEF </div> JOUFSFTUFE OPUJOUFSFTUFE
  4. That is question:
 To create or not to create w

    *OJUJBMMZXFUSJFETPNFTFSWJDFTPSUPPMT
 )PXFWFSUIFSFXBTOPUXIBUXFXBOU  w 8FEFDJEFEUPEFWFMPQPVSl7JTVBM3FHSFTTJPO 5FTUJOHzTZTUFN
  5. Divide into smaller problems w $BQUVSFTOBQTIPUT TDSFFOTIPUJNBHFT  w DPOTJEFSJOHJOUPl)PXJNQMFNFOUBOEUFTUz

    w $PNQBSFTOBQTIPUT TDSFFOTIPUJNBHFT  w DPOTJEFSJOHJOUPl%FWFMPQNFOUXPSLqPXz
  6. (e.g.) Stack of our product 'PSFYBNQMF "QQ'SBNFXPSL "OHVMBS 5FTU'SBNFXPSL +BTNJOF

    5FTU3VOOFS IBOENBEFUPPM #SPXTFS .BOJQVMBUPS 1VQQFUFFS $POUJOVPVT*OUFHSBUJPO 0SBDMF8FSDLFS$*
  7. 1. Web browsers in your CI env 1MFBTFSFGFSXIFOZPVDSFBUF%PDLFS*NBHFT  w

    *GZPVXBOUVTFlSFBMzXFCCSPXTFST w :PVOFFEYWGC 9XJOEPX7JSUVBM'SBNF#V⒎FS  w *GZPVXBOUUPVTF$ISPNFXJUIlIFBEMFTT w :PVOFFEYDC 9QSPUPDPM$MBOH#JOEJOHT
  8. 3. Avoid “false positive” 5PHVBSBOUFFl4BNFTPVSDF TBNFJNBHFz w 4VQQSFTT$44"OJNBUJPO w &YFDVUFDBQUVSJOHBTMBUFBTQPTTJCMF

    * { transition: none !important; animation: none !important; } requestIdleCallback(() => screenshot(), { timeout: 30000 });
  9. (almost all) Built with JavaScript w $-* /PEFKT  w

    $PNQBSFJNBHFTQOHKT QJYFMNBUDI w 4UPSFJNBHFT"844%, w (JU)VC"QQ "84-BNCEB  w "QPMMP(SBQI2-$MJFOU w $PNQBSJTPO3FQPSU 8FC#SPXTFS  w 'SPOUFOE7VFKT w %J⒎FSFODFNBSLFST0QFO$7 8FC"TTFNCMZ