Cleanup local storage before integration tests
This commit is contained in:
parent
52e49a1ed6
commit
99c060f4a7
18 changed files with 43 additions and 169 deletions
|
@ -131,9 +131,24 @@ function setPiskelFromImageSrc(src) {
|
||||||
}');
|
}');
|
||||||
}
|
}
|
||||||
|
|
||||||
function beforeTest() {
|
/**
|
||||||
// Cleanup local storage.
|
* Load the piskel website in debug mode and call the provided callback when ready.
|
||||||
casper.evaluate(function() {
|
*/
|
||||||
localStorage.clear();
|
function startTest(test, callback) {
|
||||||
}, {});
|
return casper
|
||||||
|
// Pass "integration-test" to avoid the "unsupported browser" dialog
|
||||||
|
.start(casper.cli.get('baseUrl')+"/?debug&integration-test")
|
||||||
|
.then(function () {
|
||||||
|
casper.echo("URL loaded");
|
||||||
|
|
||||||
|
casper.evaluate(function() {
|
||||||
|
localStorage.clear();
|
||||||
|
}, {});
|
||||||
|
casper.echo("Local storage cleaned");
|
||||||
|
|
||||||
|
casper.waitForSelector('#drawing-canvas-container canvas', callback, test.timeout, 20000);
|
||||||
|
})
|
||||||
|
.run(function () {
|
||||||
|
test.done();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,13 +55,5 @@ casper.test.begin('Test palette switches to tiny mode if it contains more than 1
|
||||||
'Check that the palette colors container is not in tiny mode');
|
'Check that the palette colors container is not in tiny mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
casper.echo("URL loaded");
|
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -104,13 +104,5 @@ casper.test.begin('Simple GIF (<256 colors) export test, with 2x scaling', 18, f
|
||||||
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
casper.echo("URL loaded");
|
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -93,13 +93,5 @@ casper.test.begin('Simple GIF (<256 colors) export test', 14, function(test) {
|
||||||
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
casper.echo("URL loaded");
|
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,15 +70,7 @@ casper.test.begin('Complex GIF export test', 11, function(test) {
|
||||||
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
casper.echo("URL loaded");
|
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Source for a base64 encoded PNG, 20x20, with 400 different colors.
|
// Source for a base64 encoded PNG, 20x20, with 400 different colors.
|
||||||
|
|
|
@ -111,24 +111,11 @@ casper.test.begin('PNG export test, with 2x scaling', 32, function(test) {
|
||||||
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
casper.echo("Test with spritesheet PNG export");
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
testButtonClass = '.png-download-button';
|
||||||
.then(function () {
|
startTest(test, onTestStart).then(function () {
|
||||||
casper.echo("Test with spritesheet PNG export");
|
casper.echo("Test with single frame PNG export");
|
||||||
beforeTest();
|
testButtonClass = '.selected-frame-download-button';
|
||||||
testButtonClass = '.png-download-button';
|
startTest(test, onTestStart);
|
||||||
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 () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -97,13 +97,5 @@ casper.test.begin('PNG export test', 13, function(test) {
|
||||||
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
casper.echo("URL loaded");
|
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -93,13 +93,5 @@ casper.test.begin('Image import test with an empty current sprite', 16, function
|
||||||
test.assertEquals(evalLine('pskl.app.piskelController.getFrameCount()'), 1, 'Piskel has 1 frame');
|
test.assertEquals(evalLine('pskl.app.piskelController.getFrameCount()'), 1, 'Piskel has 1 frame');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug&integration-test")
|
|
||||||
.then(function () {
|
|
||||||
casper.echo("URL loaded");
|
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -183,13 +183,5 @@ casper.test.begin('Double Image import test', 26, function(test) {
|
||||||
test.assertEquals(evalLine('pskl.app.piskelController.getFrameCount()'), 1, 'Piskel has 1 frame');
|
test.assertEquals(evalLine('pskl.app.piskelController.getFrameCount()'), 1, 'Piskel has 1 frame');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug&integration-test")
|
|
||||||
.then(function () {
|
|
||||||
casper.echo("URL loaded");
|
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -139,13 +139,5 @@ casper.test.begin('Simple Image import test', 27, function(test) {
|
||||||
test.assertEquals(evalLine('pskl.app.piskelController.getFrameCount()'), 1, 'Piskel has 1 frame');
|
test.assertEquals(evalLine('pskl.app.piskelController.getFrameCount()'), 1, 'Piskel has 1 frame');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug&integration-test")
|
|
||||||
.then(function () {
|
|
||||||
casper.echo("URL loaded");
|
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -65,13 +65,5 @@ casper.test.begin('Preferences settings panel test', 11, function(test) {
|
||||||
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
casper.echo("URL loaded");
|
|
||||||
casper.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -65,13 +65,5 @@ casper.test.begin('Test resize feature works, and check the output', 19, functio
|
||||||
]', 0, 0), 'Resized piskel content is as expected');
|
]', 0, 0), 'Resized piskel content is as expected');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
this.echo("URL loaded");
|
|
||||||
this.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,13 +66,5 @@ casper.test.begin('Test resize content works, and check the output', 18, functio
|
||||||
]', 0, 0), 'Resized piskel content is as expected');
|
]', 0, 0), 'Resized piskel content is as expected');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
this.echo("URL loaded");
|
|
||||||
this.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,13 +49,5 @@ casper.test.begin('Test updating default size works', 14 , function(test) {
|
||||||
322, 'Piskel height is now 322 pixels');
|
322, 'Piskel height is now 322 pixels');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
this.echo("URL loaded");
|
|
||||||
this.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -85,13 +85,5 @@ casper.test.begin('Test resize panel width/height inputs are synchronized', 28 ,
|
||||||
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
this.echo("URL loaded");
|
|
||||||
this.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -74,13 +74,5 @@ casper.test.begin('Test resize feature works, and check the output', 20, functio
|
||||||
]', 0, 0), 'Resized piskel content is as expected');
|
]', 0, 0), 'Resized piskel content is as expected');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
this.echo("URL loaded");
|
|
||||||
this.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -51,13 +51,5 @@ casper.test.begin('Test resize feature works', 16 , function(test) {
|
||||||
test.assertEquals(evalLine('pskl.app.piskelController.getPiskel().getHeight()'), 320, 'Piskel height is now 320 pixels');
|
test.assertEquals(evalLine('pskl.app.piskelController.getPiskel().getHeight()'), 320, 'Piskel height is now 320 pixels');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
this.echo("URL loaded");
|
|
||||||
this.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -71,13 +71,5 @@ casper.test.begin('Settings Test', 18, function(test) {
|
||||||
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
test.assert(!isDrawerExpanded(), 'settings drawer is closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
casper
|
startTest(test, onTestStart);
|
||||||
.start(casper.cli.get('baseUrl')+"/?debug")
|
|
||||||
.then(function () {
|
|
||||||
this.echo("URL loaded");
|
|
||||||
this.waitForSelector('#drawing-canvas-container canvas', onTestStart, test.timeout, 20000);
|
|
||||||
})
|
|
||||||
.run(function () {
|
|
||||||
test.done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue