Skip to content
Snippets Groups Projects
Commit d51c984b authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Add integration test for uploading a file and seeing the prompt

parent 361a9d73
No related branches found
No related tags found
No related merge requests found
File added
......@@ -4,9 +4,13 @@ import SeleniumHelper from '../helpers/selenium-helper';
const {
clickText,
clickXpath,
findByText,
findByXpath,
getDriver,
loadUri
loadUri,
rightClickText,
scope,
waitUntilGone
} = new SeleniumHelper();
const uri = path.resolve(__dirname, '../../build/index.html');
......@@ -74,4 +78,32 @@ describe('Menu bar settings', () => {
await clickText('Costumes'); // just to blur the input
await clickXpath('//input[@value="Scratch Project - Personalized"]');
});
test('User is not warned before uploading project file over a fresh project', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
await clickText('File');
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
await input.sendKeys(path.resolve(__dirname, '../fixtures/project1.sb3'));
await waitUntilGone(findByText('Loading'));
// No replace alert since no changes were made
await findByText('project1-sprite');
});
test('User is warned before uploading project file over an edited project', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
// Change the project by deleting a sprite
await rightClickText('Sprite1', scope.spriteTile);
await clickText('delete', scope.spriteTile);
await clickText('File');
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
await input.sendKeys(path.resolve(__dirname, '../fixtures/project1.sb3'));
await driver.switchTo().alert()
.accept();
await waitUntilGone(findByText('Loading'));
await findByText('project1-sprite');
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment