mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Issue #803 - Add integration test for single png export
This commit is contained in:
parent
8662ab65ad
commit
27497313ff
@ -130,3 +130,10 @@ function setPiskelFromImageSrc(src) {
|
|||||||
});\
|
});\
|
||||||
}');
|
}');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function beforeTest() {
|
||||||
|
// Cleanup local storage.
|
||||||
|
casper.evaluate(function() {
|
||||||
|
localStorage.clear();
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
/* globals casper, setPiskelFromGrid, isDrawerExpanded, getValue, isChecked,
|
/* globals casper, setPiskelFromGrid, isDrawerExpanded, getValue, isChecked,
|
||||||
evalLine, waitForEvent, piskelFrameEqualsGrid, replaceFunction, setPiskelFromImageSrc */
|
evalLine, waitForEvent, piskelFrameEqualsGrid, replaceFunction, setPiskelFromImageSrc */
|
||||||
|
|
||||||
casper.test.begin('PNG export test, with 2x scaling', 16, function(test) {
|
// PNG export will be tested with single frame export and spritesheet export.
|
||||||
test.timeout = test.fail.bind(test, ['Test timed out']);
|
// This global variable will be set before starting each test.
|
||||||
|
var testButtonClass;
|
||||||
|
|
||||||
|
casper.test.begin('PNG export test, with 2x scaling', 32, function(test) {
|
||||||
|
test.timeout = test.fail.bind(test, ['Test timed out']);
|
||||||
function onTestStart() {
|
function onTestStart() {
|
||||||
test.assertExists('#drawing-canvas-container canvas', 'Piskel ready, test starting');
|
test.assertExists('#drawing-canvas-container canvas', 'Piskel ready, test starting');
|
||||||
|
|
||||||
@ -59,8 +62,8 @@ casper.test.begin('PNG export test, with 2x scaling', 16, function(test) {
|
|||||||
test.assertEquals(getValue('[name="resize-height"]'), "4", 'Resize height is 4px');
|
test.assertEquals(getValue('[name="resize-height"]'), "4", 'Resize height is 4px');
|
||||||
test.assertEquals(getValue('[name="resize-height"]'), "4", 'Resize height is 4px');
|
test.assertEquals(getValue('[name="resize-height"]'), "4", 'Resize height is 4px');
|
||||||
|
|
||||||
casper.echo('Clicking on Download PNG button');
|
casper.echo('Clicking on the export button');
|
||||||
casper.click('.png-download-button');
|
casper.click(testButtonClass);
|
||||||
|
|
||||||
casper.echo('Wait for #casper-imagedata-ready');
|
casper.echo('Wait for #casper-imagedata-ready');
|
||||||
casper.waitForSelector('#casper-imagedata-ready', onImageDataReady, test.timeout, 10000);
|
casper.waitForSelector('#casper-imagedata-ready', onImageDataReady, test.timeout, 10000);
|
||||||
@ -111,9 +114,20 @@ casper.test.begin('PNG export test, with 2x scaling', 16, function(test) {
|
|||||||
casper
|
casper
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
.start(casper.cli.get('baseUrl')+"/?debug")
|
||||||
.then(function () {
|
.then(function () {
|
||||||
casper.echo("URL loaded");
|
casper.echo("Test with spritesheet PNG export");
|
||||||
|
beforeTest();
|
||||||
|
testButtonClass = '.png-download-button';
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
||||||
})
|
})
|
||||||
|
.then(function () {
|
||||||
|
casper.start(casper.cli.get('baseUrl')+"/?debug")
|
||||||
|
.then(function () {
|
||||||
|
casper.echo("Test with single frame PNG export");
|
||||||
|
beforeTest();
|
||||||
|
testButtonClass = '.selected-frame-download-button';
|
||||||
|
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
||||||
|
})
|
||||||
|
})
|
||||||
.run(function () {
|
.run(function () {
|
||||||
test.done();
|
test.done();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user