update integration tests after selectMode step changes

This commit is contained in:
juliandescottes
2017-05-09 01:20:57 +02:00
committed by Julian Descottes
parent 42f329980c
commit 799bf76a86
2 changed files with 7 additions and 33 deletions

View File

@@ -1,7 +1,7 @@
/* globals casper, setPiskelFromGrid, isDrawerExpanded, getValue, isChecked, /* globals casper, setPiskelFromGrid, isDrawerExpanded, getValue, isChecked,
evalLine, waitForEvent, replaceFunction, setPiskelFromImageSrc */ evalLine, waitForEvent, replaceFunction, setPiskelFromImageSrc */
casper.test.begin('Double Image import test', 29, function(test) { casper.test.begin('Double Image import test', 25, function(test) {
test.timeout = test.fail.bind(test, ['Test timed out']); test.timeout = test.fail.bind(test, ['Test timed out']);
// Helper to retrieve the text content of the provided selector // Helper to retrieve the text content of the provided selector
@@ -109,13 +109,8 @@ casper.test.begin('Double Image import test', 29, function(test) {
function onSelectModeReady() { function onSelectModeReady() {
casper.echo('Select Mode step is displayed'); casper.echo('Select Mode step is displayed');
test.assertEquals(evalLine('document.querySelector("#select-mode-replace").checked'), true, casper.echo('Click on replace-button and wait for popup to close');
'The default import mode is the REPLACE mode'); casper.click('.current-step .import-mode-replace-button');
test.assertEquals(getTextContent('.import-next-button'), 'import',
'Next button found and has the expected text content (import)');
casper.echo('Click on next-button and wait for popup to close');
casper.click('.current-step .import-next-button');
casper.waitForSelector('#dialog-container-wrapper:not(.show)', onPopupClosed, test.timeout, 10000); casper.waitForSelector('#dialog-container-wrapper:not(.show)', onPopupClosed, test.timeout, 10000);
} }
@@ -172,13 +167,8 @@ casper.test.begin('Double Image import test', 29, function(test) {
function onSelectModeReady2() { function onSelectModeReady2() {
casper.echo('Select Mode step is displayed (again)'); casper.echo('Select Mode step is displayed (again)');
test.assertEquals(evalLine('document.querySelector("#select-mode-replace").checked'), true, casper.echo('Click on replace-button and wait for popup to close');
'The default import mode is the REPLACE mode'); casper.click('.current-step .import-mode-replace-button');
test.assertEquals(getTextContent('.import-next-button'), 'import',
'Next button found and has the expected text content (import)');
casper.echo('Click on next-button and wait for popup to close');
casper.click('.current-step .import-next-button');
casper.waitForSelector('#dialog-container-wrapper:not(.show)', onPopupClosed2, test.timeout, 10000); casper.waitForSelector('#dialog-container-wrapper:not(.show)', onPopupClosed2, test.timeout, 10000);
} }

View File

@@ -1,7 +1,7 @@
/* globals casper, setPiskelFromGrid, isDrawerExpanded, getValue, isChecked, /* globals casper, setPiskelFromGrid, isDrawerExpanded, getValue, isChecked,
evalLine, waitForEvent, replaceFunction, setPiskelFromImageSrc */ evalLine, waitForEvent, replaceFunction, setPiskelFromImageSrc */
casper.test.begin('Simple Image import test', 29, function(test) { casper.test.begin('Simple Image import test', 26, function(test) {
test.timeout = test.fail.bind(test, ['Test timed out']); test.timeout = test.fail.bind(test, ['Test timed out']);
// Helper to retrieve the text content of the provided selector // Helper to retrieve the text content of the provided selector
@@ -102,24 +102,8 @@ casper.test.begin('Simple Image import test', 29, function(test) {
casper.echo('Select Mode step is displayed'); casper.echo('Select Mode step is displayed');
checkImportPreview(test); checkImportPreview(test);
test.assertEquals(evalLine('document.querySelector("#select-mode-replace").checked'), true,
'The default import mode is the REPLACE mode');
test.assertEquals(getTextContent('.import-next-button'), 'import',
'Next button found and has the expected text content (import)');
// Click on export again to close the settings drawer.
casper.echo('Click on merge mode and wait for the next-button text to update');
casper.waitForSelectorTextChange('.current-step .import-next-button', onModeSelected, test.timeout, 10000);
casper.click('#select-mode-merge');
}
function onModeSelected() {
casper.echo('New mode was selected, check that the text of the next-button now reads "next"');
test.assertEquals(getTextContent('.import-next-button'), 'next',
'Next button found and has the expected text content (next) ');
casper.echo('Go to next step (adjust size)'); casper.echo('Go to next step (adjust size)');
casper.click('.current-step .import-next-button'); casper.click('.current-step .import-mode-merge-button');
casper.waitForSelector('.current-step .import-resize-info', onAdjustSizeReady, test.timeout, 10000); casper.waitForSelector('.current-step .import-resize-info', onAdjustSizeReady, test.timeout, 10000);
} }