From 3b2d763540fbf8a3cde3b28e7905b46cf363e4cf Mon Sep 17 00:00:00 2001
From: Rajab Natshah <rajabn@gmail.com>
Date: Sat, 22 Jan 2022 19:53:51 +0200
Subject: [PATCH] Issue #3259665 by Alaa Jwiehan, Rajab Natshah: Add more step
 definitions for Varbase Layout Builder automated testing for section styling
 with padding , margin, border style, border width, border color, border
 radius, background image settings, background video settings

---
 tests/features/bootstrap/VarbaseContext.php | 152 +++++++++-----------
 1 file changed, 64 insertions(+), 88 deletions(-)

diff --git a/tests/features/bootstrap/VarbaseContext.php b/tests/features/bootstrap/VarbaseContext.php
index 60b4bff9..8ae679a7 100644
--- a/tests/features/bootstrap/VarbaseContext.php
+++ b/tests/features/bootstrap/VarbaseContext.php
@@ -855,7 +855,6 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
     $horizontal_alignment->click();
   }
 
-
   /**
    * Set vertical alignment for blocks
    *
@@ -879,10 +878,9 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Example #1: When I set the padding to "5"
    * Example #2: And I set the padding to "2"
    * 
-    * @Then I set the padding to :arg1
+    * @When I set the padding to :arg1
     */
