[skip ci] simple integration test

This commit is contained in:
Brahim Hadriche committed 2025-01-15 21:14:03 -05:00
1 parent f6d8afc2d9
commit 57cdb59790
4 files changed
+1288

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
const dotenv = require('dotenv');
const fs = require('fs');
const path = require('path');
import { utils } from 'roku-test-automation';
const envFile = path.join(__dirname, '../.env');
const config = getEnvVars(['ROKU_DEV_TARGET', 'ROKU_DEVPASSWORD']);
export function setupEnvironment() {
utils.setupEnvironmentFromConfig({
RokuDevice: {
devices: [{
host: config.ROKU_DEV_TARGET,
password: config.ROKU_DEVPASSWORD
}]
},
ECP: {
default: {
launchChannelId: 'dev'
}
},
OnDeviceComponent: {
logLevel: 'info'
}
})
}
function getEnvVars(requiredVars = undefined) {
let envVars = process.env;
if (fs.existsSync(envFile)) {
const envConfig = dotenv.parse(fs.readFileSync(envFile));
envVars = { ...envVars, ...envConfig };
}
if (requiredVars) {
const missingVars = requiredVars.filter((key) => !envVars[key]);
if (missingVars.length) {
throw new Error(`Missing environment variables: ${missingVars.join(', ')}`);
}
}
return envVars;
}
+21
View File
@@ -0,0 +1,21 @@
// integration test to play a video on the Roku device
// 1. Run dev channel on the Roku device (Playlet (dev))
// 2 npm run restart-app && npm run test:integration
import { ecp, odc } from 'roku-test-automation';
import { setupEnvironment } from './common';
setupEnvironment();
(async () => {
await ecp.sendInput({ params: { contentId: "jNQXAC9IVRw" } });
await odc.onFieldChangeOnce({
base: "scene",
keyPath: "#VideoQueue.player.state",
match: "playing",
});
console.log("Video started playing");
await odc.shutdown();
})();
+1222
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -22,6 +22,7 @@
"mailparser": "^3.7.2",
"protocol-buffers-schema": "^3.6.0",
"roku-deploy": "^3.12.3",
"roku-test-automation": "^2.0.10",
"rooibos-roku": "5.14.0",
"rounded-rect-9patch": "^1.1.2",
"semver": "^7.6.3",
@@ -55,6 +56,7 @@
"test:build:app": "cd playlet-app && npm run test:build",
"test:lib": "cd playlet-lib && npm run test",
"test:build:lib": "cd playlet-lib && npm run test:build",
"test:integration": "npx tsx ./integration-tests/play-video.ts",
"version-sync": "node tools/version-sync.js",
"manifest-git-hash": "node tools/update-manifest-git-hash.js",
"sign-released-package": "node tools/sign-released-package.js",