Skip to content
Snippets Groups Projects
Unverified Commit ca8caa85 authored by Bryce Taylor's avatar Bryce Taylor Committed by GitHub
Browse files

Merge pull request #4871 from BryceLTaylor/Stabilize-Integration-Tests

Stabilize integration tests
parents 339dfe0b b9cefd32
Branches
No related tags found
No related merge requests found
......@@ -26,8 +26,7 @@ class SeleniumHelper {
'getSauceDriver',
'getLogs',
'loadUri',
'rightClickText',
'waitUntilGone'
'rightClickText'
]);
}
......@@ -85,7 +84,11 @@ class SeleniumHelper {
}
findByXpath (xpath, timeoutMessage = `findByXpath timed out for path: ${xpath}`) {
return this.driver.wait(until.elementLocated(By.xpath(xpath)), DEFAULT_TIMEOUT_MILLISECONDS, timeoutMessage);
return this.driver.wait(until.elementLocated(By.xpath(xpath)), DEFAULT_TIMEOUT_MILLISECONDS, timeoutMessage)
.then(el => (
this.driver.wait(el.isDisplayed(), DEFAULT_TIMEOUT_MILLISECONDS, `${xpath} is not visible`)
.then(() => el)
));
}
findByText (text, scope) {
......@@ -125,10 +128,6 @@ class SeleniumHelper {
return this.clickXpath(`//button//*[contains(text(), '${text}')]`);
}
waitUntilGone (element, timeoutMessage = 'waitUntilGone timed out') {
return this.driver.wait(until.stalenessOf(element), DEFAULT_TIMEOUT_MILLISECONDS, timeoutMessage);
}
getLogs (whitelist) {
if (!whitelist) {
// Default whitelist
......
......@@ -4,15 +4,13 @@ import path from 'path';
import SeleniumHelper from '../helpers/selenium-helper';
const {
findByText,
clickButton,
clickText,
clickXpath,
findByXpath,
getDriver,
getLogs,
loadUri,
waitUntilGone
loadUri
} = new SeleniumHelper();
let driver;
......@@ -31,7 +29,6 @@ describe('player example', () => {
test('Load a project by ID', async () => {
const projectId = '96708228';
await loadUri(`${uri}#${projectId}`);
await waitUntilGone(findByText('Loading'));
await clickXpath('//img[@title="Go"]');
await new Promise(resolve => setTimeout(resolve, 2000));
await clickXpath('//img[@title="Stop"]');
......
......@@ -9,8 +9,7 @@ const {
getDriver,
loadUri,
rightClickText,
scope,
waitUntilGone
scope
} = new SeleniumHelper();
const uri = path.resolve(__dirname, '../../build/index.html');
......@@ -78,7 +77,6 @@ describe('Menu bar settings', () => {
await clickText('File');
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
await input.sendKeys(path.resolve(__dirname, '../fixtures/project1.sb3'));
await waitUntilGone(findByText('Loading'));
// No replace alert since no changes were made
await findByText('project1-sprite');
});
......@@ -95,7 +93,6 @@ describe('Menu bar settings', () => {
await input.sendKeys(path.resolve(__dirname, '../fixtures/project1.sb3'));
await driver.switchTo().alert()
.accept();
await waitUntilGone(findByText('Loading'));
await findByText('project1-sprite');
});
});
......@@ -4,13 +4,11 @@ import SeleniumHelper from '../helpers/selenium-helper';
const {
clickText,
clickXpath,
findByText,
findByXpath,
getDriver,
getLogs,
loadUri,
scope,
waitUntilGone
scope
} = new SeleniumHelper();
const uri = path.resolve(__dirname, '../../build/index.html');
......@@ -39,7 +37,6 @@ describe('Loading scratch gui', () => {
const projectId = '96708228';
await loadUri(`${uri}#${projectId}`);
await waitUntilGone(findByText('Loading'));
await clickXpath('//img[@title="Go"]');
await new Promise(resolve => setTimeout(resolve, 2000));
await clickXpath('//img[@title="Stop"]');
......@@ -60,7 +57,6 @@ describe('Loading scratch gui', () => {
.setSize(1920, 1080);
const projectId = '96708228';
await loadUri(`${uri}#${projectId}`);
await waitUntilGone(findByText('Loading'));
await clickXpath('//img[@title="Full Screen Control"]');
await new Promise(resolve => setTimeout(resolve, 500));
await clickXpath('//img[@title="Go"]');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment