From 37940a1876cc1b735bbb504e43f7959414c05724 Mon Sep 17 00:00:00 2001 From: ericblackmonGoogle <129398736+ericblackmonGoogle@users.noreply.github.com> Date: Fri, 12 May 2023 14:29:42 -0400 Subject: [PATCH] chore: add ability to test block factory and playground locally (#7087) * 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 --- .github/workflows/browser_test.yml | 5 ++++- tests/browser/test/basic_block_factory_test.js | 9 ++++++++- tests/browser/test/basic_playground_test.js | 8 +++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/browser_test.yml b/.github/workflows/browser_test.yml index 330c104d6..414dd721b 100644 --- a/.github/workflows/browser_test.yml +++ b/.github/workflows/browser_test.yml @@ -51,7 +51,10 @@ jobs: if: runner.os == 'macOS' run: source ./tests/scripts/setup_osx_env.sh - - name: Run + - name: Run Build + run: npm run build + + - name: Run Test run: npm run test:browser env: diff --git a/tests/browser/test/basic_block_factory_test.js b/tests/browser/test/basic_block_factory_test.js index c56834095..7e726f314 100644 --- a/tests/browser/test/basic_block_factory_test.js +++ b/tests/browser/test/basic_block_factory_test.js @@ -10,6 +10,8 @@ const webdriverio = require('webdriverio'); const chai = require('chai'); +const path = require('path'); +const {posixPath} = require('../../../scripts/helpers'); let browser; suite('Testing Connecting Blocks', function (done) { @@ -44,7 +46,12 @@ suite('Testing Connecting Blocks', function (done) { } // Use Selenium to bring up the page const url = - 'https://blockly-demo.appspot.com/static/demos/blockfactory/index.html'; + 'file://' + + posixPath( + path.join(__dirname, '..', '..', '..', 'demos', 'blockfactory') + ) + + '/index.html'; + console.log(url); console.log('Starting webdriverio...'); browser = await webdriverio.remote(options); console.log('Loading URL: ' + url); diff --git a/tests/browser/test/basic_playground_test.js b/tests/browser/test/basic_playground_test.js index fa634940b..f70ada8a8 100644 --- a/tests/browser/test/basic_playground_test.js +++ b/tests/browser/test/basic_playground_test.js @@ -10,6 +10,8 @@ const webdriverio = require('webdriverio'); const chai = require('chai'); +const path = require('path'); +const {posixPath} = require('../../../scripts/helpers'); let browser; suite('Testing Connecting Blocks', function (done) { @@ -43,7 +45,11 @@ suite('Testing Connecting Blocks', function (done) { options.capabilities['goog:chromeOptions'].args.push('--disable-gpu'); } // Use Selenium to bring up the page - const url = 'https://blockly-demo.appspot.com/static/tests/playground.html'; + const 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);