From 77be4868cbc3c34e584c354111dba42e63ac4e8a Mon Sep 17 00:00:00 2001
From: Rajab Natshah <rajabn@gmail.com>
Date: Mon, 23 Dec 2019 16:07:26 +0200
Subject: [PATCH] Issue #3099007: Add automated functional testing features for
 [Feature: Content Structure - Landing Pages with Layout Builder] and
 [Feature: Landing (Layout Builder) Pages - Check to add sections and choose
 layouts for sections]

---
 .travis.yml                                   |   2 +
 CHANGELOG.md                                  |   6 +-
 README.md                                     |   2 +-
 config/install/user.role.content_admin.yml    |   9 ++
 config/install/user.role.editor.yml           |   7 +-
 config/install/user.role.site_admin.yml       |  10 ++
 ...ng-page-layout-builder-permissions.feature |  59 +++++++++
 ...ns-and-choose-layouts-for-sections.feature | 116 ++++++++++++++++++
 8 files changed, 208 insertions(+), 3 deletions(-)
 create mode 100644 tests/features/varbase/step2-apply-tests/04-content-structure/04-07-landing-page-layout-builder-permissions.feature
 create mode 100644 tests/features/varbase/step2-apply-tests/04-content-structure/04-08-landing-page-layout-builder_check-to-add-sections-and-choose-layouts-for-sections.feature

diff --git a/.travis.yml b/.travis.yml
index 62028fd4..d59968e9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -121,6 +121,8 @@ install:
   - drush pm-enable social_auth_facebook --yes
   - drush pm-enable social_auth_twitter --yes
   - drush pm-enable social_auth_linkedin --yes
+  - drush pm-enable varbase_layout_builder --yes
+  - drush pm-enable vlplb --yes
   - drush config-set system.performance css.preprocess 0 --yes
   - drush config-set system.performance js.preprocess 0 --yes
   - drush config-set system.logging error_level all --yes
