function UiPageTest::testCreateReactionRule

Tests that creating a reaction rule works.

7 calls to UiPageTest::testCreateReactionRule()
UiPageTest::testAddEvent in tests/src/Functional/UiPageTest.php
Tests that an event can be added.
UiPageTest::testAddEventWithRestrictByType in tests/src/Functional/UiPageTest.php
Tests that an event with type restriction can be added.
UiPageTest::testCancelExpressionInRule in tests/src/Functional/UiPageTest.php
Tests that cancelling an expression from a rule works.
UiPageTest::testDeleteExpressionInRule in tests/src/Functional/UiPageTest.php
Tests that deleting an expression from a rule works.
UiPageTest::testNegatedCondition in tests/src/Functional/UiPageTest.php
Tests that a negated condition has NOT prefixed to its label.

... See full list

File

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

Class

UiPageTest
Tests that the Reaction Rules list builder pages work.

Namespace

Drupal\Tests\rules\Functional

Code

public function testCreateReactionRule() {
    $this->drupalLogin($this->adminUser);
    $this->drupalGet('admin/config/workflow/rules');
    $this->clickLink('Add reaction rule');
    $this->fillField('Label', 'Test rule');
    $this->fillField('Machine-readable name', 'test_rule');
    $this->fillField('Description', 'This is a test description for a test reaction rule.');
    $this->fillField('React on event', 'rules_entity_insert:node');
    $this->pressButton('Save');
    
    /** @var \Drupal\Tests\WebAssert $assert */
    $assert = $this->assertSession();
    $assert->statusCodeEquals(200);
    $assert->pageTextContains('Reaction rule Test rule has been created.');
    $this->clickLink('Add condition');
    $this->fillField('Condition', 'rules_node_is_promoted');
    $this->pressButton('Continue');
    $this->fillField('context_definitions[node][setting]', 'node');
    $this->pressButton('Save');
    $assert->statusCodeEquals(200);
    $assert->pageTextContains('You have unsaved changes.');
    $this->pressButton('Save');
    $assert->pageTextContains('Reaction rule Test rule has been updated. ');
}