Skip to content

Commit

Permalink
test(*): fixing breaking tests because of fjagejs
Browse files Browse the repository at this point in the history
  • Loading branch information
notthetup committed Aug 27, 2021
1 parent 079ab85 commit dcddb09
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
21 changes: 21 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,27 @@ javadoc.doLast {
}
}

task buildjs {
doLast {
def result = exec {
ignoreExitValue = true
commandLine 'npm', '-v'
errorOutput = new ByteArrayOutputStream()
standardOutput = new ByteArrayOutputStream()
}
if(result.getExitValue()==0){
exec {
workingDir 'gateways/js'
commandLine 'npm', 'run', 'build'
}
}else{
project.logger.lifecycle('npm not found. Using cached fjage.js build')
}
}
}

processResources.dependsOn("buildjs")

task jsdoc(type: Exec){
workingDir 'gateways/js'
executable 'npm'
Expand Down
2 changes: 1 addition & 1 deletion gateways/js/dist/esm/fjage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* fjage.js v1.9.1-rc5 2021-08-04T07:48:57.240Z */
/* fjage.js v1.9.1-rc5 2021-08-27T02:38:54.627Z */

/* global window self */

Expand Down
2 changes: 1 addition & 1 deletion gateways/js/dist/fjage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions gateways/js/test/browser-test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
const puppeteer = require('puppeteer');
const statik = require('node-static');

const port = 8000;

console.log('\nSetting up local static server at http://localhost:8000/test');
const file = new statik.Server('.');
let server = require('http').createServer(function (request, response) {
request.addListener('end', function () {
file.serve(request, response);
}).resume();
}).listen(8000);
}).listen(port);


(async () => {
Expand All @@ -20,7 +22,7 @@ let server = require('http').createServer(function (request, response) {
msg.type() == 'error' && console.log('PAGE ERR:', msg.text());
msg.type() == 'warning' && console.log('PAGE WARN:', msg.text());
});
await page.goto('http://127.0.0.1:8000/test', {waitUntil: 'networkidle2'});
await page.goto('http://127.0.0.1:'+port+'/test', {waitUntil: 'networkidle2'});
await page.waitForSelector('.jasmine-overall-result');
await page.waitForTimeout(100);
await browser.close();
Expand Down
4 changes: 3 additions & 1 deletion src/test/groovy/org/arl/fjage/test/fjagejsTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ class fjagejsTest {
println "-------------------------------------------------------------"
container.shutdown()
platform.shutdown()
assertTrue(ret == 0 && testRes["node"].didPass && testRes["browser"].didPass)
assertTrue(ret == 0)
assertTrue(testRes["node"].didPass)
assertTrue(testRes["browser"].didPass)
}
}

Expand Down

0 comments on commit dcddb09

Please sign in to comment.