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

Add duplication integration tests for GUI

parent 44ce6df5
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ class SeleniumHelper { ...@@ -25,6 +25,7 @@ class SeleniumHelper {
// List of useful xpath scopes for finding elements // List of useful xpath scopes for finding elements
return { return {
blocksTab: "*[@id='react-tabs-1']", blocksTab: "*[@id='react-tabs-1']",
costumesTab: "*[@id='react-tabs-3']",
modal: '*[@class="ReactModalPortal"]', modal: '*[@class="ReactModalPortal"]',
reportedValue: '*[@class="blocklyDropDownContent"]', reportedValue: '*[@class="blocklyDropDownContent"]',
soundsTab: "*[@id='react-tabs-5']", soundsTab: "*[@id='react-tabs-5']",
......
...@@ -7,7 +7,9 @@ const { ...@@ -7,7 +7,9 @@ const {
findByXpath, findByXpath,
getDriver, getDriver,
getLogs, getLogs,
loadUri loadUri,
rightClickText,
scope
} = new SeleniumHelper(); } = new SeleniumHelper();
const uri = path.resolve(__dirname, '../../build/index.html'); const uri = path.resolve(__dirname, '../../build/index.html');
...@@ -36,6 +38,22 @@ describe('Working with costumes', () => { ...@@ -36,6 +38,22 @@ describe('Working with costumes', () => {
await expect(logs).toEqual([]); await expect(logs).toEqual([]);
}); });
test('Duplicating a costume', async () => {
await loadUri(uri);
await clickXpath('//button[@title="tryit"]');
await clickText('Costumes');
await rightClickText('costume1', scope.costumesTab);
await clickText('duplicate', scope.costumesTab);
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for duplication to finish
// Make sure the duplicated costume is named correctly.
await clickText('costume3', scope.costumesTab);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
test('Adding a backdrop', async () => { test('Adding a backdrop', async () => {
await loadUri(uri); await loadUri(uri);
await clickXpath('//button[@title="tryit"]'); await clickXpath('//button[@title="tryit"]');
......
...@@ -63,6 +63,22 @@ describe('Working with sounds', () => { ...@@ -63,6 +63,22 @@ describe('Working with sounds', () => {
await expect(logs).toEqual([]); await expect(logs).toEqual([]);
}); });
test('Duplicating a sound', async () => {
await loadUri(uri);
await clickXpath('//button[@title="tryit"]');
await clickText('Sounds');
await rightClickText('Meow', scope.soundsTab);
await clickText('duplicate', scope.soundsTab);
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for error
// Make sure the duplicated sound is named correctly.
await clickText('Meow2', scope.soundsTab);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
// Regression test for gui issue #1320 // Regression test for gui issue #1320
test('Switching sprites with different numbers of sounds', async () => { test('Switching sprites with different numbers of sounds', async () => {
await loadUri(uri); await loadUri(uri);
......
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