Problem/Motivation

When installing, command line scenarios run successfully using Acquia BLT (blt tests:behat:run). When navigating to UI page, Javascript needed to view "Available steps" does not show, just a gray bar on the right side. The available feature tests populate from the features directory but don't actually run.

Steps to reproduce

  • Install module and configure to own local environment
  • Navigate to /admin/config/development/behat_ui/new and attempt to create new or run existing tests

Comments

fsabbagh created an issue. See original summary.

rajab natshah’s picture

Component: Code » Documentation
rajab natshah’s picture

Thank you, Farah for reporting.

✅ Released behat_ui-4.0.2

You can follow the following steps using:

Web Interactive Command to setup Behat UI for your Drupal project

Create your testing folder
mkdir /var/www/html/test

Change the directory to the testing folder
cd /var/www/html/test

Create a Drupal project using the drupal recommended project.
composer create-project drupal/recommended-project:~9.0 drupal9test1

Change the directory to the project folder
cd /var/www/html/test/drupal9test1

Change file mode for all files and folders
sudo chmod 775 -R .

Change the ownership of the files in the project
sudo chown www-data:$USER -R .

Vardot Commands to setup Behat UI module for projects
It is a Web Interactive Command to setup Behat UI for any Drupal site.

https://github.com/Vardot/cmd/tree/main/behat_ui

bash <(wget -O - https://raw.githubusercontent.com/vardot/cmd/main/behat_ui/drupal.sh)
Redirecting output to ‘wget-log’.
                                                                            
  ###########################################################################
    Web Interactive Command to setup Behat UI for Drupal
  ###########################################################################
    drupal_behat_ui version 1.0.3
  ---------------------------------------------------------------------------
gateway      192.168.0.1
iface        wlp3s0
ip           192.168.0.105
  ---------------------------------------------------------------------------
Full local project path (/var/www/html/test/drupal9test1): 
Project machine name (drupal9test1): 
Project base testing url ( http://192.168.0.105/drupal9test1/web ) : http://192.168.0.105/test/drupal9test1/web
Selenium Host domain ( robot1.dev.in.vardot.com:4445/wd/hub ): 192.168.0.106:4444/wd/hub 

Change the mode and ownership for files again

sudo chmod 775 -R .
sudo chown www-data:$USER -R .

Change the directory to the web root folder in the project
cd /var/www/html/test/drupal9test1/web

Run a drush site install command to install the standard profile for the Drupal site. or head to the browser and install the site

../vendor/drush/drush/drush site:install standard --yes --site-name="Drupal site" --account-name="webmaster" --account-pass="d" --account-mail="test@email.test" --db-url="mysql://root:123___@localhost/test_drupal9test1" --locale="en"

Change the mode and ownership for files

sudo chmod 775 -R .
sudo chown www-data:$USER -R .

Clear the cache
../vendor/drush/drush/drush cr

Install Behat UI
../vendor/drush/drush/drush en behat_ui

I planned to record a video on the listed steps. Documentation is much needed for better ease of use too.

rajab natshah’s picture

Published a video to follow at the following link:
https://www.youtube.com/watch?v=aLiZ9ecuSKU

fsayoub’s picture

Awesome! Thank you so much, Rajab!! That definitely helps. I'm trying to incorporate into an existing site, and use it with Acquia Pipelines, as part of the build process (which is working as intended from the command line,) but will try to reconfigure using your steps above. Thank you again!

rajab natshah’s picture

Assigned: fsayoub » mohammed j. razem
Category: Bug report » Task
Status: Active » Needs review

Planned to:

  • Have a Documentation page for the steps
  • Link to Vardot Commands to setup Behat UI module for projects
  • List the Video link in the docs too

It would be nice to add that to the Behat UI Project description

Vardot Commands to setup Behat UI module for projects
Setup Behat UI module and configs for Local Drupal projects.

1. Go to the project directory:

cd /path/to/project

2. Run the interactive command:

bash <(wget -O - https://raw.githubusercontent.com/vardot/cmd/main/behat_ui/drupal.sh)

Watch the following Youtube Video for the way to run the Web Interactive Command to setup Behat UI for your Drupal project

Managed to change the Web Command to work for distributions like Varbase and other hosting services like Platform.sh

rajab natshah’s picture

Assigned: mohammed j. razem » Unassigned
fsayoub’s picture

@Rajab Does the Drupal path need to be `web`, as it mentions in the source code? Our "web" is labeled "docroot" and I'm wondering if this is my problem. When running the bash command, I'm getting this as a final warning: cp: directory web/modules/contrib/behat_ui/config/install does not exist.

rajab natshah’s picture

For sure you can change that to "docroot" or "public_html"
We could manage an argument in the automated bash command to allow to change that from the interactive web command
For now, change that manually in the behat.yml file and Behat UI settings

fsayoub’s picture

@Rajab does the module require Selenium? Acquia documentation provides that "Acquia Pipelines doesn’t support Selenium (due to Java not being installed). Therefore, you must run the tests using headless Chrome in Pipelines."

pierregermain’s picture

How does one run selenium in localhost ?
For now I was not able to run selenium in local so I disabled it in behat.yml and removed the @javascript tags in the features. This makes nearly work the module out of the box. Thank you for module.

rajab natshah’s picture

Thanks, Pierre for asking

Doing that in the Varbase distribution

Varbase Automated Functional Testing

https://github.com/Vardot/varbase/tree/9.0.x/tests

Vardot Commands to setup Behat UI module for projects

https://github.com/Vardot/cmd/tree/main/behat_ui

The command will configure the project with the varbase_behat_ui template.
This is a template "behat.yml" and "features" testing folder to work with Behat and Behat UI on the Varbase system.


Please, follow with the following link for a normal Drupal standard profile
Setup Behat UI module and configs for Local Drupal projects
pierregermain’s picture

Thanks Rajab,
I am not using the varbase distribution, but it has really a lot of documentation: In my case I was able to run Selenium doing what is explained at https://github.com/Vardot/varbase/tree/9.0.x/tests#install-java

  1. Install Java
  2. Install Google Chrome
  3. Install Google Chrome Driver
  4. Get and Run Selenium

For now my Behat.yml look like this for the Selenium part

  extensions:
    Drupal\MinkExtension:
      files_path: "%paths.base%/features/assets/"
      base_url: 'http://localhost'
      browser_name: chrome
      default_session: chrome
      ajax_timeout: 5
      javascript_session: chrome
      sessions:
        chrome:
          selenium2:
            wd_host: 'localhost:4444/wd/hub'
            browser: 'chrome'
            capabilities:
              chrome:
                switches:
                # We need a vertical window to be able to "see" buttons
                  - "--window-size=960,2400"
                 # - "--headless"
              extra_capabilities:
                chromeOptions:
                  w3c: false

Thanks for the information. It was really helpfull.

rajab natshah’s picture

Status: Needs review » Closed (outdated)
Issue tags: -JavaScript +JavaScript