Automatically Detecting Visual Bugs in HTML5 <canvas> Games

Finlay Macklon, Mohammad Reza Taesiri, Markos Viggiato, Stefan Antoszko, Natalia Romanova +2 more
8/3/2022
cs.SE

Official code: asgaardlab/canvas-visual-bugs-testbed (10 stars, Python, MIT, last commit 2024-09-21).

Abstract

The HTML5 <canvas> is used to display high quality graphics in web applications such as web games (i.e., <canvas> games). However, automatically testing <canvas> games is not possible with existing web testing techniques and tools, and manual testing is laborious.

Show full abstract

Many widely used web testing tools rely on the Document Object Model (DOM) to drive web test automation, but the contents of the <canvas> are not represented in the DOM. The main alternative approach, snapshot testing, involves comparing oracle snapshot images with test-time snapshot images using an image similarity metric to catch visual bugs, i.e., bugs in the graphics of the web application. However, creating and maintaining oracle snapshot images for <canvas> games is onerous, defeating the purpose of test automation. In this paper, we present a novel approach to automatically detect visual bugs in <canvas> games. By leveraging an internal representation of objects on the <canvas>, we decompose snapshot images into a set of object images, each of which is compared with a respective oracle asset (e.g., a sprite) using four similarity metrics: percentage overlap, mean squared error, structural similarity, and embedding similarity. We evaluate our approach by injecting 24 visual bugs into a custom <canvas> game, and find that our approach achieves an accuracy of 100%, compared to an accuracy of 44.6% with traditional snapshot testing.

View on arXivView PDF

Code Implementations(1)

MIT

Visual testing framework for PixiJS applications

103Python, TypeScriptMay 4, 20222 years agoMIT
automated-testingcanvashtml5-canvaspixijsvisual-testing

Similar Papers

Cite this paper

@article{macklon2022automatically,
  title  = {Automatically Detecting Visual Bugs in HTML5 <canvas> Games},
  author = {Finlay Macklon and Mohammad Reza Taesiri and Markos Viggiato and Stefan Antoszko and Natalia Romanova and Dale Paas and Cor-Paul Bezemer},
  year   = {2022},
  eprint = {2208.02335},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2208.02335}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2208.02335.svg)](https://codeofpaper.com/paper/2208.02335)

Discussion