Skip to content

Commit

Permalink
Merge pull request #34 from mnocon/ezee-1517-content-fly-scenarios
Browse files Browse the repository at this point in the history
EZEE-1517: Add new scenarios for content-on-the-fly-prototype-bundle bundle
  • Loading branch information
lserwatka authored Jul 19, 2017
2 parents b52400f + f3b143b commit c764919
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .ez.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
v: 0

# This is a bundle, so we need to specify info for meta repo
meta:
repo: "git@github.com:ezsystems/ezplatform-ee-demo.git"
branch: "master"
self_alias: "1.10.x-dev"

# ci
integrate:
command: "bin/behat"
matrix:
# Run 'common' tagged behat scenarios on ezplatform-ee-demo install
- {arguments: "-v --profile contentOnTheFly --strict", install: "demo"}
9 changes: 9 additions & 0 deletions behat_suites.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
contentOnTheFly:
suites:
Standard:
paths: [ vendor/ezsystems/content-on-the-fly-prototype/bundle/Features ]
filters:
tags: common
contexts:
- EzSystems\FlexWorkflowBundle\Features\Context\FlexWf
- EzSystems\EzContentOnTheFlyBundle\Features\Context\ContentOnTheFlyContext
70 changes: 70 additions & 0 deletions bundle/Features/ContentOnTheFly.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Feature: Basic interactions for ContentOnTheFly

Background:
Given I am logged in as admin on StudioUI

@javascript @common @contentOnTheFly
Scenario: I can create Content directly from the Dashboard
Given I start creating content from the Dashboard
And I create Article from Content group in "Home/Places & Tastes/Tastes" location
And I fill in basic Article data
When I click the edit action bar button Publish
Then I can create another content

@javascript @common @contentOnTheFly @flex
Scenario: I can create Content directly from the Dashboard and send it for review
Given I start creating content from the Dashboard
And I create Article from Content group in "/Media" location
And I fill in basic Article data
And I make a modification to Title and send it for review
And I select reviewer "Yura Rajzer"
When I confirm sending for review
Then I can create another content

@javascript @common @contentOnTheFly
Scenario: I can create Content from the Universal Discovery widget
Given I click on the navigation zone "Content"
And I click on the navigation item "Content structure"
And I click on the discovery bar button "Content browse"
And I start creating content from the Universal Discovery widget
And I create Gallery from Media group in "/Media" location
And I fill in Name with "Gallery Title"
When I click the edit action bar button Publish
Then I can create another content

@javascript @common @contentOnTheFly
Scenario: I can create embedded Content while creating another Content
Given I start creating content from the Dashboard
And I select Article from the Content group
And I finish configuration
And I choose Embed for the Summary block
And I start creating content from the Universal Discovery widget
And I create Article from Content group in "Home/Places & Tastes" location
And I fill in basic Article data
And I click the edit action bar button Publish
And I see embedded content in Summary section
When I click the edit action bar button Publish
Then I can create another content

@javascript @common @contentOnTheFly
Scenario: I can create embedded Content while configuring a Block
Given I go to Studio creator and prepare for "Embed" block
And I set up the Embed block element in the landing page zone first
And I click on the pop-up form button Content
And I start creating content from the Universal Discovery widget
And I create "Blog post" from Content group in "Home/Places & Tastes" location
And I fill in basic Blog post data
And I click the edit action bar button Publish
When I submit the block pop-up form
Then I see the Embed block with Article and its preview in first zone

@javascript @fullRegression @contentOnTheFly
Scenario: I can change Content Type after selecting it
Given I start creating content from the Dashboard
And I select Article from the Content group
And I change Content Type to Gallery from Media group
And I select "/Media" from Suggested Locations
And I finish configuration
And I fill in Name with "Gallery Title"
When I click the edit action bar button Publish
Then I can create another content
136 changes: 136 additions & 0 deletions bundle/Features/Context/ContentOnTheFlyContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace EzSystems\EzContentOnTheFlyBundle\Features\Context;

