From 5c7cf49c4cc0623406fdd83ec483b7cca0fc1e1c Mon Sep 17 00:00:00 2001 From: tesladethray Date: Mon, 10 Aug 2015 14:22:38 -0700 Subject: [PATCH] Added automatic site activation to QA test --- tests/features/bootstrap/FeatureContext.php | 53 +++++++++++++-------- tests/features/instrument.feature | 4 +- tests/qa_features/qa.feature | 2 +- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php index 57953feb8..2c7f672ee 100644 --- a/tests/features/bootstrap/FeatureContext.php +++ b/tests/features/bootstrap/FeatureContext.php @@ -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 @@ -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 "([^"]*)"$/ @@ -515,8 +526,7 @@ public function iRun($command) { $regex = '/(?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; @@ -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(); diff --git a/tests/features/instrument.feature b/tests/features/instrument.feature index 5c47fcf80..c9f81be96 100644 --- a/tests/features/instrument.feature +++ b/tests/features/instrument.feature @@ -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: """ @@ -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: """ diff --git a/tests/qa_features/qa.feature b/tests/qa_features/qa.feature index e1a466bac..9de36e28f 100644 --- a/tests/qa_features/qa.feature +++ b/tests/qa_features/qa.feature @@ -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