From 57113edd7745ea621cd40314b29e8a18ac7230a5 Mon Sep 17 00:00:00 2001
From: Rajab Natshah <rajabn@gmail.com>
Date: Tue, 25 Oct 2016 23:53:50 +0300
Subject: [PATCH] Issue #2821881: Updated [Varbase 8.x-4.x] profile: Updated
 the composer.json to have working patches in the travis ci test. + Have a
 better testing features with init-apply-cleanup parts.

---
 .travis.yml                                   |  11 +-
 composer.json                                 |  93 ++++++++--------
 ...tyqueue-testing-content-and-config.feature | 100 ++++++++++++++++++
 ...yqueue-reverse-order-in-admin-view.feature |  38 +++++++
 ...01-cleanup-after-entityqueue-tests.feature |  74 +++++++++++++
 5 files changed, 265 insertions(+), 51 deletions(-)
 create mode 100644 tests/features/varbase/step1-init-tests/modules/contrib/entityqueue/01-add-default-entityqueue-testing-content-and-config.feature
 create mode 100644 tests/features/varbase/step2-apply-tests/modules/contrib/entityqueue/01-entityqueue-reverse-order-in-admin-view.feature
 create mode 100644 tests/features/varbase/step3-cleanup-tests/modules/contrib/entityqueue/01-cleanup-after-entityqueue-tests.feature

diff --git a/.travis.yml b/.travis.yml
index 03a68d76..63beab76 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,8 +6,8 @@ cache:
     - "$HOME/.composer/cache"
     - "$HOME/.drush/cache"
     - "$HOME/.npm"
+    
 php:
-  - 5.5
   - 5.6
   - 7.0
 env:
@@ -34,10 +34,10 @@ mysql:
   encoding: utf8
 
 before_install:
+  - phpenv config-rm xdebug.ini
+  - phpenv rehash
   - composer self-update
   - composer --version
-  - composer remove drupal/core
-  - composer require drupal/drupal 8.2.1
 
 
 install:
@@ -60,7 +60,7 @@ install:
   - echo 'sendmail_path = /bin/true' >> drupal.php.ini;
   - phpenv config-add drupal.php.ini
   - phpenv rehash
-  
+   
   # Configure the display.
   - export DISPLAY=:0
   - sh -e /etc/init.d/xvfb start
@@ -84,6 +84,7 @@ install:
 
 before_script:
   - cd docroot
+   
   - drush runserver --default-server=builtin 8080 &>/dev/null &
   - sleep 5
    
@@ -91,7 +92,7 @@ before_script:
   # composer drupal-update -vvv
   
   # Install entityqueue module.
-  - drush en entityqueue -y
+  - drush -y en entityqueue -vvv
 
 script:
   - cd ./profiles/varbase
