You are here

public function SchedulerContext::addInSecondsFromNow in Lightning Workflow 8.3

Same name and namespace in other branches
  1. 8.2 modules/lightning_scheduler/tests/contexts/SchedulerContext.behat.inc \Acquia\LightningExtension\Context\SchedulerContext::addInSecondsFromNow()

Schedules a transition to take place a certain number of seconds from now.

@When I schedule a transition to :state in :n second(s)

Parameters

string $state: The destination state of the transition.

int $n: The number of seconds.

File

modules/lightning_scheduler/tests/contexts/SchedulerContext.behat.inc, line 52

Class

SchedulerContext
Contains step definitions for interacting with the Lightning Scheduler UI.

Namespace

Acquia\LightningExtension\Context

Code

public function addInSecondsFromNow($state, $n) {
  $page = $this
    ->getSession()
    ->getPage();
  try {
    $page
      ->clickLink('add another');
  } catch (ElementNotFoundException $e) {
    $page
      ->clickLink('Schedule a status change');
  }
  $page
    ->selectFieldOption('Scheduled moderation state', $state);

  // These date and time formats will only work Chrome via WebDriver.
  $page
    ->fillField('Scheduled transition date', date('m-d-Y', $this->startTime + $n));
  $page
    ->fillField('Scheduled transition time', date('g:i:sA', $this->startTime + $n));
  $page
    ->pressButton('Save transition');
}