-    public function iSetThePaddingTo($padding)
-    {
+    public function iSetThePaddingTo($padding) {
       $this->getSession()->executeScript('jQuery(".bs-field-padding.form-range").val("' . $padding . '")');
     }
 
@@ -894,10 +892,9 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Example #1: When I set the left padding to "5"
    * Example #2: And I set the left padding to "2"
    * 
-    * @Then I set the left padding to :arg1
+    * @When I set the left padding to :arg1
     */
-    public function iSetTheLeftPaddingTo($left_padding)
-    {
+    public function iSetTheLeftPaddingTo($left_padding) {
       $padding_left = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Padding left')]");
       $padding_left->click();
       $this->getSession()->executeScript('jQuery(".bs-field-padding-left.form-range").val("' . $left_padding . '")');
@@ -911,10 +908,9 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Example #1: When I set the right padding to "5"
    * Example #2: And I set the right padding to "1"
    * 
-    * @Then I set the right padding to :arg1
+    * @When I set the right padding to :arg1
     */
-    public function iSetTheRightPaddingTo($right_padding)
-    {
+    public function iSetTheRightPaddingTo($right_padding) {
       $padding_right = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Padding right')]");
       $padding_right->click();
       $this->getSession()->executeScript('jQuery(".bs-field-padding-right.form-range").val("' . $right_padding . '")');
@@ -928,10 +924,9 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Example #1: When I set the top padding to "5"
    * Example #2: And I set the top padding to "2"
    * 
-    * @Then I set the top padding to :arg1
+    * @When I set the top padding to :arg1
     */
-    public function iSetTheTopPaddingTo($top_padding)
-    {
+    public function iSetTheTopPaddingTo($top_padding) {
       $padding_top = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Padding top')]");
       $padding_top->click();
       $this->getSession()->executeScript('jQuery(".bs-field-padding-top.form-range").val("' . $top_padding . '")');
@@ -945,10 +940,9 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Example #1: When I set the bottom padding to "5"
    * Example #2: And I set the bottom padding to "4"
    * 
-   * @Then I set the bottom padding to :arg1
+   * @When I set the bottom padding to :arg1
    */
-    public function iSetTheBottomPaddingTo($bottom_padding)
-    {
+    public function iSetTheBottomPaddingTo($bottom_padding) {
       $padding_bottom = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Padding bottom')]");
       $padding_bottom->click();
       $this->getSession()->executeScript('jQuery(".bs-field-padding-bottom.form-range").val("' . $bottom_padding . '")');
@@ -959,13 +953,12 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * 
    * Varbase Context #varbase
    * 
-   * Example #1: Then I set the margin to "5"
+   * Example #1: When I set the margin to "5"
    * Example #2: And I set the margin to "2"
    * 
-   * @Then I set the margin to :arg1
+   * @When I set the margin to :arg1
    */
-    public function iSetTheMarginTo($margin)
-    {
+    public function iSetTheMarginTo($margin) {
       $this->getSession()->executeScript('jQuery(".bs-field-margin.form-range").val("' . $margin . '")');
     }
 
@@ -975,15 +968,14 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Varbase Context #varbase
    * 
    * Example #1: And I set the left margin to "2"
-   * Example #2: Then I set the left margin to "4"
+   * Example #2: When I set the left margin to "4"
    * 
-   * @Then I set the left margin to :arg1
+   * @When I set the left margin to :arg1
    */
-    public function iSetTheLeftMarginTo($left_margin)
-    {
-        $margin_left = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Margin left')]");
-        $margin_left->click();
-        $this->getSession()->executeScript('jQuery(".bs-field-margin-left.form-range").val("' . $left_margin . '")');
+    public function iSetTheLeftMarginTo($left_margin) {
+      $margin_left = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Margin left')]");
+      $margin_left->click();
+      $this->getSession()->executeScript('jQuery(".bs-field-margin-left.form-range").val("' . $left_margin . '")');
     }
 
   /**
@@ -992,15 +984,15 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Varbase Context #varbase
    * 
    * Example #1: And I set the top margin to "2"
-   * Example #2: Then I set the top margin to "4"
+   * Example #2: When I set the top margin to "4"
    * 
-   * @Then I set the top margin to :arg1
+   * @When I set the top margin to :arg1
    */
     public function iSetTheTopMarginTo($top_margin)
     {
-        $margin_top = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Margin top')]");
-        $margin_top->click();
-        $this->getSession()->executeScript('jQuery(".bs-field-margin-top.form-range").val("' . $top_margin . '")');
+      $margin_top = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Margin top')]");
+      $margin_top->click();
+      $this->getSession()->executeScript('jQuery(".bs-field-margin-top.form-range").val("' . $top_margin . '")');
     }
 
   /**
@@ -1009,15 +1001,15 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Varbase Context #varbase
    * 
    * Example #1: And I set the right margin to "2"
-   * Example #2: Then I set the right margin to "4"
+   * Example #2: When I set the right margin to "4"
    * 
-   * @Then I set the right margin to :arg1
+   * @When I set the right margin to :arg1
    */
     public function iSetTheRightMarginTo($right_margin)
     {
-        $margin_right = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Margin right')]");
-        $margin_right->click();
-        $this->getSession()->executeScript('jQuery(".bs-field-margin-right.form-range").val("' . $right_margin . '")');
+      $margin_right = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Margin right')]");
+      $margin_right->click();
+      $this->getSession()->executeScript('jQuery(".bs-field-margin-right.form-range").val("' . $right_margin . '")');
     }
 
   /**
@@ -1026,15 +1018,14 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Varbase Context #varbase
    * 
    * Example #1: And I set the bottom margin to "2"
-   * Example #2: Then I set the bottom margin to "4"
+   * Example #2: When I set the bottom margin to "4"
    * 
-   * @Then I set the bottom margin to :arg1
+   * @When I set the bottom margin to :arg1
    */
-    public function iSetTheBottomMarginTo($bottom_margin)
-    {
-        $margin_bottom = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Margin bottom')]");
-        $margin_bottom->click();
-        $this->getSession()->executeScript('jQuery(".bs-field-margin-bottom.form-range").val("' . $bottom_margin . '")');
+    public function iSetTheBottomMarginTo($bottom_margin) {
+      $margin_bottom = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Margin bottom')]");
+      $margin_bottom->click();
+      $this->getSession()->executeScript('jQuery(".bs-field-margin-bottom.form-range").val("' . $bottom_margin . '")');
     }
 
   /**
@@ -1043,12 +1034,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Varbase Context #varbase
    * 
    * Example #1: And I select the "Solid" border style
-   * Example #2: Then I select the "Dotted" border style
+   * Example #2: When I select the "Dotted" border style
    * 
    * @When I select the :arg1 border style
    */
-  public function iSelectTheBorderStyle($b_style)
-  {
+  public function iSelectTheBorderStyle($b_style) {
     $border_style = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$b_style') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-style-bs-border-style')]");
     $border_style->click();
   }
@@ -1058,13 +1048,12 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * 
    * Varbase Context #varbase
    * 
-   * Example #1: Then I set the border width to "3"
+   * Example #1: When I set the border width to "3"
    * Example #2: And I set the border width to "2"
    *  
    * @When I set the border width to :arg1
    */
-  public function iSetTheBorderWidthTo($b_width)
-  {
+  public function iSetTheBorderWidthTo($b_width) {
     $border_width = $this->getSession()->getPage()->find('xpath', "//label[contains(., 'Border width')]");
     $this->getSession()->executeScript('jQuery(".bs-field-border-width.form-range").val("' . $b_width . '")');
   }
@@ -1075,12 +1064,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Varbase Context #varbase
    * 
    * Example #1: And I select the "Dark" border color
-   * Example #2: Then I select the "Primary" border color
+   * Example #2: When I select the "Primary" border color
    * 
    * @When I select the :arg1 border color
    */
-  public function iSelectTheBorderColor($b_color)
-  {
+  public function iSelectTheBorderColor($b_color) {
     $border_color = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$b_color') and contains (@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-color-border')]");
     $border_color->click();
   }
@@ -1090,13 +1078,12 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * 
    * Varbase Context #varbase
    * 
-   * Example #1: Then I set the border radius to "2"
+   * Example #1: When I set the border radius to "2"
    * Example #2: And I set the border radius to "3"
    * 
-   * @Then I set the border radius to :arg1
+   * @When I set the border radius to :arg1
    */
-  public function iSetTheBorderRadiusTo($b_radius)
-  {
+  public function iSetTheBorderRadiusTo($b_radius) {
     $border_radius = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Corners')]");
     $this->getSession()->executeScript('jQuery(".bs-field-rounded-corners.form-range").val("' . $b_radius . '")');
   }
@@ -1106,13 +1093,12 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * 
    * Varbase Context #varbase
    * 
-   * Example #1: Then I set the top left border radius to "1"
+   * Example #1: When I set the top left border radius to "1"
    * Example #2: And I set the top left border radius to "2"
    * 
-   * @Then I set the top left border radius to :arg1
+   * @When I set the top left border radius to :arg1
    */
-  public function iSetTheTopLeftBorderRadiusTo($b_radius_top_left)
-  {
+  public function iSetTheTopLeftBorderRadiusTo($b_radius_top_left) {
     $border_radius_top_left = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Top Left')]");
     $this->getSession()->executeScript('jQuery(".bs-field-rounded-corner-top_left.form-range").val("' . $b_radius_top_left . '")');
   }
@@ -1123,12 +1109,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Varbase Context #varbase
    * 
    * Example #1: And I set the top right border radius to "3"
-   * Example #2: Then I set the top right border radius to "1"
+   * Example #2: When I set the top right border radius to "1"
    * 
-   * @Then I set the top right border radius to :arg1
+   * @When I set the top right border radius to :arg1
    */
-  public function iSetTheTopRightBorderRadiusTo($b_radius_top_right)
-  { 
+  public function iSetTheTopRightBorderRadiusTo($b_radius_top_right) { 
     $border_radius_top_right = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Top Right')]");
     $this->getSession()->executeScript('jQuery(".bs-field-rounded-corner-top_right.form-range").val("' . $b_radius_top_right . '")');
   }
@@ -1139,12 +1124,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Varbase Context #varbase
    * 
    * Example #1: And I set the bottom left border radius to "3"
-   * Example #2: Then I set the bottom left border radius to "1"
+   * Example #2: When I set the bottom left border radius to "1"
    * 
-   * @Then I set the bottom left border radius to :arg1
+   * @When I set the bottom left border radius to :arg1
    */
-  public function iSetTheBottomLeftBorderRadiusTo($b_radius_bottom_left)
-  { 
+  public function iSetTheBottomLeftBorderRadiusTo($b_radius_bottom_left) { 
     $border_radius_bottom_left = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Bottom Left')]");
     $this->getSession()->executeScript('jQuery(".bs-field-rounded-corner-bottom_left.form-range").val("' . $b_radius_bottom_left . '")');
   }
@@ -1155,12 +1139,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Varbase Context #varbase
    * 
    * Example #1: And I set the bottom right border radius to "3"
-   * Example #2: Then I set the bottom right border radius to "1"
+   * Example #2: When I set the bottom right border radius to "1"
    * 
-   * @Then I set the bottom right border radius to :arg1
+   * @When I set the bottom right border radius to :arg1
    */
-  public function iSetTheBottomRightBorderRadiusTo($b_radius_bottom_right)
-  { 
+  public function iSetTheBottomRightBorderRadiusTo($b_radius_bottom_right) { 
     $border_radius_bottom_right = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Bottom Right')]");
     $this->getSession()->executeScript('jQuery(".bs-field-rounded-corner-bottom_right.form-range").val("' . $b_radius_bottom_right . '")');
   }
@@ -1173,10 +1156,9 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Example #1: When I select the "Dotted" left border style
    * Example #2: And I select the "Dashed" left border style
    * 
-   * @Then I select the :arg1 left border style
+   * @When I select the :arg1 left border style
    */
-  public function iSelectTheLeftBorderStyle($b_left_style)
-  {
+  public function iSelectTheLeftBorderStyle($b_left_style) {
     $left_border_side = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-type-border-left')]");
     $left_border_side->click();
     $left_border_style = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$b_left_style') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-left-style-bs-border-style')]");
@@ -1191,10 +1173,9 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * Example #1: When I set the left border width to "1"
    * Example #2: And I set the left border width to "2"
    * 
-   * @Then I set the left border width to :arg1
+   * @When I set the left border width to :arg1
    */
-  public function iSetTheLeftBorderWidthTo($b_left_width)
-  {
+  public function iSetTheLeftBorderWidthTo($b_left_width) {
     $left_border_side = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-type-border-left')]");
     $left_border_side->click();
     $border_width = $this->getSession()->getPage()->find('xpath', "//label[contains(., 'Border left width')]");
@@ -1208,10 +1189,9 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * 
    * Example #1: And I switch to background image settings
    * 
-   * @Then I switch to background image settings
+   * @When I switch to background image settings
    */
-  public function iSwitchToBackgroundImageSettings()
-  {
+  public function iSwitchToBackgroundImageSettings() {
     // $menu = $this->getSession()->getPage()->find('xpath', "//span[contains(., 'Background') and contains(@class, 'bs-group-title')]");
     // $menu->click();
     $bg_image = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-type-image')]");
@@ -1225,16 +1205,13 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
    * 
    * Exmaple #1: And I switch to background video settings
    * 
-   * @Then I switch to background video settings
+   * @When I switch to background video settings
    */
-  public function iSwitchToBackgroundVideoSettings()
-  {
+  public function iSwitchToBackgroundVideoSettings() {
     $bg_video = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-type-video')]"); 
     $bg_video->click();
   }
 
-
-
   /**
    * Select an animation for a section
    *
@@ -1250,7 +1227,6 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
     $animation->click();
   }    
 
-
   /**
    * Images Functions.
    *
-- 
GitLab