From 58475f2af6c7d69a867b25ebde7599b565f490d5 Mon Sep 17 00:00:00 2001
From: Rajab Natshah <rajabn@gmail.com>
Date: Mon, 24 Jul 2017 10:15:51 +0300
Subject: [PATCH] Issue #2894493: Updated Varbase Scripts to work with varbase
 project

---
 scripts/apply-tests.sh            |  4 --
 scripts/check-tests.sh            |  4 --
 scripts/cleanup-tests.sh          |  4 --
 scripts/full-development-tests.sh |  4 --
 scripts/full-local-tests.sh       |  4 --
 scripts/full-production-tests.sh  |  4 --
 scripts/full-staging-tests.sh     |  4 --
 scripts/full-tests.sh             |  4 --
 scripts/init-tests.sh             |  4 --
 tests/README.md                   | 89 ++++++++++++++++++++++++++++++-
 10 files changed, 88 insertions(+), 37 deletions(-)
 delete mode 100644 scripts/apply-tests.sh
 delete mode 100644 scripts/check-tests.sh
 delete mode 100644 scripts/cleanup-tests.sh
 delete mode 100644 scripts/full-development-tests.sh
 delete mode 100644 scripts/full-local-tests.sh
 delete mode 100644 scripts/full-production-tests.sh
 delete mode 100644 scripts/full-staging-tests.sh
 delete mode 100644 scripts/full-tests.sh
 delete mode 100644 scripts/init-tests.sh

diff --git a/scripts/apply-tests.sh b/scripts/apply-tests.sh
deleted file mode 100644
index d2791769..00000000
--- a/scripts/apply-tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-echo "Varbase Apply tests";
-cd docroot/profiles/varbase;
-../../../bin/behat tests/features/varbase/step2-apply-tests --format pretty --out std  --format html  --out tests/reports/varbase-apply-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
diff --git a/scripts/check-tests.sh b/scripts/check-tests.sh
deleted file mode 100644
index 1f507dd8..00000000
--- a/scripts/check-tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-echo "Varbase check tests";
-cd docroot/profiles/varbase;
-../../../bin/behat tests/features/varbase --tags '@check' --format pretty --out std  --format html  --out tests/reports/varbase-check-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
diff --git a/scripts/cleanup-tests.sh b/scripts/cleanup-tests.sh
deleted file mode 100644
index 182acaf2..00000000
--- a/scripts/cleanup-tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-echo "Varbase Cleanup tests";
-cd docroot/profiles/varbase;
-../../../bin/behat tests/features/varbase/step3-cleanup-tests --format pretty --out std  --format html  --out tests/reports/varbase-cleanup-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
diff --git a/scripts/full-development-tests.sh b/scripts/full-development-tests.sh
deleted file mode 100644
index 8cf0d4fe..00000000
--- a/scripts/full-development-tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-echo "Varbase Full Development tests";
-cd docroot/profiles/varbase;
-../../../bin/behat tests/features/varbase --tags '@development' --format pretty --out std  --format html  --out tests/reports/varbase-full-development-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
diff --git a/scripts/full-local-tests.sh b/scripts/full-local-tests.sh
deleted file mode 100644
index 8309a3e5..00000000
--- a/scripts/full-local-tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-echo "Varbase Full local tests";
-cd docroot/profiles/varbase;
-../../../bin/behat tests/features/varbase --tags '@local' --format pretty --out std  --format html  --out tests/reports/varbase-full-local-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
diff --git a/scripts/full-production-tests.sh b/scripts/full-production-tests.sh
deleted file mode 100644
index 2a32aecf..00000000
--- a/scripts/full-production-tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-echo "Varbase Full Production tests";
-cd docroot/profiles/varbase;
-../../../bin/behat tests/features/varbase --tags '@production' --format pretty --out std  --format html  --out tests/reports/varbase-full-production-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
diff --git a/scripts/full-staging-tests.sh b/scripts/full-staging-tests.sh
deleted file mode 100644
index 08a2ae23..00000000
--- a/scripts/full-staging-tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-echo "Varbase Full Staging tests";
-cd docroot/profiles/varbase;
-../../../bin/behat tests/features/varbase --tags '@staging' --format pretty --out std  --format html  --out tests/reports/varbase-full-staging-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
diff --git a/scripts/full-tests.sh b/scripts/full-tests.sh
deleted file mode 100644
index 4ce8459d..00000000
--- a/scripts/full-tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-echo "Varbase Full tests";
-cd docroot/profiles/varbase;
-../../../bin/behat tests/features/varbase --format pretty --out std  --format html  --out tests/reports/varbase-full-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
diff --git a/scripts/init-tests.sh b/scripts/init-tests.sh
deleted file mode 100644
index 11bcc2d0..00000000
--- a/scripts/init-tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-echo "Varbase init tests";
-cd docroot/profiles/varbase;
-../../../bin/behat tests/features/varbase/step1-init-tests --format pretty --out std  --format html  --out tests/reports/varbase-init-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
diff --git a/tests/README.md b/tests/README.md
index f8ffec58..f4ec9442 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -11,8 +11,10 @@
 To test varbase 8.x-4.x in the right way you will need to build varbase using
 the composer.
 
