public function AutosaveFormTest::testAutosaveInExistingEntity in Thunder 8.3
Same name and namespace in other branches
- 8.5 tests/src/FunctionalJavascript/Integration/AutosaveFormTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\AutosaveFormTest::testAutosaveInExistingEntity()
- 8.4 tests/src/FunctionalJavascript/Integration/AutosaveFormTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\AutosaveFormTest::testAutosaveInExistingEntity()
- 6.2.x tests/src/FunctionalJavascript/Integration/AutosaveFormTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\AutosaveFormTest::testAutosaveInExistingEntity()
- 6.0.x tests/src/FunctionalJavascript/Integration/AutosaveFormTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\AutosaveFormTest::testAutosaveInExistingEntity()
- 6.1.x tests/src/FunctionalJavascript/Integration/AutosaveFormTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\AutosaveFormTest::testAutosaveInExistingEntity()
Tests the autosave functionality in an existing article.
File
- tests/
src/ FunctionalJavascript/ Integration/ AutosaveFormTest.php, line 35
Class
- AutosaveFormTest
- Tests the autosave support for nodes in Thunder.
Namespace
Drupal\Tests\thunder\FunctionalJavascript\IntegrationCode
public function testAutosaveInExistingEntity() {
$this
->drupalGet('node/7/edit');
$page = $this
->getSession()
->getPage();
// Make some changes.
$this
->makeFormChanges();
// Reload the page.
$this
->drupalGet('node/7/edit');
// Reject the changes.
$this
->pressRejectButton();
$this
->assertEquals([
5,
], $page
->findField('field_tags[]')
->getValue());
$this
->assertEquals('Come to DrupalCon New Orleans', $page
->findField('title[0][value]')
->getValue());
$this
->assertEmpty($page
->find('css', '.form-item-field-paragraphs-4-subform-field-text-0-value'));
// Make changes again.
$this
->makeFormChanges();
// Reload the page.
$this
->drupalGet('node/7/edit');
$this
->pressRestoreButton();
$this
->assertEquals([
5,
'$ID:Tag2',
], $page
->findField('field_tags[]')
->getValue());
$this
->assertEquals('New title', $page
->findField('title[0][value]')
->getValue());
$this
->assertNotEmpty($page
->find('css', '.form-item-field-paragraphs-4-subform-field-text-0-value'));
// Save the article.
$this
->clickSave();
// Check some things.
$this
->assertSession()
->pageTextContains('This post is unpublished and will be published');
$this
->assertSession()
->pageTextContains('Awesome quote');
}