Giter VIP home page Giter VIP logo

Comments (3)

bsmithb2 avatar bsmithb2 commented on June 17, 2024

Hi there!

I haven't been able to test the code against windows (as the corresponding idevice plugin doesn't support IOS, or specifically IOS doesn't support Windows).

The code you have an issue with however relates to this stage:

    async init () {
        debug.log('[android] init()');

        const devices = [];

        debug.log('[android] ---- Device/Browser List ----');

        let deviceLines = await this._shellExec('adb devices');

        deviceLines = deviceLines.slice(1); // remove the first line `List of devices attached`
        
        for (const deviceLine of deviceLines) {
            const deviceId = deviceLine.split(/(\t+)/)[0];  
            
            if (deviceId.length === 0) continue; // not a device
            
            const deviceModel = (await this._shellExec(`adb -s ${deviceId} shell getprop ro.vendor.product.model`))[0];
            
            for (const browser of Object.values(this._browserDefinitions)) {
                const packageListLines = await this._shellExec(`adb -s ${deviceId} shell cmd package list package ${browser.packageName}`);

                if (packageListLines[0] !== `package:${browser.packageName}`) continue; // package not installed
                
                const alias = `${deviceModel}:${deviceId}:${browser.name}`;

                devices.push(alias);

                debug.log('[android] ' + alias);
            }
        }
        
        if (devices.length === 0) 
            throw new Error('No devices returned from adb. Check your simulators and device connectivity using adb. Check your adb devices command.');
        
        this._browserList = devices;
    },

So my hypothesis is either the regex isn't detecting the tab between the emulator-5554 and device, or the adb shell package command is not returning. @htho implemented that step I believe, as I don't remember why it would be there. Either try testcafe in debug mode (-d) or see what the output of the adb shell command is and go from there.

You might need to patch the code locally, adding some windows specific debugging for the issue.

Good luck and let us know how you go!

from testcafe-browser-provider-android.

htho avatar htho commented on June 17, 2024

@realfaisalk I also think it has something to do with the output of adb devices
please insert console.log(JSON.stringify(deviceLines)) at Line 175 and post the output of that line here. (I'd prefer as text, we could add a test then).

Hint: In PowerShell copying text is as simple as mark and right-click. It is copied to the clipboard then. Another right click will insert the clipboards content to the command line.

@bsmithb2 I edited your comment to include syntax-highlighting.

from testcafe-browser-provider-android.

htho avatar htho commented on June 17, 2024

@realfaisalk You should also check if the browsers are properly installed/recognized:

  • adb shell cmd package list package com.android.chrome
  • adb shell cmd package list package org.mozilla.firefox

The first line returned by these command should be

  • package:com.android.chrome
  • package:org.mozilla.firefox

from testcafe-browser-provider-android.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.