function UiPageTest::testCancelExpressionInRule

Tests that cancelling an expression from a rule works.

File

tests/src/Functional/UiPageTest.php, line 274

Class

UiPageTest
Tests that the Reaction Rules list builder pages work.

Namespace

Drupal\Tests\rules\Functional

Code

public function testCancelExpressionInRule() {
    // Setup a rule with one condition.
    $this->testCreateReactionRule();
    $this->clickLink('Add condition');
    $this->fillField('Condition', 'rules_node_is_promoted');
    $this->pressButton('Continue');
    $this->fillField('context_definitions[node][setting]', 'node');
    $this->pressButton('Save');
    
    /** @var \Drupal\Tests\WebAssert $assert */
    $assert = $this->assertSession();
    $assert->pageTextContains('You have unsaved changes.');
    // Edit and cancel.
    $this->pressButton('Cancel');
    $assert->pageTextContains('Canceled.');
    // Make sure that we are back at the overview listing page.
    $this->assertEquals(1, preg_match('#/admin/config/workflow/rules$#', $this->getSession()
        ->getCurrentUrl()));
}