Skip to content

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisCarden committed Mar 31, 2020
2 parents f04ebee + 09362e5 commit 9034fb1
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ version: ~> 1.0

php: "7.2"

node_js: "lts/*"

addons:
chrome: stable

Expand Down
14 changes: 14 additions & 0 deletions bin/travis/_includes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,23 @@ ORCA_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
export ORCA_ROOT
export ORCA_FIXTURE_DIR=${ORCA_FIXTURE_DIR:="$ORCA_ROOT/../orca-build"}
export ORCA_SUT_DIR=${ORCA_SUT_DIR:=${TRAVIS_BUILD_DIR}}
export ORCA_SUT_MACHINE_NAME=${ORCA_SUT_NAME##*\/}
export ORCA_FIXTURE_PROFILE=${ORCA_FIXTURE_PROFILE:="orca"}
export ORCA_TELEMETRY_ENABLE=${ORCA_TELEMETRY_ENABLE:="FALSE"}
export ORCA_AMPLITUDE_USER_ID=${ORCA_AMPLITUDE_USER_ID:="$ORCA_SUT_NAME:$ORCA_SUT_BRANCH"}
export ORCA_YARN_DIR="${ORCA_FIXTURE_DIR}/docroot/core"
export DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES="node_modules,vendor,.*,sites/*/files,sites/*/private,sites/simpletest"
export DRUPAL_NIGHTWATCH_OUTPUT="sites/default/reports/nightwatch"
export DRUPAL_NIGHTWATCH_SEARCH_DIRECTORY="../"
export DRUPAL_TEST_BASE_URL="http://localhost:8080"
export DRUPAL_TEST_CHROMEDRIVER_AUTOSTART="false"
export DRUPAL_TEST_DB_URL="sqlite://localhost/sites/default/files/db.sqlite"
export DRUPAL_TEST_WEBDRIVER_CHROME_ARGS="--disable-gpu --headless --no-sandbox"
export DRUPAL_TEST_WEBDRIVER_HOSTNAME="localhost"
export DRUPAL_TEST_WEBDRIVER_PORT="4444"
# This "bult-in" variable isn't available to scripts and must be set manually.
TRAVIS_NODE_VERSION="$(node -v 2> /dev/null)"
export TRAVIS_NODE_VERSION

# Override the available columns setting to prevent Drush output from wrapping
# too narrowly.
Expand Down
6 changes: 6 additions & 0 deletions bin/travis/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ cd "$(dirname "$0")" || exit; source _includes.sh
# Display the Google Chrome version.
google-chrome-stable --version

# Display the Node version.
echo "$TRAVIS_NODE_VERSION"

# Display the Yarn version.
yarn --version

# Disable Xdebug.
phpenv config-rm xdebug.ini

Expand Down
14 changes: 12 additions & 2 deletions bin/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ cd "$(dirname "$0")" || exit; source _includes.sh

assert_env_vars

RUN_NIGHTWATCH=TRUE
case "$ORCA_JOB" in
"DEPRECATED_CODE_SCAN") orca debug:packages; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --no-site-install" ;;
"DEPRECATED_CODE_SCAN_CONTRIB") orca debug:packages; eval "orca fixture:init -f --no-site-install" ;;
"STATIC_CODE_ANALYSIS") unset RUN_NIGHTWATCH ;;
"DEPRECATED_CODE_SCAN") orca debug:packages; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --no-site-install"; unset RUN_NIGHTWATCH ;;
"DEPRECATED_CODE_SCAN_CONTRIB") orca debug:packages; eval "orca fixture:init -f --no-site-install"; unset RUN_NIGHTWATCH ;;
"ISOLATED_RECOMMENDED") orca debug:packages CURRENT_RECOMMENDED; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --core=CURRENT_RECOMMENDED --profile=$ORCA_FIXTURE_PROFILE" ;;
"INTEGRATED_RECOMMENDED") orca debug:packages CURRENT_RECOMMENDED; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=CURRENT_RECOMMENDED --profile=$ORCA_FIXTURE_PROFILE" ;;
"CORE_PREVIOUS") orca debug:packages PREVIOUS_RELEASE; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --core=PREVIOUS_RELEASE --profile=$ORCA_FIXTURE_PROFILE" ;;
Expand All @@ -25,3 +27,11 @@ case "$ORCA_JOB" in
"D9_READINESS") orca debug:packages D9_READINESS; eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --sut-only --core='~9' --dev --profile=$ORCA_FIXTURE_PROFILE" ;;
"CUSTOM") eval "orca fixture:init -f --sut=$ORCA_SUT_NAME --profile=$ORCA_FIXTURE_PROFILE ${ORCA_CUSTOM_FIXTURE_INIT_ARGS:=}" ;;
esac

# Install yarn on relevant jobs if Node is installed and a fixture exists.
if [[ "$RUN_NIGHTWATCH" && "$TRAVIS_NODE_VERSION" && -d "$ORCA_YARN_DIR" ]]; then
(
cd "$ORCA_YARN_DIR" || exit
eval "yarn install"
)
fi
24 changes: 21 additions & 3 deletions bin/travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ assert_env_vars
# Thus if the SUT changes it, only its own tests are run.
[[ "$ORCA_FIXTURE_PROFILE" = "orca" ]] || SUT_ONLY="--sut-only"

