Test image width and position

[MAILPOET-1843]
This commit is contained in:
Ján Mikláš
2019-04-08 11:09:55 +02:00
committed by Rostislav Wolný
parent 0f2cf9644c
commit 47b264406f
3 changed files with 29 additions and 1 deletions

View File

@@ -50,7 +50,7 @@ Module.ProductsBlockModel = base.BlockModel.extend({
titleIsLink: false, // false|true
imageFullWidth: false, // true|false
titlePosition: 'abovePost', // 'abovePost'|'aboveExcerpt'
featuredImagePosition: 'centered', // 'centered'|'right'|'left'|'alternate'|'none'
featuredImagePosition: 'alternate', // 'centered'|'right'|'left'|'alternate'|'none'
pricePosition: 'hidden', // 'hidden'|'above'|'below'
readMoreType: 'link', // 'link'|'button'
readMoreText: 'Buy now', // 'link'|'button'

View File

@@ -160,6 +160,12 @@ class AcceptanceTester extends \Codeception\Actor {
expect($attributeValue)->contains($contains);
}
public function assertAttributeNotContains($selector, $attribute, $notContains) {
$I = $this;
$attributeValue = $I->grabAttributeFrom($selector, $attribute);
expect($attributeValue)->notContains($notContains);
}
public function searchFor($query, $delay = 0, $element = '#search_input', $button = 'Search') {
$I = $this;
$I->waitForElement($element);

View File

@@ -213,6 +213,28 @@ class EditorProductsCest {
$I->clickLabelWithInput('mailpoet_posts_show_divider', 'false');
$this->waitForChange($I);
$I->dontSeeElementInDOM(self::EDITOR_PRODUCTS_SELECTOR . ' .mailpoet_divider_block');
// Test "Image width"
$I->assertAttributeNotContains(self::EDITOR_PRODUCTS_SELECTOR . ' .mailpoet_image_block', 'class', 'mailpoet_full_image');
$I->clickLabelWithInput('imageFullWidth', 'true');
$this->waitForChange($I);
$I->assertAttributeContains(self::EDITOR_PRODUCTS_SELECTOR . ' .mailpoet_image_block', 'class', 'mailpoet_full_image');
// Test "Image position"
$I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(2) .mailpoet_block:nth-child(2) .mailpoet_image_block');
$I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(4) .mailpoet_block:nth-child(1) .mailpoet_image_block');
$I->clickLabelWithInput('mailpoet_products_featured_image_position', 'none');
$this->waitForChange($I);
$I->dontSeeElementInDOM(self::EDITOR_PRODUCTS_SELECTOR . ' .mailpoet_image_block');
$I->clickLabelWithInput('mailpoet_products_featured_image_position', 'left');
$this->waitForChange($I);
$I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(2) .mailpoet_block:nth-child(1) .mailpoet_image_block');
$I->clickLabelWithInput('mailpoet_products_featured_image_position', 'right');
$this->waitForChange($I);
$I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(2) .mailpoet_block:nth-child(2) .mailpoet_image_block');
$I->clickLabelWithInput('mailpoet_products_featured_image_position', 'centered');
$this->waitForChange($I);
$I->seeElementInDOM(self::EDITOR_PRODUCT_SELECTOR . ':nth-child(1) .mailpoet_image_block');
}
private function clearCategories(\AcceptanceTester $I) {