Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environments for different resolutions #158

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -37,4 +37,4 @@ before_script:

script:
- mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml
- vendor/bin/robo run:tests true
- vendor/bin/robo run:tests --use-htaccess
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -30,6 +30,20 @@ $ vendor/bin/robo
$ vendor/bin/robo run:tests
```

## Additional options

You can run the tests against different resolutions. The default acceptance YAML configuration file provides three options:

* "desktop": default, 1024x768px
* "tablet": tablet in portrait mode, 768x1024px
* "phone": phone in portrait mode, 480x640px

To set a specific resolution, set is as an option of the command:

`$ vendor/bin/robo run:tests --env=tablet`

Note: the first parameter is used by Travis and you should always set it to "0" when you run your tests locally.

##For Windows:

You need to install:
Expand Down
13 changes: 9 additions & 4 deletions RoboFile.php
Expand Up @@ -66,13 +66,14 @@ private function getExecutableExtension()
/**
* Executes all the Selenium System Tests in a suite on your machine
*
* @param bool $use_htaccess Renames and enable embedded Joomla .htaccess file
*
* @param array $opts Array of configuration options:
* - 'use-htaccess': renames and enable embedded Joomla .htaccess file
* - 'env': set a specific environment to get configuration from
* @return mixed
*/
public function runTests($use_htaccess = false)
public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
{
$this->createTestingSite($use_htaccess);
$this->createTestingSite($opts['use-htaccess']);

$this->getComposer();

Expand All @@ -87,6 +88,7 @@ public function runTests($use_htaccess = false)
->arg('--steps')
->arg('--debug')
->arg('--fail-fast')
->arg('--env ' . $opts['env'])
->arg('tests/acceptance/install/')
->run()
->stopOnFail();
Expand All @@ -95,6 +97,7 @@ public function runTests($use_htaccess = false)
->arg('--steps')
->arg('--debug')
->arg('--fail-fast')
->arg('--env ' . $opts['env'])
->arg('tests/acceptance/administrator/')
->run()
->stopOnFail();
Expand All @@ -103,9 +106,11 @@ public function runTests($use_htaccess = false)
->arg('--steps')
->arg('--debug')
->arg('--fail-fast')
->arg('--env ' . $opts['env'])
->arg('tests/acceptance/frontend/')
->run()
->stopOnFail();

/*
// Uncomment this lines if you need to debug selenium errors
$seleniumErrors = file_get_contents('selenium.log');
Expand Down
14 changes: 13 additions & 1 deletion tests/acceptance.suite.dist.yml
Expand Up @@ -38,4 +38,16 @@ modules:
AcceptanceHelper:
repo_folder: '/home/travis/build/joomla-extensions/weblinks/' # Path to the Extension repository. To be used by tests to install via Install from folder
counter_test_url: 'http://localhost/tests/joomla-cms3' # the url for the weblink item used to test hits counter
error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED"
error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED"
env:
desktop: ~
tablet:
modules:
config:
JoomlaBrowser:
window_size: 768x1024
phone:
modules:
config:
JoomlaBrowser:
window_size: 480x640