Sfoglia il codice sorgente

Merge pull request #269 from dmanners/mftf-setup

Mark Shust 3 anni fa
parent
commit
301137a57f
4 ha cambiato i file con 45 aggiunte e 0 eliminazioni
  1. 28 0
      README.md
  2. 2 0
      compose/bin/mftf
  3. 12 0
      compose/docker-compose.dev.yml
  4. 3 0
      compose/docker-compose.yml

+ 28 - 0
README.md

@@ -253,6 +253,7 @@ It is recommended to keep your root docker config files in one repository, and y
 - `bin/fixperms`: This will fix filesystem permissions within the container.
 - `bin/grunt`: Run the grunt binary. Ex. `bin/grunt exec`
 - `bin/magento`: Run the Magento CLI. Ex: `bin/magento cache:flush`
+- `bin/mftf`: Run the Magento MFTF. Ex: `bin/mftf build:project`
 - `bin/mysql`: Run the MySQL CLI with database config from `env/db.env`. Ex. `bin/mysql -e "EXPLAIN core_config_data"` or`bin/mysql < backups/magento.sql`
 - `bin/mysqldump`: Backup the Magento database. Ex. `bin/mysqldump > backups/magento.sql`
 - `bin/n98-magerun2`: Access the [n98-magerun2](https://github.com/netz98/n98-magerun2) CLI. Ex: `bin/n98-magerun2 dev:console`
@@ -429,6 +430,33 @@ Next, open up the `bin/start` helper script and uncomment the line:
 
 Finally, restart the containers with `bin/restart`. After doing so, everything is now configured and you can use a browser extension to profile your Magento store with Blackfire.
 
+### MFTF
+
+To work with MFTF you will need to first enable the `selenium` image in the `docker-compose.dev.yml` file. Then, you will need to run the following.
+
+1. Run mftf build process `bin/mftf build:project`. This should build the basic setup for mftf in your project.
+2. Update the `extra_host` values to match your Magento URL and IP in `docker-compose.dev.yml`.
+3. Update the values in `src/dev/tests/acceptance/.env`, including adding the new line `SELENIUM_HOST=selenium` to define the host Codeception should connect to.
+4. Run a sample test `bin/mftf run:test AdminLoginTest`.
+5. Update your `nginx.conf` file to allow access to the dev section with the following, before the final `deny all` section:
+
+```
+location ~* ^/dev/tests/acceptance/utils($|/) {
+    root $MAGE_ROOT;
+    location ~ ^/dev/tests/acceptance/utils/command.php {
+        fastcgi_pass   fastcgi_backend;
+        fastcgi_index  index.php;
+        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+        include        fastcgi_params;
+    }
+}
+```
+
+For debugging, you can connect to the selenium image using a VCN client.
+
+- Connect with the VCN option and `127.0.0.1:5900`
+- Run `bin/mftf doctor` to validate all sections are setup correctly.
+
 ## Credits
 
 ### M.academy

+ 2 - 0
compose/bin/mftf

@@ -0,0 +1,2 @@
+#!/bin/bash
+bin/clinotty vendor/bin/mftf "$@"

+ 12 - 0
compose/docker-compose.dev.yml

@@ -39,3 +39,15 @@ services:
   ## Disabling cron by default as it uses higher CPU, enable if needed
   #cron:
   #  volumes: *appvolumes
+
+  # Disabling selenium by default as it is not required for all use cases
+  #selenium:
+  #  image: selenium/standalone-chrome-debug:3.8.1
+  #  ports:
+  #    - "5900:5900"
+  # Uncomment two lines below & replace IP with result of: docker run --rm alpine ip route | awk 'NR==1 {print $3}'
+  # Replace the "magento2-composer.loc" with the url of your site
+  #  extra_hosts:
+  #    - "magento2.test:172.17.0.1"
+  #  links:
+  #    - app

+ 3 - 0
compose/docker-compose.yml

@@ -72,6 +72,9 @@ services:
   #    - db
   #  volumes: *appvolumes
 
+  #selenium:
+  #  image: selenium/standalone-chrome-debug:3.8.1
+
 volumes:
   appdata:
   dbdata: