Oneworld connectivity test

Summary:
Gets a oneworld device (just android for now), installs an app. Checks it connects and stays connected for 5s.

The app installed is in an array, we just need to add more targets for further tests.

Reviewed By: danielbuechele

Differential Revision: D10231083

fbshipit-source-id: c33fb091c1b7914a33690398a79fd700c445c06c
This commit is contained in:
John Knox
2018-10-22 11:36:06 -07:00
committed by Facebook Github Bot
parent 764cdfe127
commit f0262d91f0
4 changed files with 60 additions and 13 deletions

View File

@@ -100,8 +100,9 @@
"start": "cross-env NODE_ENV=development node scripts/start-dev-server.js",
"build": "yarn rm-dist && cross-env NODE_ENV=production node scripts/build-release.js $@",
"fix": "eslint . --fix",
"test": "jest --testPathPattern=node\\.js$",
"test-electron": "jest --testPathPattern=electron\\.js$ --testEnvironment=@jest-runner/electron/environment --runner=@jest-runner/electron",
"test": "jest --testPathPattern=node\\.js$ --no-cache",
"test-electron": "jest --testPathPattern=electron\\.js$ --testEnvironment=@jest-runner/electron/environment --runner=@jest-runner/electron --no-cache",
"test-with-device": "USE_ELECTRON_STUBS=1 jest --testPathPattern=device\\.js$ --detectOpenHandles --no-cache",
"lint": "eslint . && flow check"
},
"optionalDependencies": {

View File

@@ -0,0 +1,53 @@
/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import Server from '../server.js';
import LogManager from '../fb-stubs/Logger';
import reducers from '../reducers/index.js';
import configureStore from 'redux-mock-store';
import path from 'path';
import os from 'os';
import fs from 'fs';
let server;
const mockStore = configureStore([])(reducers(undefined, {type: 'INIT'}));
beforeAll(() => {
// create config directory, which is usually created by static/index.js
const flipperDir = path.join(os.homedir(), '.flipper');
if (!fs.existsSync(flipperDir)) {
fs.mkdirSync(flipperDir);
}
server = new Server(new LogManager(), mockStore);
return server.init();
});
test.skip(
'Device can connect successfully',
done => {
var testFinished = false;
server.addListener('new-client', (client: Client) => {
console.debug('new-client ' + new Date().toString());
setTimeout(() => {
testFinished = true;
done();
}, 5000);
});
server.addListener('removed-client', (id: string) => {
console.debug('removed-client ' + new Date().toString());
if (!testFinished) {
done.fail('client disconnected too early');
}
});
},
20000,
);
afterAll(() => {
return server.close();
});

View File

@@ -45,16 +45,6 @@ test('servers starting at ports', done => {
});
});
test.skip(
'Layout plugin is connecting',
done => {
server.addListener('new-client', (client: Client) => {
done();
});
},
10000,
);
afterAll(() => {
server.close();
return server.close();
});

View File

@@ -8,5 +8,8 @@
isFocused: function() {return true;}
};
},
app: {
getVersion: function() {return '1';}
}
},
}