Skip to content

Instantly share code, notes, and snippets.

@alnutile
Created November 2, 2015 12:34
Show Gist options
  • Save alnutile/f6151280fc5c910556ee to your computer and use it in GitHub Desktop.
Save alnutile/f6151280fc5c910556ee to your computer and use it in GitHub Desktop.
example feature for test
@javascript
Feature: MetaMaster Manager Tool
As a Campaign Manager
I can create, edit and activate a Meta Master
So we can have a new meta master as needed
Scenario: On the draft I can add Meta Data Types, Values, Validations and Remove these things
And I setup the world for Meta Master EU to make a draft to add and remove things
Given I login as "admin"
Then I should not see "Login"
Given I am on the MetaMaster Draft page
Then I can add a new Meta Data type with values and validations
And I can set defaults and remove Meta Data values
And I can remove the Meta Data Types
<?php
/**
* @Then I can add a new Meta Data type with values and validations
*/
public function iCanAddANewMetaDataTypeWithValuesAndValidations()
{
try
{
//Name Version
$this->fillField("version", "Behat Test Master Meta EU");
//Text Field
$this->pressButton("add-new-meta-data-type-button");
$this->fillField("name", "Behat Test Text Field");
$this->clickLink("Text Input");
$this->iWait();
$this->iWaitToSeeText("This will create a Text field type");
$this->checkOption("Required");
$this->pressButton("Create");
$this->iWaitForSeconds(4);
$this->assertPageContainsText("MetaData Type: Behat Test Text Field");
//add validation
$this->iPressTheXpath('//*[@id="well-behat-test-text-field"]/div/div[1]/div/div[1]/ul/li[2]/i');
$this->iWaitForSeconds(4);
$this->assertPageContainsText("Validation Options");
$this->fillField("max-value-field", "46");
$this->fillField("min-value-field", "7");
$this->pressButton("Create");
$this->iWaitForSeconds(4);
$this->assertPageContainsText("max:46|min:7");
//Select List
$this->pressButton("add-new-meta-data-type-button");
$this->fillField("name", "Behat Test Select List");
$this->clickLink("Select List");
$this->iWait();
$this->iWaitToSeeText("This will create a Select field type");
$this->checkOption("Required");
$this->pressButton("Create");
$this->iWaitForSeconds(4);
$this->assertPageContainsText("MetaData Type: Behat Test Select List");
//add values
$this->fillField("add-value-behat-test-select-list-field", "Behat Value 01");
$this->pressButton("add-value-behat-test-select-list-button");
$this->iWait();
$this->assertPageContainsText("Behat Value 01");
$this->fillField("add-value-behat-test-select-list-field", "Behat Value 02");
$this->pressButton("add-value-behat-test-select-list-button");
$this->iWait();
$this->assertPageContainsText("Behat Value 02");
} catch(\Exception $e)
{
throw new \Exception(sprintf("Could not add new meta data type %s line %d", $e->getMessage(), $e->getLine()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment