Skip to content
Snippets Groups Projects
Commit 65a98001 authored by Lily Yan's avatar Lily Yan
Browse files

ISTWCMS-7189 Add switchToIFrame to make WcmsTestsBlocksContentCest work

parent 369b34e7
No related branches found
No related tags found
1 merge request!83ISTWCMS-7160 Fix service content type in testAutomaticListBlocksSettings in...
......@@ -55,6 +55,9 @@ class WcmsTestsBlocksContentCest {
$i->click('Banner images');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Ensure that banner image required.
$i->seeElement(Locator::contains('div[id^="edit-settings-block-form-field-uw-banner-item"] strong[class="form-required"]', 'Banner'));
......@@ -249,6 +252,9 @@ class WcmsTestsBlocksContentCest {
$i->click('Banner images');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Ensure that banner image required.
$i->seeElement(Locator::contains('div[id^="edit-settings-block-form-field-uw-banner-item"] strong[class="form-required"]', 'Banner'));
......@@ -312,6 +318,9 @@ class WcmsTestsBlocksContentCest {
$i->click('Copy text');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Text to be used.
$copy_text = $i->uwRandomString();
......@@ -325,18 +334,27 @@ class WcmsTestsBlocksContentCest {
$i->dontSeeOptionIsSelected('layout_builder_style_uw_lbs_grp_text_alignment', 'Right');
// Fill the title field.
$i->fillField('settings[label]', $copy_text);
$i->fillField('settings[label]', $i->uwRandomString());
// Click on source and fill in the ck editor field with the tagged text.
$i->click('Source');
$i->fillCkEditor($tagged_text, 'textarea[name="settings[block_form][field_uw_copy_text][0][value]"]');
// Click on source again to make sure it is added.
$i->click('Source');
// Trigger CKEditor update.
$i->executeJS('for (instance in CKEDITOR.instances) { CKEDITOR.instances[instance].updateElement(); }');
// Submit form.
$i->click('input[id*="edit-actions-submit"]');
// Switch to iframe.
$i->switchToIFrame();
// Ensure that the tag is on the page.
$i->waitForElement('.uw-copy-text div ' . $tag);
$i->see($copy_text, '.uw-copy-text div ' . $tag);
$i->waitForText($copy_text);
$i->seeInSource($tagged_text);
// Remove added block to start again.
$i->amOnPage($path . '/layout/discard-changes');
......@@ -377,6 +395,9 @@ class WcmsTestsBlocksContentCest {
$i->click('Call to action');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Check for form elements.
$i->seeElement(Locator::contains('label', 'Link'));
$i->seeElement(Locator::contains('label', 'Theme'));
......@@ -408,11 +429,12 @@ class WcmsTestsBlocksContentCest {
// Click on add block and ensure it is on the screen.
$i->click('Add block');
$i->waitForElement(Locator::contains('div[class="uw-admin-label"]', 'Call to action'));
$i->seeElement(Locator::contains('div[class="uw-admin-label"]', 'Call to action'));
// Switch to iframe.
$i->switchToIFrame();
// Check that elements are on the page.
$i->see($title);
$i->waitForText($title);
$i->seeElement('.uw-cta');
$i->seeElement('aside.' . $theme_option);
$i->seeElement('a[href="' . $cta_link . '"]');
......@@ -458,14 +480,23 @@ class WcmsTestsBlocksContentCest {
$i->click('Copy text');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Fill in copy text block.
$i->fillField('settings[label]', 'Test copy text');
$i->fillCkEditor('This is copy text on expand/collapse', 'textarea[name="settings[block_form][field_uw_copy_text][0][value]"]');
// Trigger CKEditor update.
$i->executeJS('for (instance in CKEDITOR.instances) { CKEDITOR.instances[instance].updateElement(); }');
// Add the block and ensure that it appears.
$i->click('Add block');
$i->waitForElement(Locator::contains('div[class="uw-admin-label"]', 'Copy text'));
$i->see('This is copy text on expand/collapse');
// Switch to iframe.
$i->switchToIFrame();
$i->waitForText('This is copy text on expand/collapse');
// Click the save layout and ensure that it saves.
$i->click('Save layout');
......@@ -483,6 +514,9 @@ class WcmsTestsBlocksContentCest {
$i->click('Expand/collapse');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Ensure elements exists.
$i->seeElement('input[id^="edit-settings-label"][type="text"][class*="required"][value="Expand Collapse"]');
$i->seeElement('input[id^="edit-settings-label-display"][type="checkbox"][checked="checked"]');
......@@ -508,11 +542,19 @@ class WcmsTestsBlocksContentCest {
$i->fillField('settings[label]', $title);
$i->selectOption('settings[items_fieldset][heading_selector]', 'h2');
$i->fillField('settings[items_fieldset][items][0][group_info][group]', $exp_col_title);
$i->waitForText($exp_col_title . ' (');
$i->moveMouseOver(Locator::contains('a', $exp_col_title . ' ('));
$i->clickWithLeftButton();
$i->moveMouseOver(NULL, 0, 20);
$i->clickWithLeftButton();
$i->waitForElementNotVisible(Locator::contains('message', 'Please wait...'));
$i->clickWithLeftButton();
// Click on add block and ensure it is on the screen.
$i->click('Add block');
$i->waitForElement(Locator::contains('div[class="uw-admin-label"]', 'Expand Collapse'));
$i->seeElement(Locator::contains('div[class="uw-admin-label"]', 'Expand Collapse'));
$i->switchToIFrame();
$i->waitForElement('.uw-exp-col');
$i->seeElement('.uw-exp-col');
// Test the expand/collapse block contents.
$i->see($title);
......@@ -566,6 +608,9 @@ class WcmsTestsBlocksContentCest {
$i->click('Facts and figures');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Check 'Default background colour' field help text.
$i->see('When gold is selected, the default colour will always be black.');
......@@ -635,6 +680,9 @@ class WcmsTestsBlocksContentCest {
$i->click('Image');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Select the full width image.
$i->selectOption('[id*="edit-settings-image-settings-type-of-image"]', 'full');
......@@ -662,7 +710,9 @@ class WcmsTestsBlocksContentCest {
// Click on add block and ensure that block loads.
$i->click('Add block');
$i->waitForElement(Locator::contains('.uw-admin-label', 'Image'));
$i->switchToIFrame();
$i->waitForElement('.uw-image');
$i->seeElement('.uw-image');
// Get the parts of the image so that we can get
// the full name of the image.
......@@ -745,6 +795,9 @@ class WcmsTestsBlocksContentCest {
$i->click('Image');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Select the full width image.
$i->selectOption('[id*="edit-settings-image-settings-type-of-image"]', 'sized');
......@@ -775,8 +828,11 @@ class WcmsTestsBlocksContentCest {
$i->waitForElement('.form-submit');
// Click on add block and ensure that block loads.
$i->click('Add block');
$i->waitForElement(Locator::contains('.uw-admin-label', 'Image'));
$i->waitForElementClickable('input[id*="edit-actions-submit"]');
$i->click('input[id*="edit-actions-submit"]');
$i->switchToIFrame();
$i->waitForElement('.uw-image');
$i->seeElement('.uw-image');
// Ensure that picture is on page.
$i->seeElement('.uw-image__sized-image--original');
......@@ -798,17 +854,21 @@ class WcmsTestsBlocksContentCest {
$i->click(Locator::contains('ul li a', 'Configure'));
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Select the alignement to test.
$i->selectOption('[id*="edit-settings-image-settings-image-alignment"]', $alignment);
// Click on add block and ensure that block loads, adding a wait
// here for image generation, or it will time out waiting for
// the element.
$i->click('Update');
$i->waitForElementNotVisible('.ui-dialog');
$i->waitForElement(Locator::contains('.uw-admin-label', 'Image'));
$i->waitForElementClickable('input[id*="edit-actions-submit"]');
$i->click('input[id*="edit-actions-submit"]');
$i->switchToIFrame();
// Test that alignment is on page.
$i->waitForElement('.uw-image__sized-image--' . $alignment);
$i->seeElement('.uw-image__sized-image--' . $alignment);
}
......@@ -831,6 +891,9 @@ class WcmsTestsBlocksContentCest {
$i->click(Locator::contains('ul li a', 'Configure'));
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Set the type of sized image to custom.
$i->waitForElement('[id*="edit-settings-image-settings-type-of-sized-image"]');
$i->selectOption('[id*="edit-settings-image-settings-type-of-sized-image"]', 'custom');
......@@ -858,11 +921,12 @@ class WcmsTestsBlocksContentCest {
// Click on add block and ensure that block loads, adding a wait
// here for image generation, or it will time out waiting for
// the element.
$i->click('Update');
$i->waitForElementNotVisible('.ui-dialog');
$i->waitForElement(Locator::contains('.uw-admin-label', 'Image'));
$i->waitForElementClickable('input[id*="edit-actions-submit"]');
$i->click('input[id*="edit-actions-submit"]');
$i->switchToIFrame();
// Ensure that the alignemtn is on the page.
$i->waitForElement('.uw-image__sized-image--' . $alignment);
$i->seeElement('.uw-image__sized-image--' . $alignment);
$i->seeInSource($image_name);
......@@ -912,6 +976,9 @@ class WcmsTestsBlocksContentCest {
$i->click('Timeline');
$i->waitForText('Configure block');
// Switch the block form iframe.
$i->switchToIFrame('iframe[class="lbim-dialog-iframe"]');
// Ensure that fields are in the block.
$i->see('Title');
$i->see('Timeline style');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment