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

Add tests for uploading sprite and costume by file

parent 93df18b6
No related branches found
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
test/fixtures/gh-3582-png.png

61.4 KiB

...@@ -129,4 +129,35 @@ describe('Working with costumes', () => { ...@@ -129,4 +129,35 @@ describe('Working with costumes', () => {
const logs = await getLogs(); const logs = await getLogs();
await expect(logs).toEqual([]); await expect(logs).toEqual([]);
}); });
test('Adding an svg from file', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
await clickText('Costumes');
const el = await findByXpath('//button[@aria-label="Choose a Costume"]');
await driver.actions().mouseMove(el)
.perform();
await driver.sleep(500); // Wait for thermometer menu to come up
const input = await findByXpath('//input[@type="file"]');
await input.sendKeys(path.join(process.cwd(), 'test', 'integration', 'fixtures', '100-100.svg'));
await clickText('100-100', scope.costumesTab); // Name from filename
await clickText('100 x 100', scope.costumesTab); // Size is right
const logs = await getLogs();
await expect(logs).toEqual([]);
});
test('Adding a png from file (gh-3582)', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
await clickText('Costumes');
const el = await findByXpath('//button[@aria-label="Choose a Costume"]');
await driver.actions().mouseMove(el)
.perform();
await driver.sleep(500); // Wait for thermometer menu to come up
const input = await findByXpath('//input[@type="file"]');
await input.sendKeys(path.join(process.cwd(), 'test', 'integration', 'fixtures', 'gh-3582-png.png'));
await clickText('gh-3582-png', scope.costumesTab);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
}); });
...@@ -74,4 +74,39 @@ describe('Working with sprites', () => { ...@@ -74,4 +74,39 @@ describe('Working with sprites', () => {
const logs = await getLogs(); const logs = await getLogs();
await expect(logs).toEqual([]); await expect(logs).toEqual([]);
}); });
test('Adding a sprite by uploading a png', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
await driver.actions().mouseMove(el)
.perform();
await driver.sleep(500); // Wait for thermometer menu to come up
const input = await findByXpath('//input[@type="file"]');
await input.sendKeys(path.join(process.cwd(), 'test', 'fixtures', 'gh-3582-png.png'));
await clickText('gh-3582-png', scope.spriteTile);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
// This test fails because uploading an SVG as a sprite changes the scaling
// Enable when this is fixed issues/3608
test.skip('Adding a sprite by uploading an svg (gh-3608)', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
await driver.actions().mouseMove(el)
.perform();
await driver.sleep(500); // Wait for thermometer menu to come up
const input = await findByXpath('//input[@type="file"]');
await input.sendKeys(path.join(process.cwd(), 'test', 'fixtures', '100-100.svg'));
await clickText('100-100', scope.spriteTile); // Sprite is named for costume filename
// Check to make sure the size is right
await clickText('Costumes');
await clickText('100-100-costume1', scope.costumesTab); // The name of the costume
await clickText('100 x 100', scope.costumesTab); // The size of the costume
const logs = await getLogs();
await expect(logs).toEqual([]);
});
}); });
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