You are here

public function FeatureContext::whenIGenerateANode in Pantheon Advanced Page Cache 8

@When a generate a :type node

1 call to FeatureContext::whenIGenerateANode()
FeatureContext::whenIGenerateSomeNodes in tests/behat/helper_classes/Contexts/FeatureContext.php
@Given there are some :type nodes

File

tests/behat/helper_classes/Contexts/FeatureContext.php, line 62

Class

FeatureContext
Define application features from the specific context.

Namespace

PantheonSystems\CDNBehatHelpers\Contexts

Code

public function whenIGenerateANode($type) {

  // Create a node with an HTML form for faster process.
  // Significantly faster than make nodes over SSH/Drush.
  // Depends on a node type with no required fields beyond title.
  $random_node_title = "Random Node Title: " . rand();
  $this->minkContext
    ->visit('node/add/' . $type);
  $this->minkContext
    ->fillField('Title', $random_node_title);
  $this->minkContext
    ->pressButton('Save');
  $this->minkContext
    ->assertTextVisible($random_node_title);

  // @todo, remove this sleep if possible. Added because this faster node generation results in
  // The tests running faster than the CDN can clear cache.
  sleep(2);

  // It seems that sessions get set when adding nodes but are removed
  // on the next page load. So load another page before caching
  // behavior is set.
  $this->minkContext
    ->visit('/');
}