Can't integrate LambdaTest

Hello,

I’m trying to use LamdaTest to run automation webdriverIO. I am running into an issue:

A "user" or "key" was provided but could not be connected to a known cloud service (Sauce Labs, Browerstack or Testingbot). Please check if given user and key properties are correct!

this is my config file

exports.config = {
    specs: [
        'features/runfolder/**.feature'
    ],
    maxInstances: 10,
    capabilities: [{
        deviceName: "Galaxy S10",
        isRealMobile: "true",
        platformVersion: "9",
        //app: "bs://aa6bf63fdca3780840156ce01cc8bdc895e89cd6",
        app: 'APP10020521641393778397632',
        platform : "Android", // OS platform
        acceptInsecureCerts: true,
        autoGrantPermissions: true,
    }],
    logLevel: 'info',
    bail: 0,
    baseUrl: 'http://localhost',
    waitforTimeout: 10000,
    connectionRetryTimeout: 120000,
    connectionRetryCount: 1,
    user: 'duong.tran2',
    key: '***',
    services: [
        ['lambdatest', {
            tunnel: false
        }]
    ],
    framework: 'cucumber',
    reporters: [
        'spec',
        [ 'cucumberjs-json', {
                jsonFolder: '.tmp/new/android/',
                language: 'en',
            },
        ],
    ],
    cucumberOpts: {
        require: [
            './stepDefinitions/**/*.js'
        ],
        backtrace: false,
        requireModule: [],
        dryRun: false,
        failFast: false,
        format: ['pretty'],
        snippets: true,
        source: true,
        profile: [],
        strict: false,
        tagExpression: '',
        timeout: 60000,
        ignoreUndefinedDefinitions: false
    },
}

I am sure that my user and key are correct. Thank you for help.

1 Like

As mentioned, are using Webdriver and selenium. You need to put a username and access key(unique for each user). Format below.

user= process.env.LT_USERNAME || “”, key= process.env.LT_ACCESS_KEY || “”,

exports.config = {

updateJob: false, user, key, specs: [ ‘./tests/specs/single_test.js’ ], exclude: [],

capabilities: [{ browserName: ‘chrome’, version:“64.0”, name:“Test webdriverio”, build:“build 1”, }], sync: true, logLevel: ‘info’, coloredLogs: true, screenshotPath: ‘./errorShots/’, baseUrl: ‘’, waitforTimeout: 100000, connectionRetryTimeout: 90000, connectionRetryCount: 1, path: ‘/wd/hub’, hostname: ‘hub.lambdatest.com’, port: 80,

beforeSession: function (config, capabilities, specs) { capabilities.name=specs[0].split(/(\|/)/g).pop() || undefined; }, after: function (result, capabilities, specs) { driver.execute(“lambda-status=”.concat(result==0?“passed”:“failed”),undefined); },

framework: ‘mocha’, mochaOpts: { ui: ‘bdd’ } }

Note: You can always refer to this git repo for the sample code.

2 Likes

Thank you. It worked for me.

1 Like

@anishmehta I am running into another error, :

ERROR webdriver: Request failed with status 500 due to session-not-found: Unable to find the session info for particular sessionId d2b16b85-e57b-4d7a-a4d8-b9749724e9d9, maybe session has quit already or timed out.
ERROR @wdio/local-runner: Failed launching test session: session-not-found: Unable to find the session info for particular sessionId d2b16b85-e57b-4d7a-a4d8-b9749724e9d9, maybe session has quit already or timed out.
ERROR webdriver: Request failed with status 200 due to Error: invalid argument: Unsupported locator strategy: -android uiautomator

It is weird because my script test worked well with browserstack cloud service. I am trying to run automation test for a mobile app. this is my current config:

require('dotenv').config();

exports.config = {
    specs: [
        'features/runfolder/**.feature'
    ],
    maxInstances: 10,
    hostname: 'hub.lambdatest.com',
    port: 80,
    path: '/wd/hub',
    updateJob: false,
    sync: true,
    coloredLogs: true,
    after: function (result, capabilities, specs) {
        driver.execute("lambda-status=".concat(result == 0 ? "passed" : "failed"), undefined);
    },
    capabilities: {
        MobileApp: {
            capabilities: {
                deviceName: "Galaxy S10 Plus",
                platformVersion: "9",
                app: "APP10020521641393778397632",
                platform: "Android", // OS platform
                acceptInsecureCerts: true,
                autoGrantPermissions: true,
                name: "Demo Test lambda 1",
                build: "Demo Test lambda"
            }
        },
        WebBrowser: {
            capabilities: {
                browserName: 'chrome',
                acceptInsecureCerts: true
            }
        }
    },
    logLevel: 'info',
    bail: 0,
    baseUrl: '',
    waitforTimeout: 10000,
    connectionRetryTimeout: 500000,
    connectionRetryCount: 1,
    user: 'duong.tran2',
    key: '**************************************************',
    services: [
        ['lambdatest', {
            tunnel: false
        }],
        ['sauce', {
        }]
    ],
    framework: 'cucumber',
    reporters: [
        'spec',
        ['cucumberjs-json', {
            jsonFolder: '.tmp/new/android/',
            language: 'en',
        },
        ],
    ],
    cucumberOpts: {
        require: [
            './stepDefinitions/**/*.js'
        ],
        backtrace: false,
        requireModule: [],
        dryRun: false,
        failFast: false,
        format: ['pretty'],
        snippets: true,
        source: true,
        profile: [],
        strict: false,
        tagExpression: '',
        timeout: 60000,
        ignoreUndefinedDefinitions: false
    }
}