use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;

class ContentOnTheFlyContext implements Context
{
/** @var \EzSystems\FlexWorkflowBundle\Features\Context\FlexWf */
private $flexWfContext;

/** @var \EzSystems\EzContentOnTheFlyBundle\Features\Context\ContentOnTheFlyPopup */
private $contentOnTheFly;

/** @BeforeScenario
*
* @param BeforeScenarioScope $scope Behat scope
*/
public function getFlexWfContext(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$this->flexWfContext = $environment->getContext('EzSystems\FlexWorkflowBundle\Features\Context\FlexWf');
}

/**
* @Given I start creating content from the Dashboard
*
* Click the "Create" button when ot the Dashboard
*/
public function startCreatingContentFromDashboard()
{
$parentSelector = ContentOnTheFlyPopup::getParentSelector('Dashboard');
$this->contentOnTheFly = new ContentOnTheFlyPopup($this->flexWfContext, $parentSelector);
$this->flexWfContext->clickElementByText('CREATE', 'button');
}

/**
* @Given I start creating content from the Universal Discovery widget
*
* Switches to embedded Content On The Fly window when UDW is open
*/
public function startCreatingContentFromUDW()
{
$parentSelector = ContentOnTheFlyPopup::getParentSelector('UDW');
$this->contentOnTheFly = new ContentOnTheFlyPopup($this->flexWfContext, $parentSelector);
$this->flexWfContext->switchContentBrowserTab('Create');
}

/**
* @Given I create :contentType from :contentGroup group in :location location
*
* Selects Content Type and location (if available - from Suggested locations) in open Content On The Fly Popup
*
* @param string $contentGroup Name of the Content Group to which Content Type belongs
* @param string $contentType Name of the Content Type
* @param string $location Location of the content
*/
public function createNewContentInLocation($contentGroup, $contentType, $location)
{
$this->chooseContentType($contentGroup, $contentType);
if (in_array($location, $this->contentOnTheFly->displayedSuggestedLocations)) {
$this->selectFromSuggestedLocation($location);
} else {
$this->selectLocation($location);
}
$this->finishConfiguration();
}

/**
* @Given I select :contentType from the :contentGroup group
*
* Selects given Content Type (checks Content Group if needed)
*
* @param string $contentGroup Name of the Content Group to which Content Type belongs
* @param string $contentType Name of the Content Type
*/
public function chooseContentType($contentGroup, $contentType)
{
$this->contentOnTheFly->chooseContentType($contentGroup, $contentType);
$this->contentOnTheFly->clickButton('next');
}

/**
* @Given I select :location from Suggested Locations
*
* Select a location from available suggested Locations
*
* @param string $location Location to select
*/
public function selectFromSuggestedLocation($location)
{
$this->contentOnTheFly->selectSuggestedLocation($location);
}

/**
* @Given I change Content Type to :contentType from :contentGroup group
*
* Undo selecting a Content Type and select another one
*
* @param string $contentGroup Name of the Content Group to which Content Type belongs
* @param string $contentType Name of the Content Type to select
*/
public function changeContentType($contentGroup, $contentType)
{
$this->contentOnTheFly->removeContentType();
$this->contentOnTheFly->chooseContentType($contentGroup, $contentType);
$this->contentOnTheFly->clickButton('next');
}

/**
* @Given I select :location location
*
* Select given location using UDW
*
* @param string $location Location to select
*/
public function selectLocation($location)
{
$this->contentOnTheFly->selectLocation($location);
}

/**
* @Given I finish configuration
*
* Clicks "Finish" button
*/
public function finishConfiguration()
{
$this->contentOnTheFly->waitUntilSelectedLocationIsDisplayed($this->contentOnTheFly->selectedLocation);
$this->contentOnTheFly->clickButton('finish');
}
}
Loading

0 comments on commit c764919

Please sign in to comment.