public function AutosaveTest::testAutosaveIntegration in Lightning Workflow 8.3
Tests that work in progress is autosaved and can be restored.
File
- tests/
src/ FunctionalJavascript/ AutosaveTest.php, line 50
Class
- AutosaveTest
- Tests Lightning Workflow's integration with Autosave Form.
Namespace
Drupal\Tests\lightning_workflow\FunctionalJavascriptCode
public function testAutosaveIntegration() {
$assert_session = $this
->assertSession();
$page = $this
->getSession()
->getPage();
$account = $this
->drupalCreateUser([
'access content overview',
'edit any moderated content',
'use editorial transition create_new_draft',
]);
$this
->drupalLogin($account);
$node = $this
->drupalCreateNode([
'type' => 'moderated',
'moderation_state' => 'published',
]);
$this
->drupalGet('/admin/content');
$page
->clickLink($node
->getTitle());
$assert_session
->elementExists('named', [
'link',
'edit-form',
])
->click();
// Wait for an initial autosave before making any changes.
$this
->waitForAutosave();
$page
->fillField('Title', 'Testing');
$this
->waitForAutosave();
$page
->clickLink('View');
$assert_session
->elementExists('named', [
'link',
'edit-form',
])
->click();
$button = $assert_session
->waitForButton('Resume editing');
$this
->assertNotEmpty($button);
$button
->press();
$assert_session
->fieldValueEquals('Title', 'Testing');
}