How to use getBuildInfo method in Appium

Best JavaScript code snippet using appium

assert.js

Source:assert.js Github

copy

Full Screen

...25// This file defines all the builtins that can be used inside Gears unit tests.26/**27 * Whether the installed Gears extension is a debug build.28 */29var isDebug = google.gears.factory.getBuildInfo().indexOf('dbg') > -1;30/**31 * Whether the installed Gears extension is an official build.32 */33var isOfficial = google.gears.factory.getBuildInfo().indexOf('official') > -1;34/**35 * Whether the installed Gears extension is for a particular platform.36 */37var isWin32 = google.gears.factory.getBuildInfo().indexOf('win32') > -1;38var isWince = google.gears.factory.getBuildInfo().indexOf('wince') > -1;39var isOsx = google.gears.factory.getBuildInfo().indexOf('osx') > -1;40var isAndroid = google.gears.factory.getBuildInfo().indexOf('android') > -1;41/**42 * Whether the installed Gears extension is for a particular browser.43 */44var isIE = google.gears.factory.getBuildInfo().indexOf(';ie') > -1;45var isFirefox = google.gears.factory.getBuildInfo().indexOf(';firefox') > -1;46var isSafari = google.gears.factory.getBuildInfo().indexOf(';safari') > -1;47var isNPAPI = google.gears.factory.getBuildInfo().indexOf(';npapi') > -1;48var isOpera = google.gears.factory.getBuildInfo().indexOf(';opera') > -1;49/**50 * Whether the installed Gears extension has the test scriptable object.51 * See also the definition of USING_CCTESTS in gears\tools\config.mk.52 */53var isUsingCCTests = isDebug || !isOfficial;54/**55 * A shared timer tests can use.56 */57var timer = google.gears.factory.create('beta.timer');58/**59 * Assert that something is true and throw an error if not.60 *61 * @param expr The expression to test. This will be coerced to bool if it isn't62 * already....

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

