From 1a544b3b824079ac426f83efe81147737c08aecd Mon Sep 17 00:00:00 2001
From: YumaMatsuura <38545050+YumaMatsuura@users.noreply.github.com>
Date: Tue, 10 Jul 2018 20:42:56 +0900
Subject: [PATCH] Headless option for ui test (#1784)

---
 Gruntfile.js             | 4 ++++
 test/editor/wdio.conf.js | 9 +++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index faf68f100..508fadc58 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -24,6 +24,10 @@ module.exports = function(grunt) {
         nodemonArgs.push(flowFile);
     }
 
+    var nonHeadless = grunt.option('non-headless');
+    if (nonHeadless) {
+        process.env.NODE_RED_NON_HEADLESS = 'true';
+    }
     grunt.initConfig({
         pkg: grunt.file.readJSON('package.json'),
         paths: {
diff --git a/test/editor/wdio.conf.js b/test/editor/wdio.conf.js
index 08cc1e60f..eb23a9a2c 100644
--- a/test/editor/wdio.conf.js
+++ b/test/editor/wdio.conf.js
@@ -62,10 +62,11 @@ exports.config = {
         //
         browserName: 'chrome',
         chromeOptions: {
-            // Runs tests without opening a broser.
-            args: ['--headless', '--disable-gpu', 'window-size=1920,1080'],
-            // Runs tests with opening a broser.
-            // args: ['--disable-gpu'],
+            args: process.env.NODE_RED_NON_HEADLESS
+                // Runs tests with opening a browser.
+                ? ['--disable-gpu']
+                // Runs tests without opening a browser.
+                : ['--headless', '--disable-gpu', 'window-size=1920,1080']
         },
     }],
     //