Commit 42c4d5a5 authored by Lily Yan's avatar Lily Yan
Browse files

Merge branch 'feature/ISTWCMS-4203-lkmorlan-test-maps' into '8.x-3.x'

ISTWCMS-4203: Test Google Maps block

See merge request !112
parents ece0e3a0 1caf6dea
......@@ -674,16 +674,17 @@ class UwWcmsBasicTest extends BrowserTestBase {
'Blockquote',
'Call to action',
'Copy text',
'Facebook',
'Facts and figures',
'Full width image',
'Google Maps',
'Image gallery',
'Instagram',
'Mailman subscription',
'Related links',
'Timeline',
'Facebook',
'Instagram',
'Remote video',
'Tableau visualization',
'Timeline',
'Twitter',
];
......@@ -711,26 +712,43 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->assertSession()->pageTextNotContains('URL alias');
// Test Tableau block.
if ($block === 'Tableau visualization') {
// Create Tableau block.
$edit = [
'edit-settings-label' => $this->randomString(),
'edit-settings-block-form-field-uw-tbl-server' => 'Public',
'edit-settings-block-form-field-uw-tbl-site-name-0-value' => $this->randomString(),
'edit-settings-block-form-field-uw-tbl-tableau-name-0-value' => $this->randomString(),
'edit-settings-block-form-field-uw-tbl-tableau-height-0-value' => rand(100, 1000),
'edit-settings-block-form-field-uw-tbl-display-tabs' => 'Yes',
];
$this->submitForm($edit, 'Add block');
// Test that the appropriate Tableau block markup appears on the page.
$this->assertSession()->pageTextContains($edit['edit-settings-label']);
$this->assertFieldByXPath('//object[@class="tableauViz"]/param[@name="host_url" and @value="https://public.tableau.com/"]');
$this->assertFieldByXPath('//object[@class="tableauViz"]/param[@name="site_root" and @value="' . $edit['edit-settings-block-form-field-uw-tbl-site-name-0-value'] . '"]');
$this->assertFieldByXPath('//object[@class="tableauViz"]/param[@name="name" and @value="' . $edit['edit-settings-block-form-field-uw-tbl-tableau-name-0-value'] . '"]');
$this->assertFieldByXPath('//object[@class="tableauViz"]/param[@name="tabs" and @value="yes"]');
$this->assertFieldByXPath('//div[@class="uw-tableau__wrapper"]/script');
$this->assertRaw("vizElement.style.height = '" . $edit['edit-settings-block-form-field-uw-tbl-tableau-height-0-value'] . "px';");
switch ($block) {
case 'Google Maps':
// Create Google Maps block.
$edit = [
'edit-settings-label' => $this->randomString(),
'edit-settings-block-form-field-gmaps-embedded-url-0-uri' => 'https://www.google.com/maps/embed?pb=' . $this->randomMachineName(),
'edit-settings-block-form-field-gmaps-height-0-value' => rand(150, 1000),
];
$this->submitForm($edit, 'Add block');
// Test that the Google Maps block markup appears on the page.
$this->assertSession()->pageTextContains($edit['edit-settings-label']);
$this->assertFieldByXPath('//div[@class="uw-google-maps"]/div[text()="Enable JavaScript to view map."]');
$this->assertFieldByXPath('//div[@class="uw-google-maps"]/iframe[@height="' . $edit['edit-settings-block-form-field-gmaps-height-0-value'] . '" and @src="' . $edit['edit-settings-block-form-field-gmaps-embedded-url-0-uri'] . '"]');
break;
case 'Tableau visualization':
// Create Tableau block.
$edit = [
'edit-settings-label' => $this->randomString(),
'edit-settings-block-form-field-uw-tbl-server' => 'Public',
'edit-settings-block-form-field-uw-tbl-site-name-0-value' => $this->randomString(),
'edit-settings-block-form-field-uw-tbl-tableau-name-0-value' => $this->randomString(),
'edit-settings-block-form-field-uw-tbl-tableau-height-0-value' => rand(100, 1000),
'edit-settings-block-form-field-uw-tbl-display-tabs' => 'Yes',
];
$this->submitForm($edit, 'Add block');
// Test that the appropriate Tableau block markup appears on the page.
$this->assertSession()->pageTextContains($edit['edit-settings-label']);
$this->assertFieldByXPath('//object[@class="tableauViz"]/param[@name="host_url" and @value="https://public.tableau.com/"]');
$this->assertFieldByXPath('//object[@class="tableauViz"]/param[@name="site_root" and @value="' . $edit['edit-settings-block-form-field-uw-tbl-site-name-0-value'] . '"]');
$this->assertFieldByXPath('//object[@class="tableauViz"]/param[@name="name" and @value="' . $edit['edit-settings-block-form-field-uw-tbl-tableau-name-0-value'] . '"]');
$this->assertFieldByXPath('//object[@class="tableauViz"]/param[@name="tabs" and @value="yes"]');
$this->assertFieldByXPath('//div[@class="uw-tableau__wrapper"]/script');
$this->assertRaw("vizElement.style.height = '" . $edit['edit-settings-block-form-field-uw-tbl-tableau-height-0-value'] . "px';");
break;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment