Skip to content
Snippets Groups Projects
Commit 21e9909f authored by Ben Wheeler's avatar Ben Wheeler
Browse files

revised and added tests to handle confirm on doing file new

parent bc419199
No related branches found
No related tags found
No related merge requests found
......@@ -115,9 +115,9 @@ describe('Loading scratch gui', () => {
test('Creating new project resets active tab to Code tab', async () => {
await loadUri(uri);
await clickText('View 2.0 Project');
const el = await findByXpath("//input[@placeholder='scratch.mit.edu/projects/123456789']");
const inputElement = await findByXpath("//input[@placeholder='scratch.mit.edu/projects/123456789']");
const projectId = '96708228';
await el.sendKeys(`scratch.mit.edu/projects/${projectId}`);
await inputElement.sendKeys(`scratch.mit.edu/projects/${projectId}`);
await clickXpath('//button[@title="View Project"]');
await new Promise(resolve => setTimeout(resolve, 2000));
await findByXpath('//*[span[text()="Costumes"]]');
......@@ -127,6 +127,41 @@ describe('Loading scratch gui', () => {
'contains(@class, "menu-bar_hoverable")][span[text()="File"]]'
);
await clickXpath('//li[span[text()="New"]]');
await findByXpath('//*[div[@class="scratchCategoryMenu"]]');
await clickText('Operators', scope.blocksTab);
});
test('Not logged in->made no changes to project->create new project should not show alert', async () => {
await loadUri(uri);
await clickText('View 2.0 Project');
const inputElement = await findByXpath("//input[@placeholder='scratch.mit.edu/projects/123456789']");
const projectId = '96708228';
await inputElement.sendKeys(`scratch.mit.edu/projects/${projectId}`);
await clickXpath('//button[@title="View Project"]');
await new Promise(resolve => setTimeout(resolve, 2000));
await clickXpath(
'//div[contains(@class, "menu-bar_menu-bar-item") and ' +
'contains(@class, "menu-bar_hoverable")][span[text()="File"]]'
);
await clickXpath('//li[span[text()="New"]]');
await findByXpath('//*[div[@class="scratchCategoryMenu"]]');
await clickText('Operators', scope.blocksTab);
});
test('Not logged in->made a change to project->create new project should show alert', async () => {
await loadUri(uri);
await clickText('View 2.0 Project');
const inputElement = await findByXpath("//input[@placeholder='scratch.mit.edu/projects/123456789']");
const projectId = '96708228';
await inputElement.sendKeys(`scratch.mit.edu/projects/${projectId}`);
await clickXpath('//button[@title="View Project"]');
await new Promise(resolve => setTimeout(resolve, 2000));
await clickText('move');
await clickXpath(
'//div[contains(@class, "menu-bar_menu-bar-item") and ' +
'contains(@class, "menu-bar_hoverable")][span[text()="File"]]'
);
await clickXpath('//li[span[text()="New"]]');
driver.switchTo()
.alert()
.accept();
......
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