From 9ad9e1ca5a8c274a627603471bc90e62b7c3a21f Mon Sep 17 00:00:00 2001 From: tmeliotpg Date: Fri, 18 Sep 2020 10:16:43 +0200 Subject: [PATCH 1/9] Resolved module version bug --- WC_Pagantis.php | 5 ++--- includes/pg-functions.php | 15 ++++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/WC_Pagantis.php b/WC_Pagantis.php index 99de8e6..bb929ec 100644 --- a/WC_Pagantis.php +++ b/WC_Pagantis.php @@ -3,7 +3,7 @@ * Plugin Name: Pagantis * Plugin URI: http://www.pagantis.com/ * Description: Financiar con Pagantis - * Version: 8.6.10 + * Version: 8.6.11 * Author: Pagantis * * Text Domain: pagantis @@ -26,7 +26,7 @@ */ define('PG_WC_MAIN_FILE', __FILE__); define('PG_ABSPATH', trailingslashit(dirname(PG_WC_MAIN_FILE))); -define('PG_VERSION', getModuleComposerVersion(PG_ABSPATH)); +define('PG_VERSION', getModuleVersion()); define('PG_ROOT', dirname(__DIR__)); define('PG_CONFIG_TABLE_NAME', 'pagantis_config'); define('PG_LOGS_TABLE_NAME', 'pagantis_logs'); @@ -82,7 +82,6 @@ public function __construct() { require_once(plugin_dir_path(__FILE__).'/vendor/autoload.php'); require_once(PG_ABSPATH . '/includes/pg-functions.php'); - $this->template_path = plugin_dir_path(__FILE__).'/templates/'; $this->pagantisActivation(); diff --git a/includes/pg-functions.php b/includes/pg-functions.php index d147e35..22f8965 100644 --- a/includes/pg-functions.php +++ b/includes/pg-functions.php @@ -334,18 +334,11 @@ function getExtraConfig() return $response; } -function getModuleComposerVersion($moduleAbsolutePath) +function getModuleVersion() { - $maybe_composer_json = $moduleAbsolutePath . 'composer.json'; - if (! file_exists($maybe_composer_json) && ! is_readable($maybe_composer_json)) { - return null; - } - $composer = json_decode(file_get_contents($maybe_composer_json)); - if (empty($composer->version)) { - return null; - } - - return $composer->version; + $mainFile = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; + $version = get_file_data($mainFile, array('Version' => 'Version'), false); + return $version; } From c4ba478372f527ad0c659fec58c36ba370a6f814 Mon Sep 17 00:00:00 2001 From: tmeliotpg Date: Fri, 18 Sep 2020 10:23:30 +0200 Subject: [PATCH 2/9] Removed version from composer --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index bac0544..db75f02 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,6 @@ { "name": "pagantis/woocommerce", "description": "Woocommerce module to add Pagantis", - "version": "8.6.10", "license": "proprietary", "type": "wordpress-plugin", "keywords": [ From cb1ba32a85f1fc160628d405ca2009fc223ff855 Mon Sep 17 00:00:00 2001 From: tmeliotpg Date: Mon, 21 Sep 2020 08:36:21 +0200 Subject: [PATCH 3/9] Added try catch to failing test --- test/selenium/buy/AbstractBuy.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/selenium/buy/AbstractBuy.php b/test/selenium/buy/AbstractBuy.php index 34952ba..5ba9dfd 100644 --- a/test/selenium/buy/AbstractBuy.php +++ b/test/selenium/buy/AbstractBuy.php @@ -2,6 +2,8 @@ namespace Test\Selenium\Buy; +use Facebook\WebDriver\Exception\NoSuchElementException; +use Facebook\WebDriver\Exception\TimeOutException; use Facebook\WebDriver\WebDriverBy; use Facebook\WebDriver\WebDriverExpectedCondition; use Pagantis\ModuleUtils\Exception\AlreadyProcessedException; @@ -317,7 +319,17 @@ public function verifyOrderInformation() { $messageElementSearch = WebDriverBy::className('entry-title'); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($messageElementSearch); - $this->waitUntil($condition); + try { + $this->waitUntil($condition); + } catch (NoSuchElementException $e) { + $e->getMessage(); + $e->getResults(); + $e->getTraceAsString(); + } catch (TimeOutException $e) { + $e->getMessage(); + $e->getResults(); + $e->getTraceAsString(); + } $actualString = $this->webDriver->findElement($messageElementSearch)->getText(); $this->assertNotEmpty($actualString, "PR45"); $confString = ($this->woocommerceLanguage == 'EN') ? "Order received" : "Pedido recibido"; From 6c95cc7773b36814ebd833fe9f28461c78770f53 Mon Sep 17 00:00:00 2001 From: tmeliotpg Date: Mon, 21 Sep 2020 10:19:45 +0200 Subject: [PATCH 4/9] troubleshooting failing test --- test/selenium/buy/AbstractBuy.php | 7 +++++++ test/selenium/buy/BuyWc3Test.php | 2 ++ 2 files changed, 9 insertions(+) diff --git a/test/selenium/buy/AbstractBuy.php b/test/selenium/buy/AbstractBuy.php index 5ba9dfd..2ce39e1 100644 --- a/test/selenium/buy/AbstractBuy.php +++ b/test/selenium/buy/AbstractBuy.php @@ -172,6 +172,8 @@ public function prepareProductAndCheckout() /** * STEP2: Prepare checkout and check pagantis form + * + * @throws \Exception */ public function makeCheckoutAndPagantis() { @@ -271,6 +273,8 @@ private function checkSimulator() { sleep(10); $simulatorElementSearch = WebDriverBy::className('pagantisSimulator'); + echo $this->webDriver->getStatus(); + echo $this->webDriver->getTitle(); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($simulatorElementSearch); $this->waitUntil($condition); $this->assertTrue((bool) $condition, "PR19"); @@ -319,16 +323,19 @@ public function verifyOrderInformation() { $messageElementSearch = WebDriverBy::className('entry-title'); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($messageElementSearch); + echo $this->webDriver->getCurrentURL(); try { $this->waitUntil($condition); } catch (NoSuchElementException $e) { $e->getMessage(); $e->getResults(); $e->getTraceAsString(); + echo $this->webDriver->getCurrentURL(); } catch (TimeOutException $e) { $e->getMessage(); $e->getResults(); $e->getTraceAsString(); + echo $this->webDriver->getCurrentURL(); } $actualString = $this->webDriver->findElement($messageElementSearch)->getText(); $this->assertNotEmpty($actualString, "PR45"); diff --git a/test/selenium/buy/BuyWc3Test.php b/test/selenium/buy/BuyWc3Test.php index f31c883..48be8a8 100644 --- a/test/selenium/buy/BuyWc3Test.php +++ b/test/selenium/buy/BuyWc3Test.php @@ -15,6 +15,8 @@ class BuyWc3Test extends AbstractBuy { /** * Test to buy + * + * @throws \Exception */ public function testBuy() { From f12d8e28cce63c615db62fdcec1ba58fec2d17fd Mon Sep 17 00:00:00 2001 From: tmeliotpg Date: Mon, 21 Sep 2020 10:26:04 +0200 Subject: [PATCH 5/9] Adding selenium screenshots with CircleCi artifacts --- .circleci/config.yml | 3 +++ test/selenium/buy/AbstractBuy.php | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1624d18..b93c55d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,6 +63,9 @@ jobs: command: | export DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) vendor/bin/phpunit --group woocommerce3-buy + - store_artifacts: + path: tmp/screenshots + pushRelease: docker: - image: circleci/php:7.1-node-browsers diff --git a/test/selenium/buy/AbstractBuy.php b/test/selenium/buy/AbstractBuy.php index 2ce39e1..41d6f8b 100644 --- a/test/selenium/buy/AbstractBuy.php +++ b/test/selenium/buy/AbstractBuy.php @@ -201,6 +201,7 @@ public function goToProductPage() { $this->webDriver->get($this->woocommerceUrl); $this->findByLinkText(self::PRODUCT_NAME)->click(); + $this->webDriver->takeScreenshot("tmp/screenshots/goToProductPage.jpg"); $condition = WebDriverExpectedCondition::titleContains(self::PRODUCT_NAME); $this->webDriver->wait()->until($condition); $this->assertTrue((bool) $condition); @@ -246,6 +247,8 @@ public function goToCheckout() public function checkCheckoutPage() { $validatorSearch = WebDriverBy::className('payment_method_pagantis'); + $this->webDriver->takeScreenshot("tmp/screenshots/checkCheckoutPage.jpg"); + $actualString = $this->webDriver->findElement($validatorSearch)->getText(); $compareString = (strstr($actualString, $this->configuration['checkoutTitle'])) === false ? false : true; $this->assertTrue($compareString, "PR25,PR26 - $actualString"); @@ -275,6 +278,7 @@ private function checkSimulator() $simulatorElementSearch = WebDriverBy::className('pagantisSimulator'); echo $this->webDriver->getStatus(); echo $this->webDriver->getTitle(); + $this->webDriver->takeScreenshot("tmp/screenshots/checkSimulator.jpg"); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($simulatorElementSearch); $this->waitUntil($condition); $this->assertTrue((bool) $condition, "PR19"); @@ -286,6 +290,8 @@ private function checkSimulator() public function prepareCheckout() { $condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); + $this->webDriver->takeScreenshot("tmp/screenshots/prepareCheckout.jpg"); + $this->webDriver->wait()->until($condition); $this->assertTrue((bool) $condition); @@ -300,6 +306,7 @@ public function prepareCheckout() $this->findById('billing_phone')->clear()->sendKeys($this->configuration['phone']); $this->findById('billing_email')->clear()->sendKeys($this->configuration['email']); + $this->webDriver->takeScreenshot("tmp/screenshots/prepareCheckout.jpg"); } /** @@ -323,6 +330,8 @@ public function verifyOrderInformation() { $messageElementSearch = WebDriverBy::className('entry-title'); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($messageElementSearch); + $this->webDriver->takeScreenshot("tmp/screenshots/verifyOrderInformation.jpg"); + echo $this->webDriver->getCurrentURL(); try { $this->waitUntil($condition); From f0189807b75ff0fbbc435c84520213ad0676b791 Mon Sep 17 00:00:00 2001 From: tmeliotpg Date: Mon, 21 Sep 2020 10:35:47 +0200 Subject: [PATCH 6/9] encoding desired test data --- test/selenium/buy/AbstractBuy.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/selenium/buy/AbstractBuy.php b/test/selenium/buy/AbstractBuy.php index 41d6f8b..c6e390d 100644 --- a/test/selenium/buy/AbstractBuy.php +++ b/test/selenium/buy/AbstractBuy.php @@ -276,8 +276,8 @@ private function checkSimulator() { sleep(10); $simulatorElementSearch = WebDriverBy::className('pagantisSimulator'); - echo $this->webDriver->getStatus(); - echo $this->webDriver->getTitle(); + echo json_encode($this->webDriver->getStatus()); + echo json_encode($this->webDriver->getTitle()); $this->webDriver->takeScreenshot("tmp/screenshots/checkSimulator.jpg"); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($simulatorElementSearch); $this->waitUntil($condition); @@ -332,7 +332,7 @@ public function verifyOrderInformation() $condition = WebDriverExpectedCondition::visibilityOfElementLocated($messageElementSearch); $this->webDriver->takeScreenshot("tmp/screenshots/verifyOrderInformation.jpg"); - echo $this->webDriver->getCurrentURL(); + echo json_encode($this->webDriver->getCurrentURL()); try { $this->waitUntil($condition); } catch (NoSuchElementException $e) { From 84247b10680d31fc01c9c4073ad7b5a32bf6ce7a Mon Sep 17 00:00:00 2001 From: tmeliotpg Date: Mon, 21 Sep 2020 12:55:07 +0200 Subject: [PATCH 7/9] debugging version issue --- controllers/paymentController.php | 4 +++- controllers/paymentController4x.php | 4 +++- includes/pg-functions.php | 3 ++- test/selenium/buy/AbstractBuy.php | 18 ++++++++++-------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/controllers/paymentController.php b/controllers/paymentController.php index dfd945c..bc6260b 100755 --- a/controllers/paymentController.php +++ b/controllers/paymentController.php @@ -58,6 +58,8 @@ public function __construct() //Useful vars $this->template_path = plugin_dir_path(__FILE__) . '../templates/'; $this->allowed_currencies = getAllowedCurrencies(); + $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; + $this->plugin_info = get_file_data($this->mainFileLocation, array('Version' => 'Version'), false); $this->language = strstr(get_locale(), '_', true); if ($this->language=='') { $this->language = 'ES'; @@ -247,7 +249,7 @@ public function pagantisReceiptPage($order_id) $metadataOrder = new Metadata(); $metadata = array( 'pg_module' => 'woocommerce', - 'pg_version' => PG_VERSION, + 'pg_version' => $this->plugin_info, 'ec_module' => 'woocommerce', 'ec_version' => WC()->version ); diff --git a/controllers/paymentController4x.php b/controllers/paymentController4x.php index 1e50804..d8e1a10 100644 --- a/controllers/paymentController4x.php +++ b/controllers/paymentController4x.php @@ -62,6 +62,8 @@ public function __construct() //Useful vars $this->template_path = plugin_dir_path(__FILE__) . '../templates/'; $this->allowed_currencies = getAllowedCurrencies(); + $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; + $this->plugin_info = get_file_data($this->mainFileLocation, array('Version' => 'Version'), false); $this->language = strstr(get_locale(), '_', true); if ($this->language=='') { $this->language = 'ES'; @@ -215,7 +217,7 @@ public function pagantisReceiptPage($order_id) $metadataOrder = new Metadata(); $metadata = array( 'pg_module' => 'woocommerce', - 'pg_version' => PG_VERSION, + 'pg_version' => $this->plugin_info, 'ec_module' => 'woocommerce', 'ec_version' => WC()->version ); diff --git a/includes/pg-functions.php b/includes/pg-functions.php index 22f8965..4c729a9 100644 --- a/includes/pg-functions.php +++ b/includes/pg-functions.php @@ -336,7 +336,8 @@ function getExtraConfig() function getModuleVersion() { - $mainFile = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; + + $mainFile = plugin_dir_path(PG_WC_MAIN_FILE). '/WC_Pagantis.php'; $version = get_file_data($mainFile, array('Version' => 'Version'), false); return $version; } diff --git a/test/selenium/buy/AbstractBuy.php b/test/selenium/buy/AbstractBuy.php index c6e390d..7a09301 100644 --- a/test/selenium/buy/AbstractBuy.php +++ b/test/selenium/buy/AbstractBuy.php @@ -236,6 +236,8 @@ public function goToCheckout() $this->waitUntil($condition); $this->findByLinkText('Checkout')->click(); + $this->webDriver->takeScreenshot('tmp/screenshots/goToCheckout-'.__LINE__.'.jpg'); + $condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); $this->webDriver->wait()->until($condition); $this->assertTrue((bool) $condition); @@ -247,7 +249,7 @@ public function goToCheckout() public function checkCheckoutPage() { $validatorSearch = WebDriverBy::className('payment_method_pagantis'); - $this->webDriver->takeScreenshot("tmp/screenshots/checkCheckoutPage.jpg"); + $this->webDriver->takeScreenshot('tmp/screenshots/checkCheckoutPage-'.__LINE__.'.jpg'); $actualString = $this->webDriver->findElement($validatorSearch)->getText(); $compareString = (strstr($actualString, $this->configuration['checkoutTitle'])) === false ? false : true; @@ -278,7 +280,7 @@ private function checkSimulator() $simulatorElementSearch = WebDriverBy::className('pagantisSimulator'); echo json_encode($this->webDriver->getStatus()); echo json_encode($this->webDriver->getTitle()); - $this->webDriver->takeScreenshot("tmp/screenshots/checkSimulator.jpg"); + $this->webDriver->takeScreenshot('tmp/screenshots/checkSimulator-'.__LINE__.'.jpg'); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($simulatorElementSearch); $this->waitUntil($condition); $this->assertTrue((bool) $condition, "PR19"); @@ -290,7 +292,7 @@ private function checkSimulator() public function prepareCheckout() { $condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); - $this->webDriver->takeScreenshot("tmp/screenshots/prepareCheckout.jpg"); + $this->webDriver->takeScreenshot('tmp/screenshots/prepareCheckout-'.__LINE__.'.jpg'); $this->webDriver->wait()->until($condition); $this->assertTrue((bool) $condition); @@ -330,21 +332,19 @@ public function verifyOrderInformation() { $messageElementSearch = WebDriverBy::className('entry-title'); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($messageElementSearch); - $this->webDriver->takeScreenshot("tmp/screenshots/verifyOrderInformation.jpg"); - - echo json_encode($this->webDriver->getCurrentURL()); + $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); try { $this->waitUntil($condition); } catch (NoSuchElementException $e) { $e->getMessage(); $e->getResults(); $e->getTraceAsString(); - echo $this->webDriver->getCurrentURL(); + $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); } catch (TimeOutException $e) { $e->getMessage(); $e->getResults(); $e->getTraceAsString(); - echo $this->webDriver->getCurrentURL(); + $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); } $actualString = $this->webDriver->findElement($messageElementSearch)->getText(); $this->assertNotEmpty($actualString, "PR45"); @@ -357,12 +357,14 @@ public function verifyOrderInformation() $menuElement = $this->webDriver->findElement($menuSearch); $actualString = $menuElement->getText(); $compareString = (strstr($actualString, $this->getPrice())) === false ? false : true; + $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); $this->assertNotEmpty($compareString, "PR46"); $this->assertNotEmpty($this->getPrice(), "PR46"); $this->assertTrue($compareString, $actualString . $this->getPrice() ." PR46"); $validatorSearch = WebDriverBy::className('woocommerce-order-overview__payment-method'); $actualString = $this->webDriver->findElement($validatorSearch)->getText(); + $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); $compareString = (strstr($actualString, $this->configuration['methodName'])) === false ? false : true; $this->assertTrue($compareString, $actualString, "PR49"); } From e6958e7e79bb3f48535e36dba67a605407293b34 Mon Sep 17 00:00:00 2001 From: tmeliotpg Date: Mon, 21 Sep 2020 13:57:22 +0200 Subject: [PATCH 8/9] Fixed module version bug --- controllers/paymentController.php | 4 +++- controllers/paymentController4x.php | 4 +--- includes/pg-functions.php | 3 +-- test/selenium/buy/AbstractBuy.php | 28 ---------------------------- test/selenium/buy/BuyWc3Test.php | 2 -- 5 files changed, 5 insertions(+), 36 deletions(-) diff --git a/controllers/paymentController.php b/controllers/paymentController.php index bc6260b..d627d2b 100755 --- a/controllers/paymentController.php +++ b/controllers/paymentController.php @@ -50,6 +50,7 @@ class WcPagantisGateway extends WC_Payment_Gateway */ public function __construct() { + require_once(plugin_dir_path(__FILE__).'../includes/pg-functions.php'); //Mandatory vars for plugin $this->id = WcPagantisGateway::METHOD_ID; $this->has_fields = true; @@ -249,7 +250,7 @@ public function pagantisReceiptPage($order_id) $metadataOrder = new Metadata(); $metadata = array( 'pg_module' => 'woocommerce', - 'pg_version' => $this->plugin_info, + 'pg_version' => esc_html(getModuleVersion()), 'ec_module' => 'woocommerce', 'ec_version' => WC()->version ); @@ -691,4 +692,5 @@ private function unparseUrl($parsed_url) $path = $parsed_url['path']; return $scheme . $host . $port . $path . $query . $fragment; } + } diff --git a/controllers/paymentController4x.php b/controllers/paymentController4x.php index d8e1a10..859bb26 100644 --- a/controllers/paymentController4x.php +++ b/controllers/paymentController4x.php @@ -62,8 +62,6 @@ public function __construct() //Useful vars $this->template_path = plugin_dir_path(__FILE__) . '../templates/'; $this->allowed_currencies = getAllowedCurrencies(); - $this->mainFileLocation = dirname(plugin_dir_path(__FILE__)) . '/WC_Pagantis.php'; - $this->plugin_info = get_file_data($this->mainFileLocation, array('Version' => 'Version'), false); $this->language = strstr(get_locale(), '_', true); if ($this->language=='') { $this->language = 'ES'; @@ -217,7 +215,7 @@ public function pagantisReceiptPage($order_id) $metadataOrder = new Metadata(); $metadata = array( 'pg_module' => 'woocommerce', - 'pg_version' => $this->plugin_info, + 'pg_version' => getModuleVersion(), 'ec_module' => 'woocommerce', 'ec_version' => WC()->version ); diff --git a/includes/pg-functions.php b/includes/pg-functions.php index 4c729a9..f60c87e 100644 --- a/includes/pg-functions.php +++ b/includes/pg-functions.php @@ -339,10 +339,9 @@ function getModuleVersion() $mainFile = plugin_dir_path(PG_WC_MAIN_FILE). '/WC_Pagantis.php'; $version = get_file_data($mainFile, array('Version' => 'Version'), false); - return $version; + return $version['Version']; } - /** * @param $order * diff --git a/test/selenium/buy/AbstractBuy.php b/test/selenium/buy/AbstractBuy.php index 7a09301..8125cb0 100644 --- a/test/selenium/buy/AbstractBuy.php +++ b/test/selenium/buy/AbstractBuy.php @@ -2,8 +2,6 @@ namespace Test\Selenium\Buy; -use Facebook\WebDriver\Exception\NoSuchElementException; -use Facebook\WebDriver\Exception\TimeOutException; use Facebook\WebDriver\WebDriverBy; use Facebook\WebDriver\WebDriverExpectedCondition; use Pagantis\ModuleUtils\Exception\AlreadyProcessedException; @@ -201,7 +199,6 @@ public function goToProductPage() { $this->webDriver->get($this->woocommerceUrl); $this->findByLinkText(self::PRODUCT_NAME)->click(); - $this->webDriver->takeScreenshot("tmp/screenshots/goToProductPage.jpg"); $condition = WebDriverExpectedCondition::titleContains(self::PRODUCT_NAME); $this->webDriver->wait()->until($condition); $this->assertTrue((bool) $condition); @@ -236,8 +233,6 @@ public function goToCheckout() $this->waitUntil($condition); $this->findByLinkText('Checkout')->click(); - $this->webDriver->takeScreenshot('tmp/screenshots/goToCheckout-'.__LINE__.'.jpg'); - $condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); $this->webDriver->wait()->until($condition); $this->assertTrue((bool) $condition); @@ -249,8 +244,6 @@ public function goToCheckout() public function checkCheckoutPage() { $validatorSearch = WebDriverBy::className('payment_method_pagantis'); - $this->webDriver->takeScreenshot('tmp/screenshots/checkCheckoutPage-'.__LINE__.'.jpg'); - $actualString = $this->webDriver->findElement($validatorSearch)->getText(); $compareString = (strstr($actualString, $this->configuration['checkoutTitle'])) === false ? false : true; $this->assertTrue($compareString, "PR25,PR26 - $actualString"); @@ -278,9 +271,6 @@ private function checkSimulator() { sleep(10); $simulatorElementSearch = WebDriverBy::className('pagantisSimulator'); - echo json_encode($this->webDriver->getStatus()); - echo json_encode($this->webDriver->getTitle()); - $this->webDriver->takeScreenshot('tmp/screenshots/checkSimulator-'.__LINE__.'.jpg'); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($simulatorElementSearch); $this->waitUntil($condition); $this->assertTrue((bool) $condition, "PR19"); @@ -292,8 +282,6 @@ private function checkSimulator() public function prepareCheckout() { $condition = WebDriverExpectedCondition::titleContains(self::CHECKOUT_TITLE); - $this->webDriver->takeScreenshot('tmp/screenshots/prepareCheckout-'.__LINE__.'.jpg'); - $this->webDriver->wait()->until($condition); $this->assertTrue((bool) $condition); @@ -308,7 +296,6 @@ public function prepareCheckout() $this->findById('billing_phone')->clear()->sendKeys($this->configuration['phone']); $this->findById('billing_email')->clear()->sendKeys($this->configuration['email']); - $this->webDriver->takeScreenshot("tmp/screenshots/prepareCheckout.jpg"); } /** @@ -332,20 +319,7 @@ public function verifyOrderInformation() { $messageElementSearch = WebDriverBy::className('entry-title'); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($messageElementSearch); - $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); - try { $this->waitUntil($condition); - } catch (NoSuchElementException $e) { - $e->getMessage(); - $e->getResults(); - $e->getTraceAsString(); - $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); - } catch (TimeOutException $e) { - $e->getMessage(); - $e->getResults(); - $e->getTraceAsString(); - $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); - } $actualString = $this->webDriver->findElement($messageElementSearch)->getText(); $this->assertNotEmpty($actualString, "PR45"); $confString = ($this->woocommerceLanguage == 'EN') ? "Order received" : "Pedido recibido"; @@ -357,14 +331,12 @@ public function verifyOrderInformation() $menuElement = $this->webDriver->findElement($menuSearch); $actualString = $menuElement->getText(); $compareString = (strstr($actualString, $this->getPrice())) === false ? false : true; - $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); $this->assertNotEmpty($compareString, "PR46"); $this->assertNotEmpty($this->getPrice(), "PR46"); $this->assertTrue($compareString, $actualString . $this->getPrice() ." PR46"); $validatorSearch = WebDriverBy::className('woocommerce-order-overview__payment-method'); $actualString = $this->webDriver->findElement($validatorSearch)->getText(); - $this->webDriver->takeScreenshot('tmp/screenshots/verifyOrderInformation-'.__LINE__.'.jpg'); $compareString = (strstr($actualString, $this->configuration['methodName'])) === false ? false : true; $this->assertTrue($compareString, $actualString, "PR49"); } diff --git a/test/selenium/buy/BuyWc3Test.php b/test/selenium/buy/BuyWc3Test.php index 48be8a8..f31c883 100644 --- a/test/selenium/buy/BuyWc3Test.php +++ b/test/selenium/buy/BuyWc3Test.php @@ -15,8 +15,6 @@ class BuyWc3Test extends AbstractBuy { /** * Test to buy - * - * @throws \Exception */ public function testBuy() { From 14e27730cef2d5522a7e2aa3807b568aacb5c6b3 Mon Sep 17 00:00:00 2001 From: tmeliotpg Date: Mon, 21 Sep 2020 14:23:01 +0200 Subject: [PATCH 9/9] Fixed according to feedback --- .circleci/config.yml | 2 -- controllers/paymentController.php | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b93c55d..a3a5e6c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,8 +63,6 @@ jobs: command: | export DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) vendor/bin/phpunit --group woocommerce3-buy - - store_artifacts: - path: tmp/screenshots pushRelease: docker: diff --git a/controllers/paymentController.php b/controllers/paymentController.php index d627d2b..ae3c652 100755 --- a/controllers/paymentController.php +++ b/controllers/paymentController.php @@ -250,7 +250,7 @@ public function pagantisReceiptPage($order_id) $metadataOrder = new Metadata(); $metadata = array( 'pg_module' => 'woocommerce', - 'pg_version' => esc_html(getModuleVersion()), + 'pg_version' => getModuleVersion(), 'ec_module' => 'woocommerce', 'ec_version' => WC()->version );