Closed deepakarorawins closed 1 month ago
@deepakarorawins
device-farm is baked with dashboard. No separate installation is needed.
appium-dashboard-plugin is no longer supported.
DeviceManager is also not maintained coz all the logic is handled by the plugin. Let us know what is stopping you, may be we can help
Hi @saikrishna321,
I use below method to initialize driver, where selectAvailableDevice() method is used to set DeviceManager's isAvaliable property to true, and after test set it to false.
Also, with the help of setLogFileRouting() method we generate log files per mobile.
If I use device-farm plugin (which I want to use :)) it will conflict with my existing methods.
public class BaseTest {
@Parameters({"username", "password", "region", "environment"})
@BeforeClass
public void startAppiumDriverClassLevel(String username, String password, String region, String environment) throws Exception {
if (parallel.equalsIgnoreCase("class") || parallel.equalsIgnoreCase("classes")) {
utils.log().info("Parallel execution at class level");
URL url;
IOSDriver driver;
**selectAvailableDevice();**
**setLogFileRouting(getDevice());**
try {
if (environment.equals("prod")) {
initializeAppStoreDriver();
downloadAppFromAppStore();
}
DesiredCapabilities desiredCapabilities = createDesiredCapabilities(getDevice(), environment, region);
if (getDevice().getPlatformName().equalsIgnoreCase("android")) {
CommandPrompt cmd = new CommandPrompt();
cmd.runCommand("adb shell pm clear " + desiredCapabilities.getCapability("appium:appPackage"));
//cmd.runCommand("adb shell pm clear com.milwaukeetool.mymilwaukee_TEST");
} else {
configureAppPath(desiredCapabilities, environment);
}
driver = new IOSDriver(new URL("http://127.0.0.1:" + utils.getAppiumPort()), desiredCapabilities);
setDriver(driver);
WebDriverRunner.setWebDriver(driver);
utils.log().debug(format("driver initialized: %s", driver));
handleAlerts(getDriver());
} catch (Exception e) {
utils.log().fatal(format("driver initialization failure. ABORT!!!%s%s", System.lineSeparator(), e));
throw e;
}
}
}
}
private void selectAvailableDevice() { synchronized (DeviceHandler.deviceDetails) { for (DeviceManager device : DeviceHandler.deviceDetails) { if (device.getIsAvaliable()) { setDevice(device); getDevice().setIsAvaliable(false); utils.log().debug(format("Debug %s is now in use for %s", device.getDeviceName(), this.getClass().getName())); break; } } } }
private void setLogFileRouting(DeviceManager selectedDevice) {
String logPath = "logs" + File.separator + selectedDevice.getPlatformName() + "_" + selectedDevice.getDeviceName();
File logFile = new File(logPath);
if (!logFile.exists()) {
logFile.mkdirs();
}
ThreadContext.put("ROUTINGKEY", logPath);
utils.log().debug(format("log path: %s", logPath));
}
Selecting the available device is moved to device-farm responsibility.
@saikrishna321 and how we can get separate log file per device saved at desired location?
@deepakarorawins Are you talking about device logs ?
@saikrishna321 I am talking about applicatoin logs
We don't support! These are the one which should come under debug logs. Please raise an issue for this we will support in future release.
ok, Thank you @saikrishna321 I'll create the issue as you suggested.
As mentioned in https://github.com/sudharsan-selvaraj/appium-dashboard-plugin/tree/master that We have successfully integrated the dashboard with the appium-device-farm plugin.
So now,
Do we still need to install "appium-dashboard-plugin" separately or it will installed with "appium-device-farm" ?
Can we use only "appium-dash-board", without having "appium-device-farm" from ATD?
Note: The only reason I am asking this because we are still using "DeviceManager" in our framework and it look a little bit big task to move on to device-farm plugin.