Commit 4dcfebd7 authored by Lily Yan's avatar Lily Yan
Browse files

ISTWCMS-4535 Change drupalPostForm() to drupalGet() and submitForm()

Change record:
https://www.drupal.org/node/3168858
parent 63b47390
......@@ -257,7 +257,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
'title' => 'Test Form',
'status' => 'open',
];
$this->drupalPostForm('admin/structure/webform/add', $edit, 'Save');
$this->drupalGet('admin/structure/webform/add');
$this->submitForm($edit, 'Save');
// Test for existence Webform CAPTCHA component on newly-created Webform.
$this->assertFieldByXPath('//table[@id="edit-webform-ui-elements"]/tbody/tr[@data-webform-type="captcha"]', NULL, 'CAPTCHA component exists.');
......@@ -267,7 +268,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
// access issues later. Save the page here to verify that no access values
// get changed.
$edit = [];
$this->drupalPostForm('admin/structure/webform/manage/test_form/access', $edit, 'Save');
$this->drupalGet('admin/structure/webform/manage/test_form/access');
$this->submitForm($edit, 'Save');
// The variable $test_paths stores Drupal paths and permission information.
// In this array, the keys are paths. If the value is TRUE, everyone has
......@@ -424,7 +426,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
}
foreach ($edits as $content_type => $items) {
foreach ($items as $item) {
$this->drupalPostForm('node/add/uw_ct_' . $content_type, $item, 'Save');
$this->drupalGet('node/add/uw_ct_' . $content_type);
$this->submitForm($item, 'Save');
}
}
......@@ -523,7 +526,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
$edit = [
'edit-name-0-value' => $this->randomString(),
];
$this->drupalPostForm('admin/structure/taxonomy/manage/uw_vocab_catalogs/add', $edit, $this->t('Save'));
$this->drupalGet('admin/structure/taxonomy/manage/uw_vocab_catalogs/add');
$this->submitForm($edit, 'Save');
// Array of content types.
// Keys: Content types.
......@@ -564,7 +568,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
$edit[$field] = $this->randomString();
}
}
$this->drupalPostForm('node/add/' . $content_type, $edit, 'Save');
$this->drupalGet('node/add/' . $content_type);
$this->submitForm($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.
......@@ -623,13 +628,15 @@ class UwWcmsBasicTest extends BrowserTestBase {
// The title defaults via JS to the page title. Specify since no JS.
'menu[title]' => $title,
];
$this->drupalPostForm($url, $edit, 'Save');
$this->drupalGet($url);
$this->submitForm($edit, 'Save');
$this->drupalGet('admin/structure/menu/manage/main');
$this->assertSession()->pageTextContains($title);
$this->assertSession()->pageTextNotContains($title . ' (disabled)');
// Uncheck "Add menu link", making menu item be disabled.
$edit = ['menu[place_in_menu]' => FALSE];
$this->drupalPostForm($url, $edit, 'Save');
$this->drupalGet($url);
$this->submitForm($edit, 'Save');
$this->drupalGet('admin/structure/menu/manage/main');
$this->assertSession()->pageTextContains($title . ' (disabled)');
......@@ -660,7 +667,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
// brackets is used as the nid of the page to attach this sidebar to.
'edit-field-uw-attach-page-0-target-id' => 'Title (1)',
];
$this->drupalPostForm('node/add/uw_ct_sidebar', $edit, 'Save');
$this->drupalGet('node/add/uw_ct_sidebar');
$this->submitForm($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.
......@@ -888,13 +896,15 @@ class UwWcmsBasicTest extends BrowserTestBase {
'edit-name-0-value' => $this->randomString(),
];
// Create a catalog term based on the above catalog term name.
$this->drupalPostForm('admin/structure/taxonomy/manage/uw_vocab_catalogs/add', $edit, $this->t('Save'));
$this->drupalGet('admin/structure/taxonomy/manage/uw_vocab_catalogs/add');
$this->submitForm($edit, 'Save');
// Prepare $edit for catalog categories term name.
$edit = [
'edit-name-0-value' => $this->randomString(),
];
// Create a catalog categories term based on the above catalog term name.
$this->drupalPostForm('admin/structure/taxonomy/manage/uw_vocab_catalog_categories/add', $edit, $this->t('Save'));
$this->drupalGet('admin/structure/taxonomy/manage/uw_vocab_catalog_categories/add');
$this->submitForm($edit, 'Save');
// Prepare $edit for catalog item node.
$edit = [
'edit-title-0-value' => $this->randomString(),
......@@ -902,7 +912,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
'edit-moderation-state-0-state' => 'uw_wf_needs_review',
];
// Create a catalog item node.
$this->drupalPostForm('node/add/uw_ct_catalog_item', $edit, 'Save');
$this->drupalGet('node/add/uw_ct_catalog_item');
$this->submitForm($edit, 'Save');
}
$this->drupalLogin($this->drupalUsers['uw_role_site_manager']);
// Create the first taxonomy term which the vocab is
......@@ -910,13 +921,15 @@ class UwWcmsBasicTest extends BrowserTestBase {
$editCatalog = [
'edit-name-0-value' => $this->randomMachineName(),
];
$this->drupalPostForm('admin/structure/taxonomy/manage/uw_vocab_catalogs/add', $editCatalog, $this->t('Save'));
$this->drupalGet('admin/structure/taxonomy/manage/uw_vocab_catalogs/add');
$this->submitForm($editCatalog, 'Save');
// Create the second taxonomy term which the vocab is
// category and the tid should be 36.
$editCategory = [
'edit-name-0-value' => 'apple',
];
$this->drupalPostForm('admin/structure/taxonomy/manage/uw_vocab_catalog_categories/add', $editCategory, $this->t('Save'));
$this->drupalGet('admin/structure/taxonomy/manage/uw_vocab_catalog_categories/add');
$this->submitForm($editCategory, 'Save');
// Prepare $editNode for creating a catalog item node.
// Use tid=35 as catalog term and tid=36 (apple) as category term.
......@@ -929,7 +942,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
'edit-moderation-state-0-state' => 'uw_wf_needs_review',
];
// Create a catalog item node with needs review.
$this->drupalPostForm('node/add/uw_ct_catalog_item', $editNode, 'Save');
$this->drupalGet('node/add/uw_ct_catalog_item');
$this->submitForm($editNode, 'Save');
// Check node title.
$this->assertSession()->pageTextContains('Edit layout for Test catalog item');
// Check that there is no moderation form.
......@@ -2042,7 +2056,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
'edit-pass-pass1' => $pass,
'edit-pass-pass2' => $pass,
];
$this->drupalPostForm('admin/people/create', $edit, 'Create new account');
$this->drupalGet('admin/people/create');
$this->submitForm($edit, 'Create new account');
// The first name and last name are displayed in people page.
$this->drupalGet('admin/people');
......
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