Files
scratch-gui/test/integration/backdrops.test.js
T
Paul Kaplan 79a9cbea1f Do not change to backdrops tab after adding a backdrop.
Expand on the backdrop integration test to make sure this is documented/tested behavior
2018-11-26 10:02:20 -05:00

53 lines
1.5 KiB
JavaScript

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([]);
});
});