Skip to content
Snippets Groups Projects

ISTWCMS-4960: Test that forms work after having saved their access settings

Merged Liam Morland requested to merge feature/ISTWCMS-4960-lkmorlan-test-saving-form-access into 3.0.x
Files
2
@@ -102,6 +102,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->bannerBlockTest();
$this->ofisTest();
$this->nodeRevisionDeleteTest();
$this->quickNodeCloneTest();
}
/**
@@ -555,6 +556,15 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->drupalPostForm('node/add/' . $content_type, $edit, 'Save');
// Make sure no 'Revert to default' on the above content type layout page.
$this->assertSession()->buttonNotExists('Revert to defaults');
// Make sure 'Clone' tab not exist for site footer content type.
if ($content_type === 'uw_ct_site_footer') {
$this->assertSession()->linkNotExists('Clone');
}
// Make sure 'Clone' tab exist for web page, blog, news,
// events and catalog content types.
else {
$this->assertSession()->linkExists('Clone');
}
// Get the node ID of the newly-created node, store in $content_nids.
$nid = $this->xpath('//a[text() = "View"]');
@@ -638,6 +648,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->drupalPostForm('node/add/uw_ct_sidebar', $edit, 'Save');
// Make sure no 'Revert to defaults' button on sidebar layout page.
$this->assertSession()->buttonNotExists('Revert to defaults');
// Make sure 'Clone' tab exist for sidebar content type.
$this->assertSession()->linkExists('Clone');
// Verify that the user is redirected to the layout edit page.
$this->assertSession()->addressMatches('/^\/[a-z0-9-\/]+\/layout$/');
@@ -2186,6 +2198,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->submitForm($req_fields, 'Save');
// Make sure not 'Revert to defaults' button on profile layout page.
$this->assertSession()->buttonNotExists('Revert to defaults');
// Make sure 'Clone' tab found for profile content type.
$this->assertSession()->linkExists('Clone');
// Validate new content has been created with same name.
$this->assertSession()->pageTextContains('Profile ' . $profile_name . ' has been created.');
@@ -2663,4 +2677,54 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->getSession()->getPage()->findField('edit-node-revision-delete-when-to-delete-time-time')->getValue('months');
}
/**
* Test for quick node clone.
*/
public function quickNodeCloneTest() {
$this->drupalLogin($this->drupalUsers['administrator']);
// Check quick node clone setting for node.
$this->drupalGet('admin/config/quick-node-clone');
$this->assertSession()->statusCodeEquals(200);
$this->getSession()->getPage()->findField('edit-text-to-prepend-to-title')->getValue('Clone of');
$this->assertSession()->checkboxNotChecked('edit-clone-status');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-blog');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-catalog-item');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-contact');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-event');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-news-item');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-profile');
$this->assertSession()->checkboxChecked('edit-bundle-names-uw-ct-sidebar');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-site-footer');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-web-page');
$this->assertSession()->checkboxChecked('edit-uw-ct-sidebar-field-uw-attach-page');
$this->assertSession()->checkboxNotChecked('edit-uw-ct-sidebar-layout-builder-layout');
$this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-blog');
$this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-catalog-item');
$this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-contact');
$this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-event');
$this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-news-item');
$this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-profile');
$this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-sidebar');
$this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-ct-site-footer');
$this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-web-page');
// Check quick node clone setting for paragraph.
$this->drupalGet('admin/config/quick-node-clone-paragraph');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-call-to-action');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-fact-figure');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-ff');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-image-banner');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-local-video-banner');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-timeline');
$this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-vimeo-video-banner');
$this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-call-to-action');
$this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-fact-figure');
$this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-ff');
$this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-image-banner');
$this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-local-video-banner');
$this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-timeline');
$this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-vimeo-video-banner');
}
}
Loading