RUN_NIGHTWATCH=TRUE
case "$ORCA_JOB" in
"STATIC_CODE_ANALYSIS") eval "orca qa:static-analysis $ORCA_SUT_DIR" ;;
"DEPRECATED_CODE_SCAN") eval "orca qa:deprecated-code-scan --sut=$ORCA_SUT_NAME" ;;
"DEPRECATED_CODE_SCAN_CONTRIB") eval "orca qa:deprecated-code-scan --contrib" ;;
"STATIC_CODE_ANALYSIS") eval "orca qa:static-analysis $ORCA_SUT_DIR"; unset RUN_NIGHTWATCH ;;
"DEPRECATED_CODE_SCAN") eval "orca qa:deprecated-code-scan --sut=$ORCA_SUT_NAME"; unset RUN_NIGHTWATCH ;;
"DEPRECATED_CODE_SCAN_CONTRIB") eval "orca qa:deprecated-code-scan --contrib"; unset RUN_NIGHTWATCH ;;
"ISOLATED_RECOMMENDED") eval "orca qa:automated-tests --sut=$ORCA_SUT_NAME --sut-only" ;;
"INTEGRATED_RECOMMENDED")
eval "orca qa:automated-tests --sut=$ORCA_SUT_NAME $SUT_ONLY --phpunit"
Expand All @@ -45,3 +46,20 @@ case "$ORCA_JOB" in
"D9_READINESS") eval "orca qa:automated-tests --sut=$ORCA_SUT_NAME --sut-only" ;;
"CUSTOM") eval "orca qa:automated-tests --sut=$ORCA_SUT_NAME ${ORCA_CUSTOM_TESTS_RUN_ARGS:=}" ;;
esac

# Run Nightwatch tests on relevant jobs if Node is installed and a fixture
# exists.
if [[ "$RUN_NIGHTWATCH" && "$TRAVIS_NODE_VERSION" && -d "$ORCA_YARN_DIR" ]]; then
(
cd "$ORCA_YARN_DIR" || exit
orca fixture:run-server &
PID=$!

eval "yarn test:nightwatch \\
--headless \\
--passWithNoTests \\
--tag=$ORCA_SUT_MACHINE_NAME"

kill -0 $PID
)
fi
2 changes: 1 addition & 1 deletion config/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.4.1
v1.5.0
6 changes: 5 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ Of course environment variables are ephemeral, so if you want them to persist ac

### PHPUnit

ORCA has out-of-the-box support for [PHPUnit in Drupal](https://www.drupal.org/docs/8/phpunit) using core's configuration. Existing tests that work in Drupal should work in ORCA with no modification. [See a working example.](../example/tests/src/Unit/ExampleUnitTest.php)
ORCA has out-of-the-box support for [PHPUnit in Drupal](https://www.drupal.org/docs/8/phpunit) using core's configuration. Existing tests that work in Drupal should work in ORCA without modification. [See a working example.](../example/tests/src/Unit/ExampleUnitTest.php)
### Nightwatch.js
ORCA has out-of-the-box support for [Nightwatch in Drupal](https://www.drupal.org/docs/8/testing/javascript-testing-using-nightwatch) using core's configuration. Existing tests that work in Drupal should work in ORCA without modification. [See a working example.](../example/tests/Drupal/Nightwatch/Tests/exampleTest.js)

#### Behat

Expand Down
3 changes: 3 additions & 0 deletions example/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ version: ~> 1.0
# @see https://docs.acquia.com/acquia-cloud/arch/tech-platform/
php: "7.2"

# Uncomment the following line to run Nightwatch tests in your package.
# node_js: "lts/*"

addons:
# Chrome is used via ChromeDriver by PHPUnit and Behat.
chrome: stable
Expand Down
16 changes: 16 additions & 0 deletions example/tests/Drupal/Nightwatch/Tests/exampleTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
'@tags': ['example'],
before(browser) {
browser.drupalInstall();
},
after(browser) {
browser.drupalUninstall();
},
'Test page': browser => {
browser
.drupalRelativeURL('/')
.waitForElementVisible('body', 1000)
.assert.containsText('body', 'Log in')
.drupalLogAndEnd({ onlyOnError: false });
},
};
11 changes: 11 additions & 0 deletions src/Command/Debug/DebugEnvVarsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,19 @@ class DebugEnvVarsCommand extends Command {
'ORCA_ROOT',
'ORCA_SUT_BRANCH',
'ORCA_SUT_DIR',
'ORCA_SUT_MACHINE_NAME',
'ORCA_SUT_NAME',
'ORCA_TELEMETRY_ENABLE',
'ORCA_YARN_DIR',
'DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES',
'DRUPAL_NIGHTWATCH_OUTPUT',
'DRUPAL_NIGHTWATCH_SEARCH_DIRECTORY',
'DRUPAL_TEST_BASE_URL',
'DRUPAL_TEST_CHROMEDRIVER_AUTOSTART',
'DRUPAL_TEST_DB_URL',
'DRUPAL_TEST_WEBDRIVER_CHROME_ARGS',
'DRUPAL_TEST_WEBDRIVER_HOSTNAME',
'DRUPAL_TEST_WEBDRIVER_PORT',
];

/**
Expand Down
8 changes: 7 additions & 1 deletion src/Server/ChromeDriverServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ public function __construct(Fixture $fixture, ProcessRunner $process_runner, str
* @SuppressWarnings(PHPMD.StaticAccess)
*/
protected function createProcess(): Process {
$command = "{$this->projectDir}/vendor/bin/chromedriver --port=4444 &";
$command = "{$this->projectDir}/vendor/bin/chromedriver \\
--disable-dev-shm-usage \\
--disable-extensions \\
--disable-gpu \\
--headless \\
--no-sandbox \\
--port=4444 &";
return Process::fromShellCommandline($command);
}

Expand Down

0 comments on commit 9034fb1

Please sign in to comment.