Initial commit of 001code-html Scratch frontend project.
Includes scratch-gui, scratch-vm, scratch-blocks, scratch-render, scratch-l10n, and deployment config. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
45
scratch-gui/test/integration/project-state.test.js
Normal file
45
scratch-gui/test/integration/project-state.test.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import path from 'path';
|
||||
import SeleniumHelper from '../helpers/selenium-helper';
|
||||
|
||||
const {
|
||||
clickText,
|
||||
clickXpath,
|
||||
findByXpath,
|
||||
getDriver,
|
||||
Key,
|
||||
loadUri
|
||||
} = new SeleniumHelper();
|
||||
|
||||
const uri = path.resolve(__dirname, '../../build/index.html');
|
||||
|
||||
let driver;
|
||||
|
||||
const FILE_MENU_XPATH = '//div[contains(@class, "menu-bar_menu-bar-item")]' +
|
||||
'[*[contains(@class, "menu-bar_collapsible-label")]//*[text()="File"]]';
|
||||
|
||||
describe('Project state', () => {
|
||||
beforeAll(() => {
|
||||
driver = getDriver();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await driver.quit();
|
||||
});
|
||||
|
||||
test('File->New resets project title', async () => {
|
||||
const defaultProjectTitle = 'Scratch Project';
|
||||
await loadUri(uri);
|
||||
const inputEl = await findByXpath(`//input[@value="${defaultProjectTitle}"]`);
|
||||
for (let i = 0; i < defaultProjectTitle.length; i++) {
|
||||
inputEl.sendKeys(Key.BACK_SPACE);
|
||||
}
|
||||
inputEl.sendKeys('Changed title of project');
|
||||
await clickText('Costumes'); // just to blur the input
|
||||
// verify that project title has changed
|
||||
await clickXpath('//input[@value="Changed title of project"]');
|
||||
await clickXpath(FILE_MENU_XPATH);
|
||||
await clickXpath('//li[span[text()="New"]]');
|
||||
// project title should be default again
|
||||
await clickXpath(`//input[@value="${defaultProjectTitle}"]`);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user