Skip to content

Commit

Permalink
Merge pull request #367 from pantheon-systems/auto_site_install_qa_re…
Browse files Browse the repository at this point in the history
…port

Added automatic site activation to QA test
  • Loading branch information
TeslaDethray committed Aug 10, 2015
2 parents b94f8eb + 5c7cf49 commit 290c39d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
53 changes: 32 additions & 21 deletions tests/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,26 @@ public function __construct(array $parameters) {
);
}

/**
* Ensures the user has access to the given payment instrument
* @Given /^a payment insturment with uuid "([^"]*)"$/
*
* @param [string] $instrument_uuid UUID of a payment instrument
* @return [void]
*/
public function aPaymentInsturmentWithUuid($instrument_uuid) {
$instruments = $this->iRun('terminus site instrument');
try {
$uuid = new PyStringNode(
$this->_replacePlaceholders($instrument_uuid)
);
$this->iShouldGet($uuid);
} catch(Exception $e) {
throw new Exception(
"Your user does not have access to instrument $instrument_uuid."
);
}
/**
* Ensures the user has access to the given payment instrument
* @Given /^a payment instrument with uuid "([^"]*)"$/
*
* @param [string] $instrument_uuid UUID of a payment instrument
* @return [void]
*/
public function aPaymentInstrumentWithUuid($instrument_uuid) {
$instruments = $this->iRun('terminus site instrument');
try {
$uuid = new PyStringNode(
$this->_replacePlaceholders($instrument_uuid)
);
$this->iShouldGet($uuid);
} catch(Exception $e) {
throw new Exception(
"Your user does not have access to instrument $instrument_uuid."
);
}
}

/**
* Ensures a site of the given name exists
Expand Down Expand Up @@ -101,6 +101,17 @@ public function connectionMode($site, $mode = false) {
$this->iRun($command);
}

/**
* Uses Drush to activate a Drupal site
* @When /^I activate the Drupal site at "([^"]*)"$/
*
* @param [string] $site Name of the site to activate
* @return [void]
*/
public function iActivateTheDrupalSite($site) {
$instruments = $this->iRun("terminus drush site-install -y --site=$site");
}

/**
* Adds given hostname to given site's given environment
* @When /^I add hostname "([^"]*)" to the "([^"]*)" environment of "([^"]*)"$/
Expand Down Expand Up @@ -515,8 +526,7 @@ public function iRun($command) {
$regex = '/(?<!\.)terminus/';
$terminus_cmd = sprintf('bin/terminus', $this->cliroot);
if($this->_cassette_name) {
$command = 'VCR_CASSETTE=' . $this->_cassette_name
. ' ' . preg_replace($regex, $terminus_cmd, $command);
$command = 'VCR_CASSETTE=' . $this->_cassette_name . ' ' . $command;
if(isset($this->_parameters['vcr_mode'])) {
$command = 'VCR_MODE=' . $this->_parameters['vcr_mode']
. ' ' . $command;
Expand All @@ -526,6 +536,7 @@ public function iRun($command) {
$command = 'TERMINUS_HOST=' . $this->_connection_info['host']
. ' ' . $command;
}
$command = preg_replace($regex, $terminus_cmd, $command);
ob_start();
passthru($command);
$this->_output = ob_get_clean();
Expand Down
4 changes: 2 additions & 2 deletions tests/features/instrument.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Feature: Payment Instruments
@vcr site-instrument-add
Given I am authenticated
And a site named "[[test_site_name]]"
And a payment insturment with uuid "[[payment_instrument_uuid]]"
And a payment instrument with uuid "[[payment_instrument_uuid]]"
When I run "terminus site instrument --site=[[test_site_name]] --instrument=[[payment_instrument_uuid]]"
Then I should get:
"""
Expand All @@ -15,7 +15,7 @@ Feature: Payment Instruments
@vcr site-instrument-remove
Given I am authenticated
And a site named "[[test_site_name]]"
And a payment insturment with uuid "[[payment_instrument_uuid]]"
And a payment instrument with uuid "[[payment_instrument_uuid]]"
When I run "terminus site instrument --site=[[test_site_name]] --instrument=none"
Then I should not get:
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/qa_features/qa.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Daily Terminus QA Report
@activate-site
Given I am authenticated
And a site named "[[test_site_name]]"
When I am prompted to "Activate the site in your browser" on "[[test_site_name]]" at "http://dev-[[test_site_name]].onebox.pantheon.io"
When I activate the Drupal site "[[test_site_name]]"
Then I "skipped" the test

Scenario: Connection mode SFTP
Expand Down

0 comments on commit 290c39d

Please sign in to comment.