Commit a3ad178e authored by Liam Morland's avatar Liam Morland
Browse files

ISTWCMS-3752: Use 'switch' statement for tableau block test

parent e9d2568b
......@@ -711,26 +711,28 @@ 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 '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