mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 17:45:52 -05:00
test: fix (and speed up?) project-page.test.js
This commit is contained in:
parent
b3efcb9f64
commit
cdde117692
2 changed files with 16 additions and 21 deletions
|
@ -123,10 +123,6 @@ describe('www-integration project-page signed in', () => {
|
||||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
await findByXpath('//span[contains(@class, "profile-name")]');
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await driver.get(rootUrl);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async () => await driver.quit());
|
afterAll(async () => await driver.quit());
|
||||||
|
|
||||||
// LOGGED in TESTS
|
// LOGGED in TESTS
|
||||||
|
@ -191,23 +187,18 @@ describe('www-integration project-creation signed in', () => {
|
||||||
// expect(projectUrl).toBe(defined);
|
// expect(projectUrl).toBe(defined);
|
||||||
driver = await buildDriver('www-integration project-creation signed in');
|
driver = await buildDriver('www-integration project-creation signed in');
|
||||||
await driver.get(rootUrl);
|
await driver.get(rootUrl);
|
||||||
await driver.sleep(1000);
|
|
||||||
await signIn(username, password);
|
await signIn(username, password);
|
||||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
await findByXpath('//span[contains(@class, "profile-name")]');
|
||||||
|
|
||||||
// SauceLabs doesn't have access to the sb3 used in 'load project from file' test
|
// SauceLabs doesn't have access to the sb3 used in 'load project from file' test
|
||||||
// https://support.saucelabs.com/hc/en-us/articles/115003685593-Uploading-Files-to-a-Sauce-Labs-Virtual-Machine-during-a-Test
|
// https://support.saucelabs.com/hc/en-us/articles/115003685593-Uploading-Files-to-a-Sauce-Labs-Virtual-Machine-during-a-Test
|
||||||
if (remote) {
|
if (remote) {
|
||||||
await driver.get('https://github.com/LLK/scratch-www/blob/develop/test/fixtures/project1.sb3');
|
await driver.get('https://github.com/scratchfoundation/scratch-www/blob/develop/test/fixtures/project1.sb3');
|
||||||
await clickText('Download');
|
await clickXpath('//button[@data-testid="download-raw-button"]');
|
||||||
await driver.sleep(3000);
|
await driver.sleep(3000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await driver.get(rootUrl);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async () => await driver.quit());
|
afterAll(async () => await driver.quit());
|
||||||
|
|
||||||
test('make a copy of a project', async () => {
|
test('make a copy of a project', async () => {
|
||||||
|
@ -240,6 +231,9 @@ describe('www-integration project-creation signed in', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('load project from file', async () => {
|
test('load project from file', async () => {
|
||||||
|
// load the editor without making a new project
|
||||||
|
await driver.get(unownedSharedUrl);
|
||||||
|
|
||||||
// if remote, projectPath is Saucelabs path to downloaded file
|
// if remote, projectPath is Saucelabs path to downloaded file
|
||||||
const projectPath = remote ?
|
const projectPath = remote ?
|
||||||
'/Users/chef/Downloads/project1.sb3' :
|
'/Users/chef/Downloads/project1.sb3' :
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
const webdriver = require('selenium-webdriver');
|
const webdriver = require('selenium-webdriver');
|
||||||
const {PageLoadStrategy} = require('selenium-webdriver/lib/capabilities');
|
const {PageLoadStrategy} = require('selenium-webdriver/lib/capabilities');
|
||||||
|
const chrome = require('selenium-webdriver/chrome');
|
||||||
const bindAll = require('lodash.bindall');
|
const bindAll = require('lodash.bindall');
|
||||||
require('chromedriver');
|
const chromedriver = require('chromedriver');
|
||||||
const chromedriverVersion = require('chromedriver').version;
|
const chromedriverVersion = chromedriver.version;
|
||||||
|
|
||||||
const headless = process.env.SMOKE_HEADLESS || false;
|
const headless = process.env.SMOKE_HEADLESS || false;
|
||||||
const remote = process.env.SMOKE_REMOTE || false;
|
const remote = process.env.SMOKE_REMOTE || false;
|
||||||
|
@ -53,18 +54,18 @@ class SeleniumHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
getDriver () {
|
getDriver () {
|
||||||
const chromeCapabilities = webdriver.Capabilities.chrome();
|
const chromeOptions = new chrome.Options();
|
||||||
let args = [];
|
|
||||||
if (headless) {
|
if (headless) {
|
||||||
args.push('--headless');
|
chromeOptions.addArguments('--headless');
|
||||||
args.push('window-size=1024,1680');
|
|
||||||
args.push('--no-sandbox');
|
|
||||||
}
|
}
|
||||||
chromeCapabilities.set('chromeOptions', {args});
|
chromeOptions.addArguments('window-size=1024,1680');
|
||||||
chromeCapabilities.setPageLoadStrategy(PageLoadStrategy.EAGER);
|
chromeOptions.addArguments('--no-sandbox');
|
||||||
|
chromeOptions.addArguments('--disable-dev-shm-using');
|
||||||
|
chromeOptions.addArguments('--remote-debugging-port=9222');
|
||||||
|
chromeOptions.setPageLoadStrategy(PageLoadStrategy.EAGER);
|
||||||
let driver = new webdriver.Builder()
|
let driver = new webdriver.Builder()
|
||||||
.forBrowser('chrome')
|
.forBrowser('chrome')
|
||||||
.withCapabilities(chromeCapabilities)
|
.withCapabilities(chromeOptions)
|
||||||
.build();
|
.build();
|
||||||
return driver;
|
return driver;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue