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

Do not change to backdrops tab after adding a backdrop.

Expand on the backdrop integration test to make sure this is documented/tested behavior
parent 189a78d2
No related branches found
No related tags found
No related merge requests found
...@@ -5,11 +5,6 @@ import {defineMessages, injectIntl, intlShape} from 'react-intl'; ...@@ -5,11 +5,6 @@ import {defineMessages, injectIntl, intlShape} from 'react-intl';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import VM from 'scratch-vm'; import VM from 'scratch-vm';
import {
activateTab,
COSTUMES_TAB_INDEX
} from '../reducers/editor-tab';
import analytics from '../lib/analytics'; import analytics from '../lib/analytics';
import backdropLibraryContent from '../lib/libraries/backdrops.json'; import backdropLibraryContent from '../lib/libraries/backdrops.json';
import backdropTags from '../lib/libraries/backdrop-tags'; import backdropTags from '../lib/libraries/backdrop-tags';
...@@ -40,7 +35,6 @@ class BackdropLibrary extends React.Component { ...@@ -40,7 +35,6 @@ class BackdropLibrary extends React.Component {
skinId: null skinId: null
}; };
this.props.vm.setEditingTarget(this.props.stageID); this.props.vm.setEditingTarget(this.props.stageID);
this.props.onActivateTab(COSTUMES_TAB_INDEX);
this.props.vm.addBackdrop(item.md5, vmBackdrop); this.props.vm.addBackdrop(item.md5, vmBackdrop);
analytics.event({ analytics.event({
category: 'library', category: 'library',
...@@ -64,7 +58,6 @@ class BackdropLibrary extends React.Component { ...@@ -64,7 +58,6 @@ class BackdropLibrary extends React.Component {
BackdropLibrary.propTypes = { BackdropLibrary.propTypes = {
intl: intlShape.isRequired, intl: intlShape.isRequired,
onActivateTab: PropTypes.func.isRequired,
onRequestClose: PropTypes.func, onRequestClose: PropTypes.func,
stageID: PropTypes.string.isRequired, stageID: PropTypes.string.isRequired,
vm: PropTypes.instanceOf(VM).isRequired vm: PropTypes.instanceOf(VM).isRequired
...@@ -74,9 +67,7 @@ const mapStateToProps = state => ({ ...@@ -74,9 +67,7 @@ const mapStateToProps = state => ({
stageID: state.scratchGui.targets.stage.id stageID: state.scratchGui.targets.stage.id
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = () => ({});
onActivateTab: tab => dispatch(activateTab(tab))
});
export default injectIntl(connect( export default injectIntl(connect(
mapStateToProps, mapStateToProps,
......
import path from 'path';
import SeleniumHelper from '../helpers/selenium-helper';
const {
clickText,
clickXpath,
findByXpath,
getDriver,
getLogs,
loadUri,
scope
} = new SeleniumHelper();
const uri = path.resolve(__dirname, '../../build/index.html');
let driver;
describe('Working with backdrops', () => {
beforeAll(() => {
driver = getDriver();
});
afterAll(async () => {
await driver.quit();
});
test('Adding a backdrop from the library', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
// Start on the sounds tab of sprite1 to test switching behavior
await clickText('Sounds');
// Add a backdrop without selecting the stage first to test switching
await clickXpath('//button[@aria-label="Choose a Backdrop"]');
const el = await findByXpath("//input[@placeholder='Search']");
await el.sendKeys('blue');
await clickText('Blue Sky'); // Adds the backdrop
// Make sure the stage is selected and the sound tab remains selected.
// This is different from Scratch2 which selected backdrop tab automatically
// See issue #3500
await clickText('pop', scope.soundsTab);
// Make sure the backdrop was actually added by going to the backdrops tab
await clickText('Backdrops');
await clickText('Blue Sky', scope.costumesTab);
const logs = await getLogs();
await expect(logs).toEqual([]);
});
});
...@@ -80,17 +80,6 @@ describe('Working with costumes', () => { ...@@ -80,17 +80,6 @@ describe('Working with costumes', () => {
await expect(logs).toEqual([]); await expect(logs).toEqual([]);
}); });
test('Adding a backdrop', async () => {
await loadUri(uri);
await clickXpath('//button[@title="Try It"]');
await clickXpath('//button[@aria-label="Choose a Backdrop"]');
const el = await findByXpath("//input[@placeholder='Search']");
await el.sendKeys('blue');
await clickText('Blue Sky'); // Should close the modal
const logs = await getLogs();
await expect(logs).toEqual([]);
});
test('Converting bitmap/vector in paint editor', async () => { test('Converting bitmap/vector in paint editor', async () => {
await loadUri(uri); await loadUri(uri);
await clickXpath('//button[@title="Try It"]'); await clickXpath('//button[@title="Try It"]');
......
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