mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
* feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Added basic example test for Blockly Playground and Blockly Demo * feat: Add functionality to run playground and block factory test locally * feat: Add functionality to run playground and block factory test locally * feat: Add functionality to run playground and block factory test locally * feat: Add functionality to run playground and block factory test locally * feat: Create procedure test * feat: Create procedure test * feat: Create procedure test * chore: test for procedures * chore: test for procedures * chore: test for procedures * chore: test for procedures * fix: Switch broswer_test.yaml to be macOS as to match local development evn * fix: Switch broswer_test.yaml to be macOS as to match local development evn * fix: Switch broswer_test.yaml to be macOS as to match local development evn * fix: Switch broswer_test.yaml to be macOS as to match local development evn * fix: Update browser test to run manually, and move browser test suiteSetup in to a separate function
77 lines
2.0 KiB
JavaScript
77 lines
2.0 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2023 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Node.js script to run automated functional tests in Chrome, via webdriver.
|
|
* This file is to be used in the suiteSetup for any automated fuctional test.
|
|
*/
|
|
|
|
const webdriverio = require('webdriverio');
|
|
const path = require('path');
|
|
const {posixPath} = require('../../../scripts/helpers');
|
|
|
|
let browser;
|
|
async function testSetup(testFile) {
|
|
let url;
|
|
const options = {
|
|
capabilities: {
|
|
'browserName': 'chrome',
|
|
'goog:chromeOptions': {
|
|
args: ['--allow-file-access-from-files'],
|
|
},
|
|
},
|
|
services: [['selenium-standalone']],
|
|
logLevel: 'warn',
|
|
};
|
|
|
|
// Run in headless mode on Github Actions.
|
|
if (process.env.CI) {
|
|
options.capabilities['goog:chromeOptions'].args.push(
|
|
'--headless',
|
|
'--no-sandbox',
|
|
'--disable-dev-shm-usage'
|
|
);
|
|
} else {
|
|
// --disable-gpu is needed to prevent Chrome from hanging on Linux with
|
|
// NVIDIA drivers older than v295.20. See
|
|
// https://github.com/google/blockly/issues/5345 for details.
|
|
options.capabilities['goog:chromeOptions'].args.push('--disable-gpu');
|
|
}
|
|
// Use Selenium to bring up the page
|
|
if (testFile == testFileLocations.blockfactory) {
|
|
url =
|
|
'file://' +
|
|
posixPath(
|
|
path.join(__dirname, '..', '..', '..', 'demos', 'blockfactory')
|
|
) +
|
|
'/index.html';
|
|
} else if (testFile == testFileLocations.code) {
|
|
url =
|
|
'file://' +
|
|
posixPath(path.join(__dirname, '..', '..', '..', 'demos', 'code')) +
|
|
'/index.html';
|
|
} else {
|
|
url =
|
|
'file://' +
|
|
posixPath(path.join(__dirname, '..', '..')) +
|
|
'/playground.html';
|
|
}
|
|
console.log(url);
|
|
console.log('Starting webdriverio...');
|
|
browser = await webdriverio.remote(options);
|
|
console.log('Loading URL: ' + url);
|
|
await browser.url(url);
|
|
return browser;
|
|
}
|
|
|
|
const testFileLocations = {
|
|
blockfactory: 0,
|
|
code: 1,
|
|
playground: 2,
|
|
};
|
|
|
|
module.exports = {testSetup, testFileLocations};
|