diff --git a/composer.json b/composer.json
index 94b7196a..99292dbe 100644
--- a/composer.json
+++ b/composer.json
@@ -8,6 +8,7 @@
   "require-dev": {
     "drush/drush": "^9.0",
     "drupal/drupal-extension": "^3.2",
+    "drupal-composer/drupal-scaffold": "^2.0.0",
     "jakoch/phantomjs-installer": "1.9.8",
     "behat/behat": "^3.0",
     "drupal/coder": "8.*",
@@ -35,56 +36,56 @@
   ],
   "scripts": {
       "post-install-cmd": [
-        "@composer drupal-scaffold",
-        "./bin/phing push"
+          "@composer drupal-scaffold",
+          "./bin/phing push"
       ],
       "post-update-cmd": [
-        "./bin/phing push"
+          "./bin/phing push"
       ],
       "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold"
   },
   "extra": {
-     "installer-paths": {
-         "docroot": [
-            "drupal/drupal"
-         ],
-         "modules/contrib/{$name}": [
-            "type:drupal-module"
-         ]
-     }
-   },
-  "patches": {
-    "drupal/panels": {
-      "Issue #2793801 : Allow modules to influence the IPE tempstore ID":
-      "https://www.drupal.org/files/issues/2793801-9.patch"
-    },
-    "drupal/panelizer": {
-      "Issue #2747739 : [panelizer] Create and host mega patches until the Panels ecosystem stabilizes and releases":
-      "https://www.drupal.org/files/issues/panelizer--alpha2-1ddfa61--2747739-5.patch",
-      "Issue #2701349 : Generate new UUIDs for displays when switching from default to field storage":
-      "https://www.drupal.org/files/issues/2701349-2.patch",
-      "Issue #2700597 : Explicitly set the Panels IPE URL root when saving in Panelizer":
-      "https://www.drupal.org/files/issues/panelizer-ipe-url-root-handling.patch",
-      "Issue #2664682 : Implement admin UI for editing Panelizer defaults":
-      "https://www.drupal.org/files/issues/2664682-55.patch",
-      "Issue #2793841 : Properly integrate with Panels IPE":
-      "https://www.drupal.org/files/issues/panelizer-panels-ipe-tempstore-id.patch"
-    },
-    "drupal/metatag": {
-      "Issue #2786795 : DrupalConsole integration breaks Drush":
-      "https://www.drupal.org/files/issues/metatag-deactivate_drupalconsole_services_0.patch"
-    },
-    "drupal/entityqueue": {
-      "Issue #2478685 by josebc: Reverse order in admin view option":
-      "https://www.drupal.org/files/issues/entityqueue-reverse_order_in_admin-2478685-3.patch",
-      "Issue #2821631 by josebc: Queue is always required when using  Limit to a specific entity queue":
-      "https://www.drupal.org/files/issues/entityqueue-moved_queue_condition_to_join-2821631-5.patch"
-    },
-    "drush/drush": {
-      "Adding composer.json support to make-convert command":
-      "https://github.com/drush-ops/drush/commit/ce82b946d49b09cd33da5ca84feb24a6c35f8f8e.patch",
-      "The batch table may not exist by the time _drush_backend_batch_process() is called in 8.x-1.x":
-      "https://github.com/drush-ops/drush/commit/c389aebb7d3e26ff0f544684d8b3ec3528107e55.diff"
+      "installer-paths": {
+          "docroot/core": [
+              "drupal/core"
+          ],
+          "modules/contrib/{$name}": [
+              "type:drupal-module"
+          ]
+      },
+    "patches": {
+      "drupal/panels": {
+        "Issue #2793801 : Allow modules to influence the IPE tempstore ID":
+        "https://www.drupal.org/files/issues/2793801-9.patch"
+      },
+      "drupal/panelizer": {
+        "Issue #2747739 : [panelizer] Create and host mega patches until the Panels ecosystem stabilizes and releases":
+        "https://www.drupal.org/files/issues/panelizer--alpha2-1ddfa61--2747739-5.patch",
+        "Issue #2701349 : Generate new UUIDs for displays when switching from default to field storage":
+        "https://www.drupal.org/files/issues/2701349-2.patch",
+        "Issue #2700597 : Explicitly set the Panels IPE URL root when saving in Panelizer":
+        "https://www.drupal.org/files/issues/panelizer-ipe-url-root-handling.patch",
+        "Issue #2664682 : Implement admin UI for editing Panelizer defaults":
+        "https://www.drupal.org/files/issues/2664682-55.patch",
+        "Issue #2793841 : Properly integrate with Panels IPE":
+        "https://www.drupal.org/files/issues/panelizer-panels-ipe-tempstore-id.patch"
+      },
+      "drupal/metatag": {
+        "Issue #2786795 : DrupalConsole integration breaks Drush":
+        "https://www.drupal.org/files/issues/metatag-deactivate_drupalconsole_services_0.patch"
+      },
+      "drupal/entityqueue": {
+        "Issue #2478685 by josebc: Reverse order in admin view option":
+        "https://www.drupal.org/files/issues/entityqueue-reverse_order_in_admin-2478685-3.patch",
+        "Issue #2821631 by josebc: Queue is always required when using  Limit to a specific entity queue":
+        "https://www.drupal.org/files/issues/entityqueue-moved_queue_condition_to_join-2821631-5.patch"
+      },
+      "drush/drush": {
+        "Adding composer.json support to make-convert command":
+        "https://github.com/drush-ops/drush/commit/ce82b946d49b09cd33da5ca84feb24a6c35f8f8e.patch",
+        "The batch table may not exist by the time _drush_backend_batch_process() is called in 8.x-1.x":
+        "https://github.com/drush-ops/drush/commit/c389aebb7d3e26ff0f544684d8b3ec3528107e55.diff"
+      }
     }
   },
   "require": {
@@ -121,7 +122,7 @@
     "drupal/media_entity_image": "8.1.2",
     "drupal/media_entity_audio": "8.1.0-beta3",
     "drupal/video_embed_field": "8.1.3",
-    "drupal/entityqueue": "dev-8.x-1.x#0359af5f0a229b61b46b2944d09c06739a52da5c",
+    "drupal/entityqueue": "8.1.x-dev#0359af5f0a229b61b46b2944d09c06739a52da5c",
     
     "drupal/pathauto": "8.1.0-beta1",
     "drupal/redirect": "8.1.0-alpha1",
@@ -137,4 +138,4 @@
     
     "drupal/varbase_editor": "8.4.1"
   }
-}
+}
\ No newline at end of file
diff --git a/tests/features/varbase/step1-init-tests/modules/contrib/entityqueue/01-add-default-entityqueue-testing-content-and-config.feature b/tests/features/varbase/step1-init-tests/modules/contrib/entityqueue/01-add-default-entityqueue-testing-content-and-config.feature
new file mode 100644
index 00000000..2b85a126
--- /dev/null
+++ b/tests/features/varbase/step1-init-tests/modules/contrib/entityqueue/01-add-default-entityqueue-testing-content-and-config.feature
@@ -0,0 +1,100 @@
+Feature: Add default [entityqueue] module testing content and configuration.
+
+@javascript @check @local @development @staging @production
+Scenario: Check if we do have the eneityqueue module installed in the system.
+  Given I am a logged in user with the "webmaster" user
+   When I go to "/admin/modules"
+    And I wait
+   Then I should see "Entityqueue"
+    And the "Entityqueue" checkbox should be checked
+
+@javascript @init @local @development
+Scenario: Create "Test Content" content type.
+  Given I am a logged in user with the "webmaster" user
+   When I go to "/admin/structure/types/add"
+    And I wait
+   Then I should see "Add content type"
+   When I fill in "Test Content" for "Name"
+    And I fill in "test_content" for "Machine-readable name"
+    And I press "Save and manage fields"
+    And I wait
+   Then I should see "The content type Test Content has been added."
+
+@javascript @init @local @development
+Scenario: Add Entity Queue "Test Queue" and use "Test Content" content type.
+  Given I am a logged in user with the "webmaster" user
+   When I go to "/admin/structure/entityqueue"
+    And I wait
+   Then I should see "Add entity queue"
+   When I click "Add entity queue"
+    And I wait
+   Then I should see "Add Entity Queue"
+   When I fill in "Test Queue" for "Name"
+    And I fill in "test_queue" for "Machine-readable name"
+    And I check the box "Test Content"
+    And I press "Save"
+    And I wait
+   Then I should see "The entity queue Test Queue has been added."
+
+@javascript @init @local @development
+Scenario: Add Test content N1, N2, N3, N4 type of test content.
+  Given I am a logged in user with the "webmaster" user
+   When I go to "/node/add/test_content"
+    And I wait
+   Then I should see "Create Test Content"
+   When I fill in "Test content N1" for "Title"
+    And I fill in the rich text editor field "Body" with "Test content N1 Body"
+    And I press "Save"
+    And I wait
+   Then I should see "Test Content Test content N1 has been created."
+   
+   When I go to "/node/add/test_content"
+    And I wait
+   Then I should see "Create Test Content"
+   When I fill in "Test content N2" for "Title"
+    And I fill in the rich text editor field "Body" with "Test content N2 Body"
+    And I press "Save"
+    And I wait
+   Then I should see "Test Content Test content N2 has been created."
+
+   When I go to "/node/add/test_content"
+    And I wait
+   Then I should see "Create Test Content"
+   When I fill in "Test content N3" for "Title"
+    And I fill in the rich text editor field "Body" with "Test content N3 Body"
+    And I press "Save"
+    And I wait
+   Then I should see "Test Content Test content N3 has been created."
+
+
+
+@javascript @init @local @development
+Scenario: Add Test content N1, N2, N3, N4 nodes to the "Test Queue" entityqueue.
+  Given I am a logged in user with the "webmaster" user
+   When I go to "/admin/structure/entityqueue"
+    And I wait
+   Then I should see "Test Queue"
+
+  # Add "Test content N1" to the location #1 in the "Test Queue"
+   When I click "Edit items" in the "Test Queue" row
+    And I wait
+   Then I should see "Edit subqueue Test Queue"
+   When I fill in "Test content N1" for "items[0][target_id]"
+    And I press "Save"
+   Then I should see "1 items" in the "Test Queue" row
+
+  # Add "Test content N2" to the location #2 in the "Test Queue"
+   When I click "Edit items" in the "Test Queue" row
+    And I wait
+   Then I should see "Edit subqueue Test Queue"
+   When I fill in "Test content N2" for "items[1][target_id]"
+    And I press "Save"
+   Then I should see "2 items" in the "Test Queue" row
+
+  # Add "Test content N3" to the location #3 in the "Test Queue"
+   When I click "Edit items" in the "Test Queue" row
+    And I wait
+   Then I should see "Edit subqueue Test Queue"
+   When I fill in "Test content N3" for "items[2][target_id]"
+    And I press "Save"
+   Then I should see "3 items" in the "Test Queue" row
\ No newline at end of file
diff --git a/tests/features/varbase/step2-apply-tests/modules/contrib/entityqueue/01-entityqueue-reverse-order-in-admin-view.feature b/tests/features/varbase/step2-apply-tests/modules/contrib/entityqueue/01-entityqueue-reverse-order-in-admin-view.feature
new file mode 100644
index 00000000..94939e3a
--- /dev/null
+++ b/tests/features/varbase/step2-apply-tests/modules/contrib/entityqueue/01-entityqueue-reverse-order-in-admin-view.feature
@@ -0,0 +1,38 @@
+Feature: Module Requirements - Standard Entity Queue Management - Have the option to Reverse order in admin view.
+As a logged in user with a permisstioto manage entityqueues 
+I well be able to view the order of entities in entity queues in a reverse order.
+So that they will have a flipped order at the front-end.
+
+@javascript @local @development
+Scenario: Check that Reverse order in admin view is working.
+  Given I am a logged in user with the "webmaster" user
+   When I go to "/admin/structure/entityqueue"
+    And I wait
+   Then I should see "Test Queue"
+   When I click "Edit items" in the "Test Queue" row
+    And I wait
+   Then I should see "Edit subqueue Test Queue"
+    And I should see "Test content N1" value in the "edit-items-0-target-id" input element
+    And I should see "Test content N2" value in the "edit-items-1-target-id" input element
+    And I should see "Test content N3" value in the "edit-items-2-target-id" input element
+
+   When I go to "/admin/structure/entityqueue/test_queue#edit-queue-settings"
+    And I wait
+   Then I should see "Edit Entity Queue"
+   When I click "Queue settings"
+    And I wait
+   Then I should see "Restrict this queue to a minimum of"
+    And I should see "Reverse order in admin view"
+   When I check the box "Reverse order in admin view"
+    And I press "Save"
+    And I wait
+   Then I should see "The entity queue Test Queue has been updated."
+   When I go to "/admin/structure/entityqueue"
+    And I wait
+   Then I should see "Test Queue"
+   When I click "Edit items" in the "Test Queue" row
+    And I wait
+   Then I should see "Edit subqueue Test Queue"
+    And I should see "Test content N3" value in the "edit-items-0-target-id" input element
+    And I should see "Test content N2" value in the "edit-items-1-target-id" input element
+    And I should see "Test content N1" value in the "edit-items-2-target-id" input element
\ No newline at end of file
diff --git a/tests/features/varbase/step3-cleanup-tests/modules/contrib/entityqueue/01-cleanup-after-entityqueue-tests.feature b/tests/features/varbase/step3-cleanup-tests/modules/contrib/entityqueue/01-cleanup-after-entityqueue-tests.feature
new file mode 100644
index 00000000..db0036f6
--- /dev/null
+++ b/tests/features/varbase/step3-cleanup-tests/modules/contrib/entityqueue/01-cleanup-after-entityqueue-tests.feature
@@ -0,0 +1,74 @@
+Feature: Cleanup after [entityqueue] module tests.
+
+@javascript @cleanup @local @development
+Scenario: Delete Test content N1, N2, N3, N4 type of test content.
+  Given I am a logged in user with the "webmaster" user
+   When I go to "/admin/content"
+    And I wait
+   Then I should see "Content"
+   When I fill in "Test content N1" for "Title"
+    And I press "Filter"
+    And I wait
+   Then I should see "Test content N1"
+   When I click "Edit" in the "Test content N1" row
+    And I wait
+   Then I should see "Edit Test Content Test content N1"
+   When I click "Delete"
+    And I wait
+   Then I should see "Are you sure you want to delete the content Test content N1?"
+   When I press "Delete"
+   Then I should see "The Test Content Test content N1 has been deleted."
+
+   When I go to "/admin/content"
+    And I wait
+   Then I should see "Content"
+   When I fill in "Test content N2" for "Title"
+    And I press "Filter"
+    And I wait
+   Then I should see "Test content N2"
+   When I click "Edit" in the "Test content N2" row
+    And I wait
+   Then I should see "Edit Test Content Test content N2"
+   When I click "Delete"
+    And I wait
+   Then I should see "Are you sure you want to delete the content Test content N2?"
+   When I press "Delete"
+   Then I should see "The Test Content Test content N2 has been deleted."
+
+   When I go to "/admin/content"
+    And I wait
+   Then I should see "Content"
+   When I fill in "Test content N3" for "Title"
+    And I press "Filter"
+    And I wait
+   Then I should see "Test content N3"
+   When I click "Edit" in the "Test content N3" row
+    And I wait
+   Then I should see "Edit Test Content Test content N3"
+   When I click "Delete"
+    And I wait
+   Then I should see "Are you sure you want to delete the content Test content N3?"
+   When I press "Delete"
+   Then I should see "The Test Content Test content N3 has been deleted."
+
+
+@javascript @cleanup @local @development
+Scenario: Delete Entity Queue "Test Queue".
+  Given I am a logged in user with the "webmaster" user
+   When I go to "/admin/structure/entityqueue/test_queue/delete"
+    And I wait
+   Then I should see "Are you sure you want to delete the entity queue Test Queue?"
+   When I press "Delete"
+    And I wait
+   Then I should see "The entity queue Test Queue has been deleted."
+
+
+@javascript @cleanup @local @development
+Scenario: Delete "Test Content" content type item
+  Given I am a logged in user with the "webmaster" user
+   When I go to "/admin/structure/types/manage/test_content/delete"
+    And I wait
+   Then I should see "Are you sure you want to delete the content type Test Content?"
+   When I press "Delete"
+    And I wait
+   Then I should see "The content type Test Content has been deleted."
-- 
GitLab