[Chartjs]-Test a Chart.js canvas with Protractor

2👍

Protractor can get attributes of the canvas, but it can’t access object created within it. But it depends what you’re looking to do. Strategies for canvas testing might include image diffs, and string diffs, and often make use of browser.actions for manipulating them.

4👍

I think you may get the underlying chart data, by evaluating in the canvas‘s context. Example:

var canvas = element(by.css("canvas#test[data]"));
canvas.evaluate("test.data").then(function (data) {
    console.log(data);
});

Leave a comment