...5import { getBuildInfo } from '../src/main.js'6const FIXTURES_ABSOLUTE_PATH = fileURLToPath(new URL('fixtures', import.meta.url))7const FIXTURES_RELATIVE_PATH = relative(cwd(), FIXTURES_ABSOLUTE_PATH)8test('js-workspaces: project without package.json does not return workspaces info', async (t) => {9 const { jsWorkspaces } = await getBuildInfo({10 projectDir: `${FIXTURES_RELATIVE_PATH}/empty`,11 })12 t.is(jsWorkspaces, undefined)13})14test('js-workspaces: project without workspaces in package.json does not return workspaces info', async (t) => {15 const { jsWorkspaces } = await getBuildInfo({16 projectDir: `${FIXTURES_RELATIVE_PATH}/simple-package-json`,17 })18 t.is(jsWorkspaces, undefined)19})20test('js-workspaces: projectDir set to workspaces root returns workspace info and isRoot flag set to true', async (t) => {21 const { jsWorkspaces } = await getBuildInfo({22 projectDir: `${FIXTURES_RELATIVE_PATH}/js-workspaces`,23 })24 t.not(jsWorkspaces, undefined)25 t.true(jsWorkspaces.isRoot)26 t.is(jsWorkspaces.packages.length, 2)27})28test('js-workspaces: projectDir set to workspace dir returns workspace info and isRoot flag set to false', async (t) => {29 const { jsWorkspaces } = await getBuildInfo({30 rootDir: `${FIXTURES_RELATIVE_PATH}/js-workspaces`,31 projectDir: 'packages/gatsby-site',32 })33 t.not(jsWorkspaces, undefined)34 t.false(jsWorkspaces.isRoot)35 t.is(jsWorkspaces.packages.length, 2)36})37test('js-workspaces: if project is not part of a workspace return no workspace info', async (t) => {38 const { jsWorkspaces } = await getBuildInfo({39 rootDir: `${FIXTURES_RELATIVE_PATH}/js-workspaces`,40 projectDir: 'not-in-workspace',41 })42 t.is(jsWorkspaces, undefined)43})44test('js-workspaces: handles absolute paths correctly', async (t) => {45 const { jsWorkspaces } = await getBuildInfo({46 rootDir: `${FIXTURES_ABSOLUTE_PATH}/js-workspaces`,47 projectDir: `${FIXTURES_ABSOLUTE_PATH}/js-workspaces/packages/gatsby-site`,48 })49 t.not(jsWorkspaces, undefined)50 t.false(jsWorkspaces.isRoot)51 t.is(jsWorkspaces.packages.length, 2)52})53test('frameworks: return an empty array if no frameworks are detected', async (t) => {54 const { frameworks } = await getBuildInfo({55 rootDir: `${FIXTURES_ABSOLUTE_PATH}/empty`,56 })57 t.deepEqual(frameworks, [])58})59test('all: should detect workspaces and frameworks', async (t) => {60 const { frameworks, jsWorkspaces } = await getBuildInfo({61 rootDir: `${FIXTURES_ABSOLUTE_PATH}/js-workspaces`,62 projectDir: 'packages/gatsby-site',63 })64 t.not(jsWorkspaces, undefined)65 t.is(frameworks.length, 1)66})67test('all: detects workspaces and frameworks when given a rootDir and an empty projectDir', async (t) => {68 const { frameworks, jsWorkspaces } = await getBuildInfo({69 rootDir: `${FIXTURES_ABSOLUTE_PATH}/js-workspaces`,70 projectDir: '',71 })72 t.not(jsWorkspaces, undefined)73 t.is(frameworks.length, 1)...

Full Screen

Full Screen

get-build-info.test.js

Source:get-build-info.test.js Github

copy

Full Screen

1const getBuildInfo = require("../get-build-info");2describe("getBuildInfo()", () => {3 afterEach(() => {4 delete process.env.TRAVIS_BUILD_NUMBER;5 });6 it("should be a function", () => {7 expect(typeof getBuildInfo).toBe("function");8 });9 it("should return a promise that resolves to an object", async () => {10 const buildInfo = await getBuildInfo();11 expect(typeof buildInfo).toBe("object");12 });13 it("should always return a isTravisBuild property", async () => {14 const buildInfo = await getBuildInfo();15 expect(buildInfo).toHaveProperty("isTravisBuild");16 expect(typeof buildInfo.isTravisBuild).toBe("boolean");17 });18 it("should always return a description property", async () => {19 const buildInfo = await getBuildInfo();20 expect(buildInfo).toHaveProperty("description");21 expect(typeof buildInfo.description).toBe("string");22 });23 it("should always return a commitHash property", async () => {24 const buildInfo = await getBuildInfo();25 expect(buildInfo).toHaveProperty("commitHash");26 expect(typeof buildInfo.commitHash).toBe("string");27 });28 it("should always return a commitShortHash property", async () => {29 const buildInfo = await getBuildInfo();30 expect(buildInfo).toHaveProperty("commitShortHash");31 expect(typeof buildInfo.commitShortHash).toBe("string");32 });33 it("should always return a commitGithubUrl property", async () => {34 const buildInfo = await getBuildInfo();35 expect(buildInfo).toHaveProperty("commitGithubUrl");36 expect(typeof buildInfo.commitGithubUrl).toBe("string");37 });38 it("should identify a Travis CI build", async () => {39 process.env.TRAVIS_BUILD_NUMBER = '123456';40 const buildInfo = await getBuildInfo();41 expect(buildInfo.isTravisBuild).toBe(true);42 });43 it("should identify a local build", async () => {44 delete process.env.TRAVIS_BUILD_NUMBER;45 const buildInfo = await getBuildInfo();46 expect(buildInfo.isTravisBuild).toBe(false);47 });48 it("should return a travisBuildNumber property for Travis CI builds", async () => {49 process.env.TRAVIS_BUILD_NUMBER = '123456';50 process.env.TRAVIS_BUILD_ID = '654321';51 const buildInfo = await getBuildInfo();52 expect(buildInfo).toHaveProperty("travisBuildNumber");53 expect(typeof buildInfo.travisBuildNumber).toBe("string");54 });55 it("should return a travisBuildId property for Travis CI builds", async () => {56 process.env.TRAVIS_BUILD_NUMBER = '123456';57 process.env.TRAVIS_BUILD_ID = '654321';58 const buildInfo = await getBuildInfo();59 expect(buildInfo).toHaveProperty("travisBuildId");60 expect(typeof buildInfo.travisBuildId).toBe("string");61 });62 it("should return a travisBuildUrl property for Travis CI builds", async () => {63 process.env.TRAVIS_BUILD_NUMBER = '123456';64 process.env.TRAVIS_BUILD_ID = '654321';65 const buildInfo = await getBuildInfo();66 expect(buildInfo).toHaveProperty("travisBuildUrl");67 expect(typeof buildInfo.travisBuildUrl).toBe("string");68 });...

Full Screen

Full Screen

Features.js

Source:Features.js Github

copy

Full Screen

...52 }53 },54 methods: {55 inProgress (feature) {56 return this.getBuildInfo(feature) || this.getCleanInfo(feature)57 },58 getBuildUrl (feature) {59 const info = this.getBuildInfo(feature) || this.getCleanInfo(feature) || {}60 return info.buildUrl || ''61 },62 getBuildNumber (feature) {63 const info = this.getBuildInfo(feature) || this.getCleanInfo(feature) || {}64 return info.buildNumber || ''65 },66 getBuildInfo (feature) {67 if (this.buildInfo && this.buildInfo.branch === feature.label) {68 return this.buildInfo69 }70 return false71 },72 getCleanInfo (feature) {73 if (this.cleanInfo && this.cleanInfo.branch === feature.label) {74 return this.cleanInfo75 }76 return false77 }...

Full Screen

Full Screen

jenkins-api.js

Source:jenkins-api.js Github

copy

Full Screen

...17 var artifactPath = function artifactPath(project, version, relativePath) {18 return buildPath(project, version) + '/artifact/' + relativePath;19 }20 // returns build info for a particular project + version21 var getBuildInfo = function getBuildInfo(project, version) {22 // example23 // http://jenkins.dev.spawnlabs.com/jenkins/job/some-project/lastSuccessfulBuild/api/json?pretty=true24 var buildInfoUrl = buildPath(project, version) + '/api/json?jsonp=?'25 return $.getJSON(buildInfoUrl, function() {26 console.log("getBuildInfo success")27 })28 }29 // pin to global object30 // --------------------31 context.rest = {}32 context.rest.stripCredentials = stripCredentials33 context.rest.buildPath = buildPath34 context.rest.projectPath = projectPath35 context.rest.artifactPath = artifactPath...

Full Screen

Full Screen

revealMultiCli.js

Source:revealMultiCli.js Github

copy

Full Screen

...14 .then(() => {15 console.log('Created generic project in ' + options.srcDir)16 })17 } else if (options.runServer) {18 result = getBuildInfo(options)19 .then(createServer)20 .then((server: Server) => {21 console.log(`open http://localhost:${server.address().port}/`)22 })23 } else {24 result = getBuildInfo(options)25 .then(createStaticSite)26 .then((info: IBuildInfo) => {27 console.log(`${info.pages28 .map((page: IGetPageOptions) => page.dir).join(', ')} builded in ${info.options.destDir}`)29 })30 }31 return result32 .catch((e: Error) => {33 console.error(e)34 })...

Full Screen

Full Screen

buildInfo.js

Source:buildInfo.js Github

copy

Full Screen

1const apiUtil = require('../../helper/apiQueryHandler');2const xml2js = require('xml2js');3const STATUS = {4 INCOMPLETE:"Incomplete",5 SCAN_IN_PROGRESS: "Scan In Process",6 PRESCAN_SUBMITTED: "Pre-Scan Submitted",7 PRESCAN_FINISHED: "Pre-Scan Success",8 SUBMITTED_TO_SCAN:'Submitted to Engine',9 RESULT_READY: "Results Ready"10};11const getBuildInfo = async (appLegacyId,sandboxLegacyId) => {12 console.log('getBuildInfo - START');13 let jsonBuildInfo = {};14 let params = {15 'app_id':appLegacyId+''16 };17 if (sandboxLegacyId && sandboxLegacyId!==null) {18 params.sandbox_id = sandboxLegacyId+'';19 }20 try {21 const response = await apiUtil.request(22 'GET',23 'analysiscenter.veracode.com',24 '/api/5.0/getbuildinfo.do', 25 params26 );27 const buildInfo = response.data;28 xml2js.parseString(buildInfo,{explicitArray:false,trim:true},(err,result)=> {29 jsonBuildInfo = result.buildinfo.build;30 });31 } catch (error) {32 console.error(error.response);33 }34 console.log('getBuildInfo - END');35 return jsonBuildInfo;36}37module.exports = {38 getAppbuildInfo : getBuildInfo,39 STATUS...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1const config = require('@brillout/reconfig');2const runBuild = require('./runBuild');3const getBuildInfo = require('./getBuildInfo');4const reloadBrowser = require('webpack-ssr/reloadBrowser');5Object.assign(6 config.goldpage,7 {8 runBuild,9 getBuildInfo,10 onBuild: null,11 buildStarted: false,12 reloadBrowser: () => {13 const {autoReloadPort} = config.goldpage;14 reloadBrowser({autoReloadPort});15 },16 },...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var caps = {4};5var driver = wd.promiseChainRemote('localhost', 4723);6driver.init(caps).then(function () {7 return driver.getBuildInfo();8}).then(function (buildInfo) {9 console.log(buildInfo);10 assert.ok(buildInfo.build.revision);11}).fin(function () { driver.quit(); });12var wd = require('wd');13var assert = require('assert');14var caps = {15};16var driver = wd.promiseChainRemote('localhost', 4723);17driver.init(caps).then(function () {18 return driver.getBuildInfo();19}).then(function (buildInfo) {20 console.log(buildInfo);21 assert.ok(buildInfo.build.revision);22}).fin(function () { driver.quit(); });23The MIT License (MIT)24See [LICENSE](LICENSE)

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var asserters = wd.asserters;3var driver = wd.promiseChainRemote("localhost", 4723);4driver.init({5}).then(function() {6 return driver.getBuildInfo();7}).then(function(buildInfo) {8 console.log("Build Info: " + JSON.stringify(buildInfo));9}).fin(function() {10 return driver.quit();11}).done();12Build Info: {"build":{"version":"1.2.0","revision":"1.2.0","time":"2015-03-17T04:18:45.000Z","summary":"1.2.0"}}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var appium = require("wd/lib/servers/appium");3var serverConfig = {4};5var driver = wd.promiseChainRemote(serverConfig);6var desiredCaps = {7};8driver.init(desiredCaps).then(function () {9 return driver.getBuildInfo();10}).then(function (data) {11 console.log(data);12 return driver.quit();13}).done();14{ [Error: socket hang up] code: 'ECONNRESET' }

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.getBuildInfo().then(function(info){2 console.log(info);3});4driver.getDeviceTime().then(function(time){5 console.log(time);6});7driver.getLog("logType").then(function(logs){8 console.log(logs);9});10driver.getLogTypes().then(function(logTypes){11 console.log(logTypes);12});13driver.getOrientation().then(function(orientation){14 console.log(orientation);15});16driver.getSession().then(function(session){17 console.log(session);18});19driver.getSource().then(function(source){20 console.log(source);21});22driver.getWindowHandle().then(function(windowHandle){23 console.log(windowHandle);24});25driver.getWindowHandles().then(function(windowHandles){26 console.log(windowHandles);27});28driver.hideKeyboard();29driver.installApp("appPath

Full Screen

Using AI Code Generation

copy

Full Screen

1import { AppiumDriver, startSession, capabilities } from "nativescript-dev-appium";2import { after, before, it, describe } from "mocha";3import { assert } from "chai";4describe("sample scenario", async function () {5 let driver: AppiumDriver;6 before(async function () {7 driver = await startSession(capabilities);8 });9 after(async function () {10 await driver.quit();11 });12 it("should get build info", async function () {13 const buildInfo = await driver.getBuildInfo();14 assert.isTrue(buildInfo.buildVersion.includes("8.0.0"), "Build version is not correct!");15 });16});17import { AppiumDriver, startSession, capabilities } from "nativescript-dev-appium";18import { after, before, it, describe } from "mocha";19import { assert } from "chai";20describe("sample scenario", async function () {21 let driver: AppiumDriver;22 before(async function () {23 driver = await startSession(capabilities);24 });25 after(async function () {26 await driver.quit();27 });28 it("should get device time", async function () {29 const deviceTime = await driver.getDeviceTime();30 assert.isTrue(deviceTime.includes("2019"), "Device time is not correct!");31 });32});

Full Screen

Using AI Code Generation

copy

Full Screen

1const {remote} = require('webdriverio');2(async () => {3 const browser = await remote({4 capabilities: {5 }6 })7 const buildInfo = await browser.getBuildInfo();8 console.log(buildInfo);9 await browser.deleteSession();10})().catch(async (e) => {11 console.error(e)12 await browser.deleteSession();13});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var driver = wd.promiseChainRemote("localhost", 4723);3driver.init({4}).then(function() {5 return driver.getBuildInfo();6}).then(function(info) {7 console.log(info);8}).fin(function() {9 return driver.quit();10}).done();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful