Skip to content

Commit

Permalink
Improve codeception variable usage to simplify usage
Browse files Browse the repository at this point in the history
  • Loading branch information
simonr44 authored and mattlorimer committed May 26, 2023
1 parent 707499b commit 2bf796e
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 20 deletions.
11 changes: 8 additions & 3 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# For more information, see the Automated Testing Documentation.
# https://docs.suitecrm.com/developer/automatedtesting/


#== Install Test Suite:

# MYSQL or MSSQL
Expand All @@ -29,7 +28,6 @@ DATABASE_USER=automated_tests
# Database password
DATABASE_PASSWORD=automated_tests


#== Acceptance, API, and Install Test Suites:

# URL of the SuiteCRM instance which the tester needs to access
Expand All @@ -41,7 +39,6 @@ INSTANCE_ADMIN_USER=admin
# Admin password for SuiteCRM instance
INSTANCE_ADMIN_PASSWORD=password


#== API Test Suite:

# API Client ID
Expand All @@ -50,3 +47,11 @@ INSTANCE_CLIENT_ID=suitecrm_client
# API Client Secret
INSTANCE_CLIENT_SECRET=secret

# Default web browser for acceptance and install tests
BROWSER=chrome

# Webdriver hostname (Selenium, Local or Cloud Testing)
WEBDRIVER_HOST=127.0.0.1

# Webdriver port (Selenium, Local or Cloud Testing)
WEBDRIVER_PORT=4444
1 change: 1 addition & 0 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ coverage:
- modules/AOR_Charts/lib/*
params:
- env
- .env.test
9 changes: 0 additions & 9 deletions tests/SuiteCRM/Test/Driver/WebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@
*/
class WebDriver extends \Codeception\Module\WebDriver
{
public function _initialize()
{
$config = $this->_getConfig();
$this->config['host'] = $config['host'];
$this->config['port'] = $config['port'];

parent::_initialize();
}

protected function initialWindowSize()
{
$config = $this->_getConfig();
Expand Down
22 changes: 20 additions & 2 deletions tests/acceptance.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,23 @@ modules:
- \SuiteCRM\Test\Driver\WebDriver
config:
\SuiteCRM\Test\Driver\WebDriver:
url: "https://demo.suiteondemand.com"
browser: chrome
url: '%INSTANCE_URL%'
browser: '%BROWSER%'
host: '%WEBDRIVER_HOST%'
port: '%WEBDRIVER_PORT%'
env:
chrome:
modules:
config:
\SuiteCRM\Test\Driver\WebDriver:
browser: chrome
firefox:
modules:
config:
\SuiteCRM\Test\Driver\WebDriver:
browser: firefox
edge:
modules:
config:
\SuiteCRM\Test\Driver\WebDriver:
browser: MicrosoftEdge
1 change: 1 addition & 0 deletions tests/acceptance/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Here you can initialize variables that will be available to your tests

/* bootstrap composer's autoloader */
chdir(__DIR__.'/../../');
require_once __DIR__ . '/../../vendor/autoload.php';
global $sugar_config, $db;

Expand Down
1 change: 1 addition & 0 deletions tests/api/_bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
/* bootstrap composer's autoloader */
chdir(__DIR__.'/../../');
require_once __DIR__.'/../../vendor/autoload.php';
global $sugar_config, $db;
require_once __DIR__ .'/../../include/utils.php';
Expand Down
26 changes: 21 additions & 5 deletions tests/install.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,24 @@ modules:
- \SuiteCRM\Test\Driver\WebDriver
- Filesystem
config:
\SuiteCRM\Test\Driver\WebDriver:
url: "https://demo.suiteondemand.com/"
browser: chrome
restart: true
wait: 1
\SuiteCRM\Test\Driver\WebDriver:
url: '%INSTANCE_URL%'
browser: '%BROWSER%'
restart: true
wait: 1
env:
chrome:
modules:
config:
\SuiteCRM\Test\Driver\WebDriver:
browser: chrome
firefox:
modules:
config:
\SuiteCRM\Test\Driver\WebDriver:
browser: firefox
edge:
modules:
config:
\SuiteCRM\Test\Driver\WebDriver:
browser: MicrosoftEdge
4 changes: 4 additions & 0 deletions tests/unit.suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bootstrap: _bootstrap.php
modules:
enabled:
- Asserts
2 changes: 1 addition & 1 deletion tests/unit/_bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
// Here you can initialize variables that will be available to your test
//echo "CWD:" . getcwd() . "\n";
chdir('../');
chdir(__DIR__.'/../../');
if (!defined('sugarEntry')) {
define('sugarEntry', true);
define('SUITE_PHPUNIT_RUNNER', true);
Expand Down

0 comments on commit 2bf796e

Please sign in to comment.