diff --git a/test/casperjs/integration/settings/test-export-png.js b/test/casperjs/integration/settings/test-export-png.js index 1f6898e6..060c1efd 100644 --- a/test/casperjs/integration/settings/test-export-png.js +++ b/test/casperjs/integration/settings/test-export-png.js @@ -9,7 +9,7 @@ casper.test.begin('PNG export test', 13, function(test) { test.assert(!isDrawerExpanded(), 'settings drawer is closed'); - // Setup test Piskel + // Setup test Piskel setPiskelFromGrid('['+ '[B, T],' + '[T, B],' + diff --git a/test/casperjs/integration/settings/test-import-image-twice.js b/test/casperjs/integration/settings/test-import-image-twice.js index 38c768b4..47363ab7 100644 --- a/test/casperjs/integration/settings/test-import-image-twice.js +++ b/test/casperjs/integration/settings/test-import-image-twice.js @@ -1,7 +1,7 @@ /* globals casper, setPiskelFromGrid, isDrawerExpanded, getValue, isChecked, evalLine, waitForEvent, replaceFunction, setPiskelFromImageSrc */ -casper.test.begin('Double Image import test', 25, function(test) { +casper.test.begin('Double Image import test', 26, function(test) { test.timeout = test.fail.bind(test, ['Test timed out']); // Helper to retrieve the text content of the provided selector @@ -54,18 +54,21 @@ casper.test.begin('Double Image import test', 25, function(test) { test.assert(!isDrawerExpanded(), 'settings drawer is closed'); - waitForEvent('PISKEL_RESET', onPiskelReset, test.timeout); - // 1x1 black pixel var src = [ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcS', 'JAAAADUlEQVQYV2NgYGD4DwABBAEAcCBlCwAAAABJRU5ErkJggg==' ].join(''); setPiskelFromImageSrc(src); + + // For this test the most important is that the color service picked up the color from the sprite + // since it drives which flow will be used for the import. + casper.waitForSelector('.palettes-list-color:nth-child(1)', onPiskelPaletteUpdated, test.timeout, 10000); } - function onPiskelReset() { + function onPiskelPaletteUpdated() { // Check the expected piskel was correctly loaded. + test.assertEquals(evalLine('pskl.app.currentColorsService.getCurrentColors().length'), 1, 'Has 1 color'); test.assertEquals(evalLine('pskl.app.piskelController.getPiskel().getWidth()'), 1, 'Piskel width is 1 pixel'); test.assertEquals(evalLine('pskl.app.piskelController.getPiskel().getHeight()'), 1, 'Piskel height is 1 pixel'); diff --git a/test/casperjs/integration/settings/test-import-image.js b/test/casperjs/integration/settings/test-import-image.js index ddd16bba..953d4fb4 100644 --- a/test/casperjs/integration/settings/test-import-image.js +++ b/test/casperjs/integration/settings/test-import-image.js @@ -1,7 +1,7 @@ /* globals casper, setPiskelFromGrid, isDrawerExpanded, getValue, isChecked, evalLine, waitForEvent, replaceFunction, setPiskelFromImageSrc */ -casper.test.begin('Simple Image import test', 26, function(test) { +casper.test.begin('Simple Image import test', 27, function(test) { test.timeout = test.fail.bind(test, ['Test timed out']); // Helper to retrieve the text content of the provided selector @@ -30,18 +30,21 @@ casper.test.begin('Simple Image import test', 26, function(test) { test.assert(!isDrawerExpanded(), 'settings drawer is closed'); - waitForEvent('PISKEL_RESET', onPiskelReset, test.timeout); - // 1x1 black pixel var src = [ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcS', 'JAAAADUlEQVQYV2NgYGD4DwABBAEAcCBlCwAAAABJRU5ErkJggg==' ].join(''); setPiskelFromImageSrc(src); + + // For this test the most important is that the color service picked up the color from the sprite + // since it drives which flow will be used for the import. + casper.waitForSelector('.palettes-list-color:nth-child(1)', onPiskelPaletteUpdated, test.timeout, 10000); } - function onPiskelReset() { + function onPiskelPaletteUpdated() { // Check the expected piskel was correctly loaded. + test.assertEquals(evalLine('pskl.app.currentColorsService.getCurrentColors().length'), 1, 'Has 1 color'); test.assertEquals(evalLine('pskl.app.piskelController.getPiskel().getWidth()'), 1, 'Piskel width is 1 pixel'); test.assertEquals(evalLine('pskl.app.piskelController.getPiskel().getHeight()'), 1, 'Piskel height is 1 pixel');