diff --git a/CHANGELOG.md b/CHANGELOG.md
index df163a7b..a534968d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,10 @@
 ### Added since Varbase 8.x-7.4:
 * Issue [#3099007](https://www.drupal.org/node/3099007):
                   Added [Varbase Layout Builder] component module
+* Issue [#3102723](https://www.drupal.org/node/3102723):
+                  Added the 3101791-8.patch for [Layout Builder Modal] module
+                  to fix an integration issue with [Layout Builder UX]
+                  to configure shortcut link to open with modal
 
 ### Changed since Varbase 8.x-7.4:
 * Issue [#3093424](https://www.drupal.org/node/3093424):
@@ -28,7 +32,7 @@
                   - Admins can create users and assign a role to them - to work
                   with Drupal 8.7.10 and Drupal 8.8.x
 * Issue [#3102415](https://www.drupal.org/node/3102415)
-                  by jedgar1mx
+                  by [jedgar1mx](https://www.drupal.org/u/jedgar1mx)
                  : Removed the 3034353-2.patch for [Social Auth Google] as it
                   was committed in 8.x-2.0 stable
 
diff --git a/README.md b/README.md
index 9a851f62..caf8e958 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![Build Status](https://travis-ci.org/Vardot/varbase.svg?branch=8.x-8.0)](https://travis-ci.org/Vardot/varbase/builds/627194163) Varbase 8.8.0
+[![Build Status](https://travis-ci.org/Vardot/varbase.svg?branch=8.x-8.0)](https://travis-ci.org/Vardot/varbase/builds/628645691) Varbase 8.8.0
 
 [![](https://www.drupal.org/files/styles/grid-3/public/project-images/Medium-Logo%20Color%20with%20padding.png)](https://www.drupal.org/project/varbase)
 
diff --git a/config/install/user.role.content_admin.yml b/config/install/user.role.content_admin.yml
index 0ac11964..3388cea4 100644
--- a/config/install/user.role.content_admin.yml
+++ b/config/install/user.role.content_admin.yml
@@ -36,6 +36,7 @@ permissions:
   - 'administer menu'
   - 'administer taxonomy'
   - 'change layouts in place editing'
+  - 'configure all landing_page_lb node layout overrides'
   - 'clone block entity'
   - 'clone block_content entity'
   - 'clone menu_link_content entity'
@@ -52,6 +53,7 @@ permissions:
   - 'create image media'
   - 'create instagram media'
   - 'create landing_page content'
+  - 'create landing_page_lb content'
   - 'create media'
   - 'create page content'
   - 'create remote_video media'
@@ -69,6 +71,7 @@ permissions:
   - 'delete any image media'
   - 'delete any instagram media'
   - 'delete any landing_page content'
+  - 'delete any landing_page_lb content'
   - 'delete any media'
   - 'delete any page content'
   - 'delete any remote_video media'
@@ -78,6 +81,7 @@ permissions:
   - 'delete any video media'
   - 'delete content translations'
   - 'delete landing_page revisions'
+  - 'delete landing_page_lb revisions'
   - 'delete media'
   - 'delete own audio media'
   - 'delete own episode content'
@@ -86,6 +90,7 @@ permissions:
   - 'delete own image media'
   - 'delete own instagram media'
   - 'delete own landing_page content'
+  - 'delete own landing_page_lb content'
   - 'delete own page content'
   - 'delete own remote_video media'
   - 'delete own tweet media'
@@ -104,6 +109,7 @@ permissions:
   - 'edit any image media'
   - 'edit any instagram media'
   - 'edit any landing_page content'
+  - 'edit any landing_page_lb content'
   - 'edit any page content'
   - 'edit any remote_video media'
   - 'edit any tweet media'
@@ -133,11 +139,13 @@ permissions:
   - 'revert all revisions'
   - 'revert faq revisions'
   - 'revert landing_page revisions'
+  - 'revert landing_page_lb revisions'
   - 'revert page revisions'
   - 'revert varbase_blog revisions'
   - 'revert varbase_heroslider_media revisions'
   - 'translate any entity'
   - 'translate landing_page node'
+  - 'translate landing_page_lb node'
   - 'translate page node'
   - 'update any media'
   - 'update content translations'
@@ -153,6 +161,7 @@ permissions:
   - 'view any paragraphs previewer'
   - 'view faq revisions'
   - 'view landing_page revisions'
+  - 'view landing_page_lb revisions'
   - 'view media'
   - 'view own unpublished content'
   - 'view page revisions'
diff --git a/config/install/user.role.editor.yml b/config/install/user.role.editor.yml
index 1525f477..b8b13d06 100644
--- a/config/install/user.role.editor.yml
+++ b/config/install/user.role.editor.yml
@@ -33,12 +33,14 @@ permissions:
   - 'clone page entity'
   - 'clone page_variant entity'
   - 'clone paragraph entity'
+  - 'configure all landing_page_lb node layout overrides'
   - 'create audio media'
   - 'create faq content'
   - 'create file media'
   - 'create image media'
   - 'create instagram media'
   - 'create landing_page content'
+  - 'create landing_page_lb content'
   - 'create media'
   - 'create page content'
   - 'create remote_video media'
@@ -63,6 +65,7 @@ permissions:
   - 'delete own image media'
   - 'delete own instagram media'
   - 'delete own landing_page content'
+  - 'delete own landing_page_lb content'
   - 'delete own page content'
   - 'delete own remote_video media'
   - 'delete own tweet media'
@@ -86,6 +89,7 @@ permissions:
   - 'edit own image media'
   - 'edit own instagram media'
   - 'edit own landing_page content'
+  - 'edit own landing_page_lb content'
   - 'edit own page content'
   - 'edit own remote_video media'
   - 'edit own tweet media'
@@ -108,10 +112,11 @@ permissions:
   - 'view all revisions'
   - 'view any paragraphs previewer'
   - 'view landing_page revisions'
+  - 'view landing_page_lb revisions'
   - 'view media'
   - 'view own unpublished content'
   - 'view page revisions'
   - 'view terms in blog_categories'
   - 'view terms in tags'
   - 'view the administration theme'
-  - 'view varbase_blog revisions'
+  - 'view varbase_blog revisions'
\ No newline at end of file
diff --git a/config/install/user.role.site_admin.yml b/config/install/user.role.site_admin.yml
index d8faaf24..e27e7586 100644
--- a/config/install/user.role.site_admin.yml
+++ b/config/install/user.role.site_admin.yml
@@ -69,6 +69,7 @@ permissions:
   - 'administer yoast seo'
   - 'assign roles'
   - 'change layouts in place editing'
+  - 'configure all landing_page_lb node layout overrides'
   - 'clone block entity'
   - 'clone block_content entity'
   - 'clone block_content_type entity'
@@ -96,6 +97,7 @@ permissions:
   - 'create image media'
   - 'create instagram media'
   - 'create landing_page content'
+  - 'create landing_page_lb content'
   - 'create media'
   - 'create page content'
   - 'create remote_video media'
@@ -111,6 +113,7 @@ permissions:
   - 'delete any image media'
   - 'delete any instagram media'
   - 'delete any landing_page content'
+  - 'delete any landing_page_lb content'
   - 'delete any media'
   - 'delete any page content'
   - 'delete any remote_video media'
@@ -120,6 +123,7 @@ permissions:
   - 'delete any video media'
   - 'delete content translations'
   - 'delete landing_page revisions'
+  - 'delete landing_page_lb revisions'
   - 'delete media'
   - 'delete own audio media'
   - 'delete own episode content'
@@ -128,6 +132,7 @@ permissions:
   - 'delete own image media'
   - 'delete own instagram media'
   - 'delete own landing_page content'
+  - 'delete own landing_page_lb content'
   - 'delete own page content'
   - 'delete own remote_video media'
   - 'delete own tweet media'
@@ -145,6 +150,7 @@ permissions:
   - 'edit any image media'
   - 'edit any instagram media'
   - 'edit any landing_page content'
+  - 'edit any landing_page_lb content'
   - 'edit any page content'
   - 'edit any remote_video media'
   - 'edit any tweet media'
@@ -156,6 +162,7 @@ permissions:
   - 'edit own image media'
   - 'edit own instagram media'
   - 'edit own landing_page content'
+  - 'edit own landing_page_lb content'
   - 'edit own page content'
   - 'edit own remote_video media'
   - 'edit own tweet media'
@@ -181,12 +188,14 @@ permissions:
   - 'revert all revisions'
   - 'revert faq revisions'
   - 'revert landing_page revisions'
+  - 'revert landing_page_lb revisions'
   - 'revert page revisions'
   - 'revert varbase_blog revisions'
   - 'revert varbase_heroslider_media revisions'
   - 'switch shortcut sets'
   - 'translate any entity'
   - 'translate landing_page node'
+  - 'translate landing_page_lb node'
   - 'translate page node'
   - 'update any media'
   - 'update content translations'
@@ -207,6 +216,7 @@ permissions:
   - 'view faq page'
   - 'view faq revisions'
   - 'view landing_page revisions'
+  - 'view landing_page_lb revisions'
   - 'view media'
   - 'view own unpublished content'
   - 'view page revisions'
diff --git a/tests/features/varbase/step2-apply-tests/04-content-structure/04-07-landing-page-layout-builder-permissions.feature b/tests/features/varbase/step2-apply-tests/04-content-structure/04-07-landing-page-layout-builder-permissions.feature
new file mode 100644
index 00000000..15fbd982
--- /dev/null
+++ b/tests/features/varbase/step2-apply-tests/04-content-structure/04-07-landing-page-layout-builder-permissions.feature
@@ -0,0 +1,59 @@
+Feature: Content Structure - Landing Pages with Layout Builder
+As a logged in user with a permission to manage Landing (Layout Builder) pages.
+I want to be able to add a "Landing page (Layout Builder)" which has got predefined set of layouts
+So that the "Landing page (Layout Builder)" will show up in the structured menu under its parent page
+
+  @javascript @local @development @staging @production
+  Scenario: Check if we do have the Landing page (Layout Builder) content type
+    Given I am a logged in user with the "webmaster" user
+     When I go to "/admin/structure/types"
+      And I wait
+     Then I should see "Landing page (Layout Builder)"
+
+  @javascript @local @development @staging @production
+  Scenario: Check that the Landing page (Layout Builder) content type has the layout fields
+    Given I am a logged in user with the "webmaster" user
+     When I go to "/admin/structure/types/manage/landing_page_lb/fields"
+      And I wait
+     Then I should see "layout_builder__layout"
+      And I should see "layout_selection"
+
+  @javascript @local @development @staging @production
+  Scenario: Check that an Anonymous users can not create a Landing page (Layout Builder)
+    Given I am an anonymous user
+     When I go to "/node/add/landing_page_lb"
+      And I wait
+     Then I should see "Access denied"
+      And I should see "You are not authorized to access this page."
+
+  @javascript @local @development @staging @production
+  Scenario: Check that an authenticated user can not create a Landing page (Layout Builder)
+    Given I am a logged in user with the "test_authenticated" user
+     When I go to "/node/add/landing_page_lb"
+      And I wait
+     Then I should see "Access denied"
+      And I should see "You are not authorized to access this page."
+
+  @javascript @local @development @staging @production
+  Scenario: Check that Editor users can create a Landing page (Layout Builder)
+    Given I am a logged in user with the "test_editor" user
+     When I go to "/node/add/landing_page_lb"
+      And I wait
+     Then I should not see "Access denied"
+      And I should not see "You are not authorized to access this page."
+
+  @javascript @local @development @staging @production
+  Scenario: Check that Content Admin users can create a Landing page (Layout Builder)
+    Given I am a logged in user with the "test_content_admin" user
+     When I go to "/node/add/landing_page_lb"
+      And I wait
+     Then I should not see "Access denied"
+      And I should not see "You are not authorized to access this page."
+
+  @javascript @local @development @staging @production
+  Scenario: Check that Site Admin users can create a Landing page (Layout Builder)
+    Given I am a logged in user with the "test_site_admin" user
+     When I go to "/node/add/landing_page_lb"
+      And I wait
+     Then I should not see "Access denied"
+      And I should not see "You are not authorized to access this page."
diff --git a/tests/features/varbase/step2-apply-tests/04-content-structure/04-08-landing-page-layout-builder_check-to-add-sections-and-choose-layouts-for-sections.feature b/tests/features/varbase/step2-apply-tests/04-content-structure/04-08-landing-page-layout-builder_check-to-add-sections-and-choose-layouts-for-sections.feature
new file mode 100644
index 00000000..2dbfce84
--- /dev/null
+++ b/tests/features/varbase/step2-apply-tests/04-content-structure/04-08-landing-page-layout-builder_check-to-add-sections-and-choose-layouts-for-sections.feature
@@ -0,0 +1,116 @@
+Feature: Landing (Layout Builder) Pages - Check to add sections and choose layouts for sections
+As a logged in user with a permission to mange Landing (Layout Builder) pages
+I want to be able to add sections with any layouts to the page
+So that the "Landing (Layout Builder) page" will show up having the listed section with their content
+
+  @javascript @local @development @staging @production
+  Scenario: Check if a user with a permission to manage Landing page (Layout Builder) content type can add sections with any layouts to the page
+    Given I am a logged in user with the "test_site_admin" user
+     When I go to "node/add/landing_page_lb"
+      And I wait
+     Then I should see "Create Landing page (Layout Builder)"
+     When I fill in "Full Width - No Background Color - Text only" for "Title"
+      And I fill in "Test Landing page (Layout Builder) description" for "Page description"
+      And I press "Save"
+      And I wait
+     Then I should see "Landing page (Layout Builder) Full Width - No Background Color - Text only has been created"
+      And I should see "Layout"
+     When I click "Layout"
+      And I wait
+     Then I should see "Edit layout for Full Width - No Background Color - Text only"
+#   Add Section 1 as one column
+     When I click "Add section"
+      And I wait for AJAX to finish
+     Then I should see "Choose a layout for this section"
+      And I should see "One column"
+      And I should see "Two column"
+      And I should see "Three column"
+      And I should see "Four column"
+     When I click "One column"
+      And I wait for AJAX to finish
+     Then I should see "Configure section"
+      And I should see "Width"
+      And I should see "Gutter"
+      And I should see "Background color"
+      And I should see "Background media"
+      And I should see "Edge to Edge Background"
+      And I should see "Classes"
+      And I should see "Use advanced instead"
+     When I press "Add section"
+      And I wait for AJAX to finish
+     Then I should see "Section 1"
+      And I should see "Add block in Section 1, Content region"
+#   Add Section 2 as Two column
+      When I click "Add section"
+       And I wait for AJAX to finish
+      Then I should see "Choose a layout for this section"
+       And I should see "One column"
+       And I should see "Two column"
+       And I should see "Three column"
+       And I should see "Four column"
+      When I click "Two column"
+       And I wait for AJAX to finish
+      Then I should see "Configure section"
+       And I should see "Width"
+       And I should see "Column Style 2"
+       And I should see "Gutter"
+       And I should see "Background color"
+       And I should see "Background media"
+       And I should see "Edge to Edge Background"
+       And I should see "Classes"
+       And I should see "Use advanced instead"
+      When I press "Add section"
+       And I wait for AJAX to finish
+      Then I should see "Section 2"
+       And I should see "Add block in Section 1, Left region"
+       And I should see "Add block in Section 1, Right region"
+#   Add Section 3 as Three column
+      When I click "Add section"
+       And I wait for AJAX to finish
+      Then I should see "Choose a layout for this section"
+       And I should see "One column"
+       And I should see "Two column"
+       And I should see "Three column"
+       And I should see "Four column"
+      When I click "Three column"
+       And I wait for AJAX to finish
+      Then I should see "Configure section"
+       And I should see "Width"
+       And I should see "Column Style 3"
+       And I should see "Gutter"
+       And I should see "Background color"
+       And I should see "Background media"
+       And I should see "Edge to Edge Background"
+       And I should see "Classes"
+       And I should see "Use advanced instead"
+      When I press "Add section"
+       And I wait for AJAX to finish
+      Then I should see "Section 3"
+       And I should see "Add block in Section 1, Left region"
+       And I should see "Add block in Section 1, Middle region"
+       And I should see "Add block in Section 1, Right region"
+#    Add Section 3 as Three column
+      When I click "Add section"
+       And I wait for AJAX to finish
+      Then I should see "Choose a layout for this section"
+       And I should see "One column"
+       And I should see "Two column"
+       And I should see "Three column"
+       And I should see "Four column"
+      When I click "Four column"
+       And I wait for AJAX to finish
+      Then I should see "Configure section"
+       And I should see "Width"
+       And I should see "Gutter"
+       And I should see "Background color"
+       And I should see "Background media"
+       And I should see "Edge to Edge Background"
+       And I should see "Classes"
+       And I should see "Use advanced instead"
+      When I press "Add section"
+       And I wait for AJAX to finish
+      Then I should see "Section 4"
+       And I should see "Add block in Section 1, First region"
+       And I should see "Add block in Section 1, Second region"
+       And I should see "Add block in Section 1, Third region"
+       And I should see "Add block in Section 1, Fourth region"
-- 
GitLab