Commit 1d81b327 authored by Alaa Jwiehan's avatar Alaa Jwiehan Committed by Rajab Natshah
Browse files

Issue #3269421: Add exception messages for VLB automated testing step definitions

parent a1f91148
Loading
Loading
Loading
Loading
+2505 −2376
Original line number Diff line number Diff line
@@ -693,16 +693,23 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
		$this->iWaitForSeconds(1);
		$end_layout = $this->getSession()->getPage()->find('xpath', "//a[contains(@class, 'use-ajax layout-builder__link layout-builder__link--add') and contains(., 'at end of layout')]")->click();
		$this->iWaitForSeconds(1);
    $section = $this->getSession()->getPage()->find('xpath', "//*[contains(., '$cols') and contains(@class, 'use-ajax')]")->click();
		$section = $this->getSession()->getPage()->find('xpath', "//*[contains(., '$cols') and contains(@class, 'use-ajax')]");
		if (is_null($section)) {
			throw new \Exception('The ' . $cols . ' option was not found or not visible');
		}
		$section->click();
		$this->iWaitForSeconds(1);
	}


	/**
	 * @When I save the section
	 */
	public function iSaveTheSection() {
    $save = $this->getSession()->getPage()->find('xpath', "//button[contains(@value, 'Add section')]")->click();
		$save = $this->getSession()->getPage()->find('xpath', "//button[contains(@value, 'Add section')]");
		if (is_null($save)) {
			throw new \Exception('The "Add section" button was not found or not visible');
		}
		$save->click();
	}

	/**
@@ -713,11 +720,15 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * Example #1: When I select the "Edge to Edge" container type
	 * Example #2:  And I select the "Boxed" container type with a "Tiny" width
	 *
   * @When I select the :arg1 container type
	 * @When I select the :type container type
	 * @When I select the :type container type with a :width width
	 */
	public function iSelectTheContainerType($type, $width = NULL) {
    $element = $this->getSession()->getPage()->find('xpath', "//label[contains(.,'$type') and contains(@for, 'edit-layout-settings-ui-tab-content-layout-container-type')]")->click();
		$element = $this->getSession()->getPage()->find('xpath', "//label[contains(.,'$type') and contains(@for, 'edit-layout-settings-ui-tab-content-layout-container-type')]");
		if (is_null($element)) {
			throw new \Exception("The $type option was not found or not visible. \nThese are the available container types:\n\tFull (Default)\n\tEdge to Edge\n\tBoxed\n");
		}
		$element->click();
		if ($type === "Boxed" && isset($width)) {
			$this->iSelectTheContainerWidth($width);
		}
@@ -731,10 +742,14 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * Example #1: When I select the "Tiny" container width
	 * Example #2:  And I select the "Narrow" container width
	 *
   * @When I select the :arg1 container width
	 * @When I select the :width container width
	 */
	public function iSelectTheContainerWidth($width) {
    $element = $this->getSession()->getPage()->find('xpath', "//label[contains(.,'$width') and contains(@for, 'edit-layout-settings-ui-tab-content-layout-container-width')]")->click();
		$element = $this->getSession()->getPage()->find('xpath', "//label[contains(.,'$width') and contains(@for, 'edit-layout-settings-ui-tab-content-layout-container-width')]");
		if (is_null($element)) {
			throw new \Exception("The $width option was not found or not visible. \nThese are the available container widths:\n\tWide (Default)\n\tMedium\n\tNarrow\n\tTiny\n");
		}
		$element->click();
	}

	/**
@@ -745,10 +760,17 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * Example #1: When I select the "md" "33% 67%" section breakpoint
	 * Example #2:  And I select the "xs" "75% 25%" section breakpoint
	 *
   *
   * @When I select the :arg1 :arg2 section breakpoint
	 * @When I select the :size :point section breakpoint
	 */
	public function iSelectTheSectionBreakpoint($size, $point) {
		$screen_size = $this->getSession()->getPage()->find('xpath', "//*[contains(@class, '$size')]");
		if (is_null($screen_size)) {
			throw new \Exception("The $size option was not found or not visible. \nThese are the available screen sizes:\n\tlg\n\tmd\n\tsm\n\txs\n");
		}
		$break = $this->getSession()->getPage()->find('xpath', "//*[contains(., '$point')]");
		if (is_null($break)) {
			throw new \Exception('The break point selected was not found or not suitable for the screen size selected');
		}
		$element = $this->getSession()->getPage()->find('xpath', "//*[contains(@class,'$size') and contains(.,'$point')]")->click();
	}

@@ -763,7 +785,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * @When I add section gutters
	 */
	public function iAddSectionGutters() {
    $with_gutters = $this->getSession()->getPage()->find('xpath', "//label[contains(., 'With Gutters')]")->click();
		$with_gutters = $this->getSession()->getPage()->find('xpath', "//label[contains(., 'With Gutters')]");
		if (is_null($with_gutters)) {
			throw new \Exception('The "With Gutters" option was not found or not visible');
		}
		$with_gutters->click();
	}

	/**
@@ -777,7 +803,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * @When I remove gutters between section columns
	 */
	public function iRemoveGuttersBetweenSectionColumns() {
    $no_gutters = $this->getSession()->getPage()->find('xpath', "//*[contains(@class, 'vlb_gutters_between')]")->click();
		$no_gutters = $this->getSession()->getPage()->find('xpath', "//*[contains(@class, 'vlb_gutters_between')]");
		if (is_null($no_gutters)) {
			throw new \Exception('The "Keep gutters between columns" checkbox was not found or not visible');
		}
		$no_gutters->click();
	}

	/**
@@ -791,7 +821,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * @When I move to the section styles tab
	 */
	public function iMoveToTheSectionStylesTab() {
    $styles_tab = $this->getSession()->getPage()->find('xpath', "//a[contains(@data-target, 'appearance')]")->click();
		$styles_tab = $this->getSession()->getPage()->find('xpath', "//a[contains(@data-target, 'appearance')]");
		if (is_null($styles_tab)) {
			throw new \Exception('The section styles tab was not found or not visible');
		}
		$styles_tab->click();
	}

	/**
@@ -802,7 +836,7 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * Example #1: When I open the section "Background" settings menu
	 * Example #2: And I open the section "Border" settings menu
	 *
   * @When I open the section :arg1 settings menu
	 * @When I open the section :menu settings menu
	 */
	public function iOpenTheSectionSettingsMenu($menu) {
		$this->iMoveToTheSectionStylesTab();
@@ -812,9 +846,13 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
			const js_menu = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
			js_menu.closest("details").setAttribute("open", "");
		JS;
		try {
			$this->getSession()->executeScript($js);
		}

		catch( Exception $e) {
			throw new \Exception('The "'. $menu .'" menu was not found or not visible');
		}
	}

	/**
	 * Select a section background color
@@ -824,11 +862,15 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * Example #1: When I select the "Primary" section background color
	 * Example #2:  And I select the "Light" section background color
	 *
   * @When I select the :arg1 section background color
	 * @When I select the :color section background color
	 */
  public function iSelectTheSectionBackgroundColor($bg_color) {
	public function iSelectTheSectionBackgroundColor($color) {
		$this->iOpenTheSectionSettingsMenu("Background");
    $bg_color = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$bg_color') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-color')]")->click();
		$bg_color = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$color') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-color')]");
		if (is_null($bg_color)) {
			throw new \Exception('The "'. $color .'" option was not found or not visible');
		}
		$bg_color->click();
	}

	/**
@@ -843,7 +885,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 */
	public function iUncheckTheEdgeToEdgeBackground() {
		$this->iOpenTheSectionSettingsMenu("Background");
    $e2e = $this->getSession()->getPage()->find('xpath', "//input[contains(@class, 'field-background-edge-to-edge')]")->click();
		$e2e = $this->getSession()->getPage()->find('xpath', "//input[contains(@class, 'field-background-edge-to-edge')]");
		if (is_null($e2e)) {
			throw new \Exception('The "Edge to Edge Background" checkbox was not found or not visible');
		}
		$e2e->click();
	}

	/**
@@ -854,11 +900,15 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * Example #1: When I select the "Dark" section text color
	 * Example #2:  And I select the "White" section text color
	 *
   * @When I select the :arg1 section text color
	 * @When I select the :color section text color
	 */
	public function iSelectTheSectionTextColor($color) {
		$this->iOpenTheSectionSettingsMenu("Typography");
    $text_color = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$color') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-typography-text-color-text')]")->click();
		$text_color = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$color') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-typography-text-color-text')]");
		if (is_null($text_color)) {
			throw new \Exception('The "'. $color .'" option was not found or not visible');
		}
		$text_color->click();
	}

	/**
@@ -869,41 +919,34 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * Example #1: When I set the alignment to "End"
	 * Example #2:  And I set the alignment to "Start"
	 *
   * @When I set the alignment to :arg1
	 * @When I set the alignment to :align
	 */
	public function iSetTheAlignmentTo($align) {
		$this->iOpenTheSectionSettingsMenu("Typography");
    $alignment = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$align') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-typography-text-alignment')]")->click();
		$alignment = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$align') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-typography-text-alignment')]");
		if (is_null($alignment)) {
			throw new \Exception("The alignment option selected was not found or not visible. \nSelect one of these: \n\tStart\n\tCenter\n\tEnd\n\tJustify\n");
		}

  /**
   * Set horizontal alignment for blocks
   *
   * Varbase Context #varbase
   *
   * Example #1: When I set the horizontal alignment to "Align center"
   * Example #2:  And I set the horizontal alignment to "Align start"
   *
   * @When I set the horizontal alignment to :arg1
   */
  public function iSetTheHorizontalAlignmentTo($h_align) {
    $this->iOpenTheSectionSettingsMenu("Blocks alignment");
    $horizontal_alignment = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$h_align') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-alignment-horizontal-alignment-justify-content')]")->click();
		$alignment->click();
	}

	/**
   * Set vertical alignment for blocks
	 * Set the section blocks alignemnt
	 * 
   * Varbase Context #varbase
	 * #Varbase Context #varbase
	 * 
   * Example #1: When I set the vertical alignment to "Align bottom"
   * Example #2:  And I set the vertical alignment to "Align middle"
	 * Example #1: When I set the blocks vertical alignment to "Align middle"
	 * Example #2: When I set the blocks horizontal alignment to "Align start"
	 * 
   * @When I set the vertical alignment to :arg1
	 * @When I set the blocks :orientation alignment to :align
	 */
  public function iSetTheVerticalAlignmentTo($v_align) {
	public function iSetTheBlocksAlignmentTo($orientation, $align) {
		$this->iOpenTheSectionSettingsMenu("Blocks alignment");
    $vertical_alignment = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$v_align') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-alignment-vertical-alignment-align-items')]")->click();
		$alignment = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$align') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-alignment-$orientation')]");
		if (is_null($alignment)) {
			throw new \Exception("The alignment option selected was not found or not visible\nAlignment options for vertical orientation are: \n\tAlign top\n\tAlign middle\n\tAlign bottom\n\nAlignment options for horizontal orientation are: \n\tAlign start\n\tAlign center\n\tAlign end\n");
		}
		$alignment->click();
	}

	/**
@@ -922,10 +965,13 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 */
	public function iSetTheSectionPaddingTo($side = NULL, $value) {
		$this->iOpenTheSectionSettingsMenu("Spacing");
		if (is_numeric($value)) {
			if ($value >= 1 && $value <= 5) {
				$padding_side = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Padding $side')]");
				if (is_null($side)) {
					$this->getSession()->executeScript('jQuery(".bs-field-padding.form-range").val("' . $value . '")');
    }else{
				}
				else {
					$padding_side->click();
					$js = <<<JS
					var js_side = "$side";
@@ -935,7 +981,14 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
					$this->getSession()->executeScript($js);
				}
			}

			else {
				throw new \Exception('The section padding value should be between 1(min) - 5(max)');
			}
		}
		else {
			throw new \Exception('The section padding value should be an integer');
		}
	}

	/**
	 * Set the margin for a section
@@ -953,10 +1006,13 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 */
	public function iSetTheSectionMarginTo($side = NULL, $value) {
		$this->iOpenTheSectionSettingsMenu("Spacing");
		if (is_numeric($value)) {
			if ($value >= 1 && $value <= 5) {
				$margin_side = $this->getSession()->getPage()->find('xpath', "//*[contains(., 'Margin $side')]");
				if (is_null($side)) {
					$this->getSession()->executeScript('jQuery(".bs-field-margin.form-range").val("' . $value . '")');
    }else{
				}
				else {
					$margin_side->click();
					$js = <<<JS
					var js_side = "$side";
@@ -966,7 +1022,14 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
					$this->getSession()->executeScript($js);
				}
			}

			else {
				throw new \Exception('The section margin value should be between 1(min) - 5(max)');
			}
		}
		else {
			throw new \Exception('The section margin value should be an integer');
		}
	}

	/**
	 * Select a border style for a section
@@ -985,10 +1048,23 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	public function iSelectTheSectionBorderStyle($b_style, $b_side = NULL) {
		$this->iOpenTheSectionSettingsMenu("Border");
		if (is_null($b_side)) {
      $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-style-bs-border-style-$b_style')]")->click();
    }else{
      $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-type-border-$b_side')]")->click();
      $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-$b_side-style-bs-border-style-$b_side-$b_style')]")->click();
			$all_sides = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-style-bs-border-style-$b_style')]");
			if (is_null($all_sides)) {
				throw new \Exception("The $b_style option was not found or not visible");
			}
			$all_sides->click();
		}
		else {
			$one_side = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-type-border-$b_side')]");
			if (is_null($one_side)) {
				throw new \Exception("The option selected was not found or not visible\nThe available border sides are:\n\ttop\n\tright\n\tbottom\n\tleft\n");
			}
			$one_side->click();
			$style = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-$b_side-style-bs-border-style-$b_side-$b_style')]");
			if (is_null($style)) {
				throw new \Exception("The $b_style option was not found or not visible");
			}
			$style->click();
		}
	}

@@ -1006,9 +1082,12 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 */
	public function iSetTheSectionBorderWidthTo($b_width, $b_side = NULL) {
		$this->iOpenTheSectionSettingsMenu("Border");
		if (is_numeric($b_width)) {
			if ($b_width >= 1 && $b_width <= 3) {
				if (is_null($b_side)) {
					$this->getSession()->executeScript('jQuery(".bs-field-border-width.form-range").val("' . $b_width . '")');
    }else{
				}
				else {
					$this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-type-border-$b_side')]")->click();
					$js = <<<JS
						var js_side = "$b_side";
@@ -1018,6 +1097,14 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
					$this->getSession()->executeScript($js);
				}
			}
			else {
				throw new \Exception('The border width value should be between 1(min) - 5(max)');
			}
		}
		else {
			throw new \Exception('The border width value should be an integer');
		}
	}

	/**
	 * Set the border color
@@ -1035,12 +1122,24 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	public function iSelectTheSectionBorderColor($b_color, $b_side = NULL) {
		$this->iOpenTheSectionSettingsMenu("Border");
		if (is_null($b_side)) {
      $this->getSession()->getPage()->find('xpath', "//label[contains(.,'$b_color') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-color-border')]")->click();
    }else{
      $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-type-border-$b_side')]")->click();
      $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-$b_side') and contains(.,'$b_color')]")->click();
			$all_sides = $this->getSession()->getPage()->find('xpath', "//label[contains(.,'$b_color') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-color-border')]");
			if (is_null($all_sides)) {
				throw new \Exception("The $b_color option was not found or not visible");
			}
			$all_sides->click();
		}
		else {
			$one_side = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-type-border-$b_side')]");
			if (is_null($one_side)) {
				throw new \Exception("The option selected was not found or not visible\nThe available border sides are:\n\ttop\n\tright\n\tbottom\n\tleft\n");
			}
			$one_side->click();
			$color = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-border-border-$b_side') and contains(.,'$b_color')]");
			if (is_null($color)) {
				throw new \Exception("The $b_color option was not found or not visible");
			}
			$color->click();
		}
    
	}

	/**
@@ -1059,9 +1158,12 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 */
	public function iSetTheSectionBorderRadiusTo($corner = NULL, $value) {
		$this->iOpenTheSectionSettingsMenu("Border");
		if (is_numeric($value)) {
			if ($value >=1 && $value <= 3) {
				if (is_null($corner)) {
					$this->getSession()->executeScript('jQuery(".bs-field-rounded-corners").val("' . $value . '")');
    }else{
				}
				else {
					$js = <<<JS
					var js_corner = "$corner";
					var js_value = "$value";
@@ -1071,7 +1173,14 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
					$this->getSession()->executeScript($js);
				}
			}

			else {
				throw new \Exception('The border radius value should be between 1(min) - 3(max)');
			}
		}
		else {
			throw new \Exception('The border radius value entered should be an integer');
		}
	}

	/**
	 * Switch to the background image settings found under background styles settings
@@ -1080,11 +1189,15 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * 
	 * Example #1: And I switch to section background image settings
	 * 
   * @When I switch to background image settings
	 * @When I switch to section background image settings
	 */
	public function iSwitchToSectionBackgroundImageSettings() {
		$this->iOpenTheSectionSettingsMenu("Background");
    $bg_image = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-type-image')]")->click();
		$bg_image = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-type-image')]");
		if (is_null($bg_image)) {
			throw new \Exception('The section background image tab was not found or not visible');
		}
		$bg_image->click();
	}

	/**
@@ -1098,11 +1211,15 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 */
	public function iSwitchToSectionBackgroundVideoSettings() {
		$this->iOpenTheSectionSettingsMenu("Background");
    $bg_video = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-type-video')]")->click();
		$bg_video = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-type-video')]");
		if (is_null($bg_video)) {
			throw new \Exception('The section background video tab was not found or not visible');
		}
		$bg_video->click();
	}

	/**
   * Set and image attachment to be fixed
	 * Set an image attachment to be fixed
	 * 
	 * Varbase Context #varbase
	 * 
@@ -1111,7 +1228,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * @When I set the attachment to be fixed
	 */
	public function iSetTheAttachmentToBeFixed() {
        $fixed_image = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-options-background-attachment-fixed')]")->click();
		$fixed_image = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-options-background-attachment-fixed')]");
		if (is_null($fixed_image)) {
			throw new \Exception('The image attachment options were not found or not visible');
		}
		$fixed_image->click();
	}

	/**
@@ -1125,9 +1246,14 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * @When I set the image size to :arg1
	 */
	public function iSetTheImageSizeTo($arg1) {
        $image_size = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-options-background-size') and contains(., '$arg1')]")->click();
		$this->iOpenTheSectionSettingsMenu("Background");
		$this->iSwitchToSectionBackgroundImageSettings();
		$image_size = $this->getSession()->getPage()->find('xpath', "//label[contains(@for, 'edit-layout-settings-ui-tab-content-appearance-background-background-options-background-size') and contains(., '$arg1')]");
		if (is_null($image_size)) {
			throw new \Exception("The background image size selected was not found or not visible\nThe available images sizes are:\n\tCover (Default)\n\tContain\n\tAuto\n");
		}
		$image_size->click();
	}


	/**
	 * Select an animation for a section
@@ -1141,7 +1267,11 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 */
	public function iSelectTheSectionAnimation($anime) {
		$this->iOpenTheSectionSettingsMenu("Animation");
    $animation = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$anime') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-animation-scroll-effects')]")->click();
		$animation = $this->getSession()->getPage()->find('xpath', "//label[contains(., '$anime') and contains(@for, 'edit-layout-settings-ui-tab-content-appearance-animation-scroll-effects')]");
		if (is_null($animation)) {
			throw new \Exception('The "' . $anime . '" option was not found or not visible');
		}
		$animation->click();
	}    

	/**
@@ -1155,8 +1285,7 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 * 
	 * @When I add a :block block
	 */
  public function iAddABlock($block)
  {
	public function iAddABlock($block) {
		$add_block_btn = $this->getSession()->getPage()->find('xpath', "//*[contains(@class, 'use-ajax layout-builder__link layout-builder__link--add') and contains(., 'Add block')]")->click();
		$this->iWaitForSeconds(1);
		$custom_block_btn = $this->getSession()->getPage()->find('xpath', "//*[contains(@class, 'use-ajax inline-block-create-button') and contains(., 'Create custom block')]")->click();
@@ -1211,7 +1340,7 @@ class VarbaseContext extends RawDrupalContext implements SnippetAcceptingContext
	 *
	 * Varbase Context #varbase.
	 *
   * Example 1: I double click on the image with the "Flag Earth image title" title text.
	 * Example 1: I double click on the image with the "Flafg Earth image title" title text.
	 *
	 * @Given /^I double click on the image with the "([^"]*)" title text$/
	 */