Skip to content

Commit

Permalink
Merge pull request #74 from openeuropa/EWPP-0000-test-fix
Browse files Browse the repository at this point in the history
EWPP-0000: Assert machine name is correctly set during tests.
  • Loading branch information
imanoleguskiza authored Jan 4, 2023
2 parents 53164b3 + 09869a9 commit becf131
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/src/FunctionalJavascript/CorporateContactFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function testCorporateContactForm(): void {
// Add remaining field values and submit form.
$this->fillCorporateFields();
$page->pressButton('Save');
$assert->pageTextContains('Contact form Test form has been added.');
$assert->pageTextContains('Contact form OE Corporate Form has been added.');

// Assert the values are saved.
$this->drupalGet('admin/structure/contact/manage/oe_corporate_form');
Expand All @@ -246,7 +246,7 @@ public function testCorporateContactForm(): void {

// Go through the edit process.
$page->pressButton('Save');
$assert->pageTextContains('Contact form Test form has been updated.');
$assert->pageTextContains('Contact form OE Corporate Form has been updated.');

// Assert the values are saved.
$this->drupalGet('admin/structure/contact/manage/oe_corporate_form');
Expand All @@ -261,7 +261,7 @@ public function testCorporateContactForm(): void {
$value = '<front>';
$element->setValue($value);
$page->pressButton('Save');
$assert->pageTextContains('Contact form Test form has been updated.');
$assert->pageTextContains('Contact form OE Corporate Form has been updated.');

// Make sure the saved value is the one expected.
$this->drupalGet('admin/structure/contact/manage/oe_corporate_form');
Expand All @@ -282,7 +282,7 @@ public function testCorporateContactForm(): void {
$value = 'Privacy page (' . $node->id() . ')';
$element->setValue($value);
$page->pressButton('Save');
$assert->pageTextContains('Contact form Test form has been updated.');
$assert->pageTextContains('Contact form OE Corporate Form has been updated.');

$this->drupalGet('admin/structure/contact/manage/oe_corporate_form');
$element = $page->findField($field_name);
Expand All @@ -298,7 +298,7 @@ public function testCorporateContactForm(): void {
$this->assertFalse($alternative_language_element->isChecked());

$page->pressButton('Save');
$assert->pageTextContains('Contact form Test form has been updated.');
$assert->pageTextContains('Contact form OE Corporate Form has been updated.');

$this->drupalGet('admin/structure/contact/manage/oe_corporate_form');
$element = $page->findField($field_name);
Expand Down Expand Up @@ -351,7 +351,7 @@ public function testNoCorporateValues(): void {
$this->fillCoreContactFields();

$page->pressButton('Save');
$assert->pageTextContains('Contact form Test form has been added.');
$assert->pageTextContains('Contact form OE Corporate Form has been added.');

// Assert the values are saved.
$this->drupalGet('admin/structure/contact/manage/oe_corporate_form');
Expand Down Expand Up @@ -388,7 +388,7 @@ public function testCorporateDefaultTransition(): void {
// Add remaining field values and submit form.
$this->fillCorporateFields();
$page->pressButton('Save');
$assert->pageTextContains('Contact form Test form has been added.');
$assert->pageTextContains('Contact form OE Corporate Form has been added.');

// Assert the values are saved.
$this->drupalGet('admin/structure/contact/manage/oe_corporate_form');
Expand All @@ -408,7 +408,7 @@ public function testCorporateDefaultTransition(): void {
$this->assertFieldsVisible(FALSE);

$page->pressButton('Save');
$assert->pageTextContains('Contact form Test form has been updated.');
$assert->pageTextContains('Contact form OE Corporate Form has been updated.');

// Assert no corporate values are saved.
$this->drupalGet('admin/structure/contact/manage/oe_corporate_form');
Expand Down Expand Up @@ -444,10 +444,10 @@ protected function fillCoreContactFields(): void {
/** @var \Behat\Mink\Element\DocumentElement $page */
$page = $this->getSession()->getPage();

$page->fillField('label', 'Test form');
$page->fillField('recipients', '[email protected]');
$page->fillField('label', 'OE Corporate Form');
// Overcome machine name not being accessible.
$this->getSession()->executeScript('jQuery("#edit-id").val("oe_corporate_form");');
$this->assertSession()->waitForText('Machine name: oe_corporate_form');
$page->fillField('recipients', '[email protected]');
}

/**
Expand Down

0 comments on commit becf131

Please sign in to comment.