Browse Source

Merge pull request #6101 from sebavan/master

Try browser stack tests
sebavan 6 years ago
parent
commit
a8a0c0af25

+ 6 - 0
Tools/Gulp/tasks/gulpTasks-tests.js

@@ -50,6 +50,12 @@ gulp.task("tests-validation-browserstack", function(done) {
         return;
         return;
     }
     }
 
 
+    // not in safe build
+    if (process.env.BROWSER_STACK_USERNAME === "$(babylon.browserStack.userName)") {
+        done();
+        return;
+    }
+
     var kamaServerOptions = {
     var kamaServerOptions = {
         configFile: rootDir + "tests/validation/karma.conf.browserstack.js",
         configFile: rootDir + "tests/validation/karma.conf.browserstack.js",
         singleRun: true
         singleRun: true

+ 0 - 25
Viewer/tests/validation/config.json

@@ -2,31 +2,6 @@
     "root": "",
     "root": "",
     "tests": [
     "tests": [
         {
         {
-            "title": "Diffuse",
-            "createMesh": true,
-            "createMaterial": true,
-            "configuration": {
-                "extends": "extended",
-                "castShadow": true,
-                "model": {
-                    "material": {
-                        "albedoColor": {
-                            "r": 0,
-                            "g": 0,
-                            "b": 1
-                        },
-                        "reflectivityColor": {
-                            "r": 0,
-                            "g": 0,
-                            "b": 0
-                        },
-                        "microSurface": 0
-                    }
-                }
-            },
-            "referenceImage": "Diffuse.png"
-        },
-        {
             "title": "BrainStem Environment",
             "title": "BrainStem Environment",
             "configuration": {
             "configuration": {
                 "extends": "extended"
                 "extends": "extended"

+ 13 - 1
azure-pipelines.yml

@@ -87,6 +87,11 @@ jobs:
   - script: 'gulp tests-babylon-unit'
   - script: 'gulp tests-babylon-unit'
     workingDirectory: Tools/Gulp
     workingDirectory: Tools/Gulp
     displayName: 'Unit Tests'
     displayName: 'Unit Tests'
+  - task: PublishTestResults@2
+    condition: succeededOrFailed()
+    inputs:
+      testRunner: JUnit
+      testResultsFiles: '.temp/testResults/UnitTests.xml'
   - script: |
   - script: |
       export DISPLAY=:99
       export DISPLAY=:99
       Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
       Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
@@ -94,6 +99,13 @@ jobs:
       gulp tests-validation-virtualscreen
       gulp tests-validation-virtualscreen
     workingDirectory: Tools/Gulp
     workingDirectory: Tools/Gulp
     displayName: 'Visual Tests'
     displayName: 'Visual Tests'
+  - script: 'gulp tests-validation-browserstack'
+    workingDirectory: Tools/Gulp
+    displayName: 'Browser Stack Tests'
+    env:
+      TRAVIS_BUILD_NUMBER: $(Build.BuildNumber)
+      BROWSER_STACK_USERNAME: $(babylon.browserStack.userName)
+      BROWSER_STACK_ACCESS_KEY: $(babylon.browserStack.userToken)
 
 
 - job: ModuleTests
 - job: ModuleTests
   displayName: '6. Module Tests'
   displayName: '6. Module Tests'
@@ -142,4 +154,4 @@ jobs:
       sleep 3 # give xvfb some time to start
       sleep 3 # give xvfb some time to start
       gulp tests-viewer-validation-virtualscreen
       gulp tests-viewer-validation-virtualscreen
     workingDirectory: Tools/Gulp
     workingDirectory: Tools/Gulp
-    displayName: 'Visual Tests'
+    displayName: 'Visual Tests'

+ 3 - 2
package.json

@@ -70,11 +70,12 @@
         "gulp-tslint": "^8.1.3",
         "gulp-tslint": "^8.1.3",
         "gulp-typedoc": "^2.2.1",
         "gulp-typedoc": "^2.2.1",
         "gulp-typescript": "4.0.2",
         "gulp-typescript": "4.0.2",
-        "karma": "^3.1.1",
+        "karma": "^4.0.1",
         "karma-browserstack-launcher": "^1.4.0",
         "karma-browserstack-launcher": "^1.4.0",
         "karma-chai": "^0.1.0",
         "karma-chai": "^0.1.0",
         "karma-chrome-launcher": "^2.2.0",
         "karma-chrome-launcher": "^2.2.0",
         "karma-firefox-launcher": "^1.1.0",
         "karma-firefox-launcher": "^1.1.0",
+        "karma-junit-reporter": "^1.2.0",
         "karma-mocha": "^1.3.0",
         "karma-mocha": "^1.3.0",
         "karma-sinon": "^1.0.5",
         "karma-sinon": "^1.0.5",
         "merge2": "~1.2.2",
         "merge2": "~1.2.2",
@@ -105,4 +106,4 @@
         "webpack-stream": "5.0.0",
         "webpack-stream": "5.0.0",
         "xhr2": "^0.1.4"
         "xhr2": "^0.1.4"
     }
     }
-}
+}

+ 5 - 1
src/Shaders/pbr.fragment.fx

@@ -1105,6 +1105,10 @@ void main(void) {
     finalDiffuse *= surfaceAlbedo.rgb;
     finalDiffuse *= surfaceAlbedo.rgb;
     finalDiffuse = max(finalDiffuse, 0.0);
     finalDiffuse = max(finalDiffuse, 0.0);
 
 
+// _____________________________ Ambient ________________________________________
+    vec3 finalAmbient = diffuseBase;
+    finalAmbient *= surfaceAlbedo.rgb;
+
 // _____________________________ Emissive ________________________________________
 // _____________________________ Emissive ________________________________________
     vec3 finalEmissive = vEmissiveColor;
     vec3 finalEmissive = vEmissiveColor;
 #ifdef EMISSIVE
 #ifdef EMISSIVE
@@ -1124,7 +1128,7 @@ void main(void) {
 // _____________________________ Composition _____________________________________
 // _____________________________ Composition _____________________________________
     // Reflection already includes the environment intensity.
     // Reflection already includes the environment intensity.
     vec4 finalColor = vec4(
     vec4 finalColor = vec4(
-        vAmbientColor			* ambientOcclusionColor +
+        finalAmbient			* ambientOcclusionColor +
         finalDiffuse			* ambientOcclusionForDirectDiffuse * vLightingIntensity.x +
         finalDiffuse			* ambientOcclusionForDirectDiffuse * vLightingIntensity.x +
 #ifndef UNLIT
 #ifndef UNLIT
     #ifdef REFLECTION
     #ifdef REFLECTION

+ 12 - 0
tests/unit/karma.conf.js

@@ -48,6 +48,18 @@ module.exports = function (config) {
         // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
         // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
         logLevel: config.LOG_INFO,
         logLevel: config.LOG_INFO,
 
 
+        reporters: ['progress', 'junit'],
+
+        junitReporter: {
+            outputDir: '.temp/testResults', // results will be saved as $outputDir/$browserName.xml
+            outputFile: 'UnitTests.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
+            suite: 'Unit Tests', // suite will become the package name attribute in xml testsuite element
+            useBrowserName: false, // add browser name to report and classes names
+            nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
+            classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
+            properties: {} // key value pair of properties to add to the <properties> section of the report
+        },
+
         browsers: ['ChromeHeadless']
         browsers: ['ChromeHeadless']
     })
     })
 }
 }