+## Create a Varbase project with [Composer](https://getcomposer.org/download/):
+
 ```
-composer create-project Vardot/varbase-build:8.4.0-beta5 PROJECT_DIR_NAME --stability beta --no-interaction
+composer create-project vardot/varbase-project:8.4.x-dev PROJECT_DIR_NAME --stability dev --no-interaction
 ```
 
 --------------------------------------------------------------------------------
@@ -214,3 +216,88 @@ $ ../../../bin/behat -di
  varbase Install config file, as you can see in the following command.
 
    $ ../../../bin/behat --config=behat.varbase-install.yml tools/install-varbase/default-installation.feature
+
+# Automated testing
+To run the automated testing with behat you will need to change the [ wd_host and base_url ] settings in the
+[ behat.varbase.yml ] file to go with your project configuration and the selenium server.
+
+```
+    Behat\MinkExtension:
+      files_path: "%paths.base%/tests/assets/"
+      goutte: ~
+      selenium2:
+        wd_host: 127.0.0.1:4445/wd/hub
+        capabilities:
+          browser: 'firefox'
+          # browser: 'chrome'
+          # browser: 'phantomjs'
+          nativeEvents: true
+      base_url: 'http://127.0.0.1:8080'
+      browser_name: 'firefox'
+      # browser_name: 'chrome'
+      # browser_name: 'phantomjs'
+      javascript_session: selenium2
+```
+      
+Testing scenarios are tagged with the Behat tags of:
+
+@local = Local
+@development = Development server.
+@staging = Staging and testing server.
+@production = Production live server.
+
+So that we only run bin/behat --tags with the right tag for the environment.
+
+Run the varbase check tests. Only to check, without any changes to the website.
+```
+cd docroot/profiles/varbase;
+../../../bin/behat tests/features/varbase --tags '@check' --format pretty --out std  --format html  --out tests/reports/varbase-check-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
+```
+
+Run the varbase full local tests. which developers could test all scenarios in their local machine environment.
+```
+cd docroot/profiles/varbase;
+../../../bin/behat tests/features/varbase --tags '@local' --format pretty --out std  --format html  --out tests/reports/varbase-full-local-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
+```
+
+Run the varbase full development tests. which developers could test scenarios on the website at the development environment.
+```
+cd docroot/profiles/varbase;
+../../../bin/behat tests/features/varbase --tags '@development' --format pretty --out std  --format html  --out tests/reports/varbase-full-development-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
+```
+
+Run the varbase full staging tests. which developers could test scenarios on the website at the staging environment.
+```
+cd docroot/profiles/varbase;
+../../../bin/behat tests/features/varbase --tags '@staging' --format pretty --out std  --format html  --out tests/reports/varbase-full-staging-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
+```
+
+Run the varbase full production only tests. not to change anything with test scenarios on the production environment.
+```
+cd docroot/profiles/varbase;
+../../../bin/behat tests/features/varbase --tags '@production' --format pretty --out std  --format html  --out tests/reports/varbase-full-production-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
+```
+
+Run the varbase full tests. init, apply, then cleanup.
+```
+cd docroot/profiles/varbase;
+../../../bin/behat tests/features/varbase/step1-init-tests --format pretty --out std  --format html  --out tests/reports/varbase-init-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
+../../../bin/behat tests/features/varbase/step2-apply-tests --format pretty --out std  --format html  --out tests/reports/varbase-apply-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
+../../../bin/behat tests/features/varbase/step3-cleanup-tests --format pretty --out std  --format html  --out tests/reports/varbase-cleanup-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
+```
+
+Run the varbase full tests. Which equivalent to varbase-init-tests, varbase-apply-tests, varbase-cleanup-tests
+```
+cd docroot/profiles/varbase;
+../../../bin/behat tests/features/varbase --format pretty --out std  --format html  --out tests/reports/varbase-full-tests-report-$( date '+%Y-%m-%d_%H-%M-%S' );
+```
+
+We could run behat tests with this set
+Go to [ PROJECT_DIR_NAME/docroot/profiles/varbase ] in the terminal then you could run the following command:
+```
+$ ../../../bin/behat tests/features/varbase
+
+```
+
+Then you will be able to open the full report for the automated test in a web browser at the following path:
+[ PROJECT_DIR_NAME/docroot/profiles/varbase/tests/reports ]
-- 
GitLab