Skip to content

Commit

Permalink
docs(samples): video beta samples (#123)
Browse files Browse the repository at this point in the history
* Video beta

* Video beta object tracking/text detection

* Fixing review issues

* Inc. -> LLC

* trigger kokoro to check issue

* debugging sample test failure issue

* debugging errors

* debugging - attempt 2

* debugging - attempt 3

* debugging attempt - 4

* debugging - attempt 2

* Fixing review comments
  • Loading branch information
nirupa-kumar authored and ahrarmonsur committed Nov 17, 2022
1 parent b307385 commit d0a3e4f
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion video-intelligence/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"scripts": {
"cover": "nyc --reporter=lcov --cache ava -T 20s --verbose test/*.test.js ./system-test/*.test.js && nyc report",
"test": "ava -T 5m --verbose system-test/*.test.js"
"test": "ava -T 10m --serial --verbose system-test/*.test.js"
},
"dependencies": {
"@google-cloud/video-intelligence": "^1.4.1",
Expand Down
Binary file added video-intelligence/resources/googlework_short.mp4
Binary file not shown.
53 changes: 53 additions & 0 deletions video-intelligence/system-test/analyze.v1p2beta1.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Copyright 2018, Google, LLC
* Licensed under the Apache License, Version 2.0 (the `License`);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an `AS IS` BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// https://cloud.google.com/video-intelligence/docs/

'use strict';

const path = require(`path`);
const test = require(`ava`);
const tools = require(`@google-cloud/nodejs-repo-tools`);

const cmd = `node analyze.v1p2beta1.js`;
const cwd = path.join(__dirname, `..`);

const shortUrl = `gs://nodejs-docs-samples/video/googlework_short.mp4`;
const url = `gs://nodejs-docs-samples/video/cat.mp4`;
const file1 = `resources/cat.mp4`;
const file2 = `resources/googlework_short.mp4`;
const possibleTexts = /Google|GOOGLE|SUR|OMAR|ROTO|Vice President|58oo9|LONDRES|PARIS|METRO|RUE|CARLO/;

test.serial(`should detect text in a GCS file`, async t => {
const output = await tools.runAsync(`${cmd} video-text-gcs ${shortUrl}`, cwd);
t.regex(output, possibleTexts);
});

test.serial(`should detect text in a local file`, async t => {
const output = await tools.runAsync(`${cmd} video-text ${file2}`, cwd);
t.regex(output, possibleTexts);
});

test.serial(`should track objects in a GCS file`, async t => {
const output = await tools.runAsync(`${cmd} track-objects-gcs ${url}`, cwd);
t.regex(output, /cat/);
t.regex(output, /Confidence: \d+\.\d+/);
});

test.serial(`should track objects in a local file`, async t => {
const output = await tools.runAsync(`${cmd} track-objects ${file1}`, cwd);
t.regex(output, /cat/);
t.regex(output, /Confidence: \d+\.\d+/);
});

0 comments on commit d0a3e4f

Please sign in to comment.