Add integration tests for multiple file upload

Including sprites, backdrops, costumes and sounds inputs
This commit is contained in:
Paul Kaplan committed 2019-02-06 12:09:43 -05:00
1 parent 8a46b8f71b
commit 7eabc4d9cd
6 files changed
+93

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+27
View File
@@ -4,6 +4,7 @@ import SeleniumHelper from '../helpers/selenium-helper';
const {
clickText,
clickXpath,
findByText,
findByXpath,
getDriver,
getLogs,
@@ -49,4 +50,30 @@ describe('Working with backdrops', () => {
const logs = await getLogs();
await expect(logs).toEqual([]);
});
test.only('Adding multiple backdrops at the same time', async () => {
const files = [
path.resolve(__dirname, '../fixtures/gh-3582-png.png'),
path.resolve(__dirname, '../fixtures/100-100.svg')
];
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
const buttonXpath = '//button[@aria-label="Choose a Backdrop"]';
const fileXpath = `${buttonXpath}/following-sibling::div//input[@type="file"]`;
const el = await findByXpath(buttonXpath);
await driver.actions().mouseMove(el)
.perform();
await driver.sleep(500); // Wait for thermometer menu to come up
const input = await findByXpath(fileXpath);
await input.sendKeys(files.join('\n'));
await clickXpath('//span[text()="Stage"]');
await findByText('gh-3582-png', scope.costumesTab);
await findByText('100-100', scope.costumesTab);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
});
+22
View File
@@ -4,6 +4,7 @@ import SeleniumHelper from '../helpers/selenium-helper';
const {
clickText,
clickXpath,
findByText,
findByXpath,
getDriver,
getLogs,
@@ -181,4 +182,25 @@ describe('Working with costumes', () => {
await expect(logs).toEqual([]);
});
test.only('Adding multiple costumes at the same time', async () => {
const files = [
path.resolve(__dirname, '../fixtures/gh-3582-png.png'),
path.resolve(__dirname, '../fixtures/100-100.svg')
];
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(files.join('\n'));
await findByText('gh-3582-png', scope.costumesTab);
await findByText('100-100', scope.costumesTab);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
});
+23
View File
@@ -4,6 +4,7 @@ import SeleniumHelper from '../helpers/selenium-helper';
const {
clickText,
clickXpath,
findByText,
findByXpath,
getDriver,
getLogs,
@@ -114,4 +115,26 @@ describe('Working with sounds', () => {
const logs = await getLogs();
await expect(logs).toEqual([]);
});
test.only('Adding multiple sounds at the same time', async () => {
const files = [
path.resolve(__dirname, '../fixtures/movie.wav'),
path.resolve(__dirname, '../fixtures/sneaker.wav')
];
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
await clickText('Sounds');
const el = await findByXpath('//button[@aria-label="Choose a Sound"]');
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(files.join('\n'));
await findByText('movie', scope.soundsTab);
await findByText('sneaker', scope.soundsTab);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
});
+21
View File
@@ -159,4 +159,25 @@ describe('Working with sprites', () => {
await expect(logs).toEqual([]);
});
test.only('Adding multiple sprites at the same time', async () => {
const files = [
path.resolve(__dirname, '../fixtures/gh-3582-png.png'),
path.resolve(__dirname, '../fixtures/100-100.svg')
];
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(files.join('\n'));
await findByText('gh-3582-png', scope.spriteTile);
await findByText('100-100', scope.spriteTile);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
});