You are here

public function VarbaseWorkflowTest::testCheckVarbaseWorkflowModeration in Varbase Workflow 2.0.x

Check Varbase Workflow moderation.

File

tests/src/FunctionalJavascript/VarbaseWorkflowTest.php, line 63

Class

VarbaseWorkflowTest
Tests Varbase Workflow moderation test.

Namespace

Drupal\Tests\varbase_workflow\FunctionalJavascript

Code

public function testCheckVarbaseWorkflowModeration() {

  // Given that the root super user was logged in to the site.
  $this
    ->drupalLogin($this->rootUser);
  $this
    ->drupalGet('admin/config/workflow/workflows');
  $this
    ->assertSession()
    ->pageTextContains('Simple');
  $this
    ->assertSession()
    ->pageTextContains('Editorial');

  // Create a testing content type.
  $this
    ->drupalGet('admin/structure/types/add');
  $this
    ->assertSession()
    ->pageTextContains('Add content type');
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->fillField('name', 'Post');
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $edit_type_button = $this
    ->assertSession()
    ->waitForElementVisible('css', '#edit-name-machine-name-suffix .link');
  $edit_type_button
    ->click();
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $page
    ->fillField('type', 'post');
  $submit = $page
    ->findButton('op');
  $submit
    ->click();
  drupal_flush_all_caches();
  $this
    ->drupalGet('admin/config/workflow/workflows/manage/varbase_editorial_workflow');
  $this
    ->assertSession()
    ->pageTextContains('Edit Editorial workflow');
  $this
    ->assertSession()
    ->pageTextContains('Draft');
  $this
    ->assertSession()
    ->pageTextContains('In review');
  $this
    ->assertSession()
    ->pageTextContains('Published');
  $this
    ->assertSession()
    ->pageTextContains('Archived / Unpublished');
  $this
    ->assertSession()
    ->pageTextContains('Create new draft');
  $this
    ->assertSession()
    ->pageTextContains('Send to review');
  $this
    ->assertSession()
    ->pageTextContains('Publish');
  $this
    ->assertSession()
    ->pageTextContains('Archive / Unpublish');
  $this
    ->assertSession()
    ->pageTextContains('Restore from archive');
  $this
    ->assertSession()
    ->pageTextNotContains('Post');
  $this
    ->drupalGet('admin/config/workflow/workflows/manage/varbase_simple_workflow');
  $this
    ->assertSession()
    ->pageTextContains('Draft');
  $this
    ->assertSession()
    ->pageTextNotContains('In review');
  $this
    ->assertSession()
    ->pageTextContains('Published');
  $this
    ->assertSession()
    ->pageTextContains('Archived / Unpublished');
  $this
    ->assertSession()
    ->pageTextContains('Create new draft');
  $this
    ->assertSession()
    ->pageTextNotContains('Send to review');
  $this
    ->assertSession()
    ->pageTextContains('Publish');
  $this
    ->assertSession()
    ->pageTextContains('Archive / Unpublish');
  $this
    ->assertSession()
    ->pageTextContains('Restore from archive');
  $this
    ->assertSession()
    ->pageTextContains('Post');
}