Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add support of mobitru screen recording feature #5307

Merged
merged 14 commits into from
Aug 20, 2024

Conversation

dubovik-sergey
Copy link
Contributor

No description provided.

@dubovik-sergey dubovik-sergey requested a review from a team as a code owner August 14, 2024 15:31
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.64%. Comparing base (fa31539) to head (f616f60).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #5307   +/-   ##
=========================================
  Coverage     97.63%   97.64%           
- Complexity     6941     6967   +26     
=========================================
  Files           958      961    +3     
  Lines         20153    20224   +71     
  Branches       1323     1323           
=========================================
+ Hits          19676    19747   +71     
  Misses          368      368           
  Partials        109      109           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@valfirst valfirst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also please make sure Codecov is happy

Comment on lines 49 to 58
String stopDeviceScreenRecording(String deviceId) throws MobitruOperationException;

/**
* Stop the screen recording on the device with specified UDID.
*
* @param recordingId The ID of the recording artifact
* @return Binary content of the recording artifact.
* @throws MobitruOperationException In case of any issues during start the recording.
*/
byte[] downloadDeviceScreenRecording(String recordingId) throws MobitruOperationException;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in facade it makes sense to have a single method stopDeviceScreenRecording that will return a POJO with the recording ID and its binary content

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean to add bute[] content field to org.vividus.mobitru.client.model.ScreenRecording and then specify it in the facade method?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about Mobitru REST API and its mapping to model ScreenRecording, probably there should be another POJO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but downloadDeviceScreenRecording API call just returns a byte array.
how this another POJO should look like in this case ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just create a new object in the code from the results of 2 API calls

public record ScreenRecording(String recordingId, byte[] content)
{
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean that I should have 2 screen recording classes?
because, right now, I already have org.vividus.mobitru.client.model.ScreenRecording, which is using as DTO for result of stopRecording API and it contains recordingId only.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean that I should have 2 screen recording classes?

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -46,6 +51,7 @@ public Map<String, Object> getExtraCapabilities(DesiredCapabilities desiredCapab
{
deviceId = mobitruFacade.takeDevice(desiredCapabilities);
mobitruFacade.installApp(deviceId, appFileName, installApplicationOptions);
testContext.put(KEY, deviceId);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess device ID should be available in session capabilities, thus I would avoid managing this data on test data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked and it's not avaialble

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Web iOS - capabilities from server:
    {
      "appium:dc" : "US",
      "appium:networkConnectionEnabled" : false,
      "appium:takesScreenshot" : true,
      "appium:automationName" : "XCUITest",
      "appium:locationContextEnabled" : false,
      "appium:platformVersion" : "17.3",
      "appium:webDriverAgentUrl" : "http://mstf-node:7504",
      "appium:databaseEnabled" : false,
      "appium:udid" : "00008130-001958513EBA001C",
      "browserName" : "Safari",
      "appium:webStorageEnabled" : false,
      "appium:deviceName" : "IPHONE iPhone16,1",
      "appium:javascriptEnabled" : true,
      "platformName" : "IOS"
    }
    I guess, it is appium:udid, isn't it?
  2. Web Android - capabilities from server:
    {
      "appium:dc" : "US",
      "appium:chromedriverPort" : 37415,
      "appium:takesScreenshot" : true,
      "appium:warnings" : { },
      "appium:desired" : {
        "browserName" : "Chrome",
        "goog:chromeOptions" : {
          "args" : [ ],
          "extensions" : [ ]
        },
        "platformName" : "Android",
        "platformVersion" : "14",
        "deviceName" : "SAMSUNG SM-S928U1",
        "udid" : "127.0.0.1:37293",
        "dc" : "US",
        "chromedriverExecutableDir" : "/mount/chromedriver",
        "chromedriverPort" : 37415
      },
      "appium:deviceApiLevel" : 34,
      "appium:locationContextEnabled" : false,
      "appium:deviceScreenSize" : "1080x2340",
      "appium:deviceManufacturer" : "samsung",
      "appium:chromedriverExecutableDir" : "/mount/chromedriver",
      "appium:udid" : "127.0.0.1:37293",
      "appium:pixelRatio" : 2.8125,
      "goog:chromeOptions" : {
        "args" : [ ],
        "extensions" : [ ]
      },
      "browserName" : "Chrome",
      "platformName" : "ANDROID",
      "appium:networkConnectionEnabled" : true,
      "appium:deviceScreenDensity" : 450,
      "appium:viewportRect" : {
        "left" : 0,
        "top" : 76,
        "width" : 1080,
        "height" : 2146
      },
      "appium:deviceModel" : "SM-S928U1",
      "appium:platformVersion" : "14",
      "appium:databaseEnabled" : false,
      "appium:deviceUDID" : "127.0.0.1:37293",
      "appium:statBarHeight" : 76,
      "appium:webStorageEnabled" : false,
      "appium:appActivity" : "com.google.android.apps.chrome.Main",
      "appium:deviceName" : "SAMSUNG SM-S928U1",
      "appium:javascriptEnabled" : true,
      "appium:appPackage" : "com.android.chrome"
    }
    appium:deviceUDID looks incorrect, is it Mobitru bug?
  3. Native mobile iOS app - capabilities from server:
    {
      "appium:dc" : "CIS",
      "appium:networkConnectionEnabled" : false,
      "mobitru-device-search:manufacturer" : "IPAD",
      "appium:takesScreenshot" : true,
      "appium:automationName" : "XCUITest",
      "appium:locationContextEnabled" : false,
      "appium:platformVersion" : "17.2",
      "appium:webDriverAgentUrl" : "http://mstf-node:7480",
      "mobitru-device-search:model" : "iPad",
      "appium:databaseEnabled" : false,
      "appium:udid" : "00008020-000669981A43002E",
      "appium:webStorageEnabled" : false,
      "appium:deviceName" : "IPAD iPad11,1",
      "appium:javascriptEnabled" : true,
      "platformName" : "IOS",
      "mobitru-device-search:type" : "tablet"
    }
    I guess, it is appium:udid, isn't it?
  4. Native Android app - capabilities from server:
    {
      "appium:dc" : "EU",
      "appium:chromedriverPort" : 45497,
      "appium:takesScreenshot" : true,
      "appium:warnings" : { },
      "appium:desired" : {
        "mobitru-device-search:type" : "phone",
        "platformName" : "Android",
        "mobitru-device-search:manufacturer" : "SAMSUNG",
        "udid" : "127.0.0.1:42833",
        "automationName" : "UIAutomator2",
        "platformVersion" : "12",
        "deviceName" : "SAMSUNG SM-A525F",
        "dc" : "EU",
        "chromedriverExecutableDir" : "/mount/chromedriver",
        "chromedriverPort" : 45497
      },
      "appium:deviceApiLevel" : 31,
      "appium:automationName" : "UIAutomator2",
      "appium:locationContextEnabled" : false,
      "appium:deviceScreenSize" : "1080x2400",
      "appium:deviceManufacturer" : "samsung",
      "appium:chromedriverExecutableDir" : "/mount/chromedriver",
      "appium:udid" : "127.0.0.1:42833",
      "appium:pixelRatio" : 2.625,
      "platformName" : "ANDROID",
      "mobitru-device-search:type" : "phone",
      "appium:networkConnectionEnabled" : true,
      "mobitru-device-search:manufacturer" : "SAMSUNG",
      "appium:deviceScreenDensity" : 420,
      "appium:viewportRect" : {
        "left" : 0,
        "top" : 87,
        "width" : 1080,
        "height" : 2099
      },
      "appium:deviceModel" : "SM-A525F",
      "appium:platformVersion" : "12",
      "appium:databaseEnabled" : false,
      "appium:deviceUDID" : "127.0.0.1:42833",
      "appium:statBarHeight" : 87,
      "appium:webStorageEnabled" : false,
      "appium:deviceName" : "SAMSUNG SM-A525F",
      "appium:javascriptEnabled" : true
    }
    the same as for web Android

Copy link
Contributor Author

@dubovik-sergey dubovik-sergey Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes and please look at p.4 where there is no real UDID of the Device:
"udid" : "127.0.0.1:42833", "appium:udid" : "127.0.0.1:42833", "appium:deviceUDID" : "127.0.0.1:42833",

only IPs

the same for Android web

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so obviously it's a Mobitru bug, I believe many people are affected, is this bug going to be fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a bug, because this option is not required by official Appium capabilities and, according to this, this situation doesn't affect our users

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a bug because 127.0.0.1:42833 is not UDID, if this option is not mandatory, then it could be removed, but as it's present, it contains invalid value

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bug has been reported to Support, nevertheless, there should be some class which represents Mobitru storage, e.g. MobitruTestContext, so that data sharing won't happen by re-using key and access test context

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not a bug :) because ip:port as UDID is the normal behaviour for Android adb connection over network (not usb):

more details can be found here https://developer.android.com/tools/adb#:~:text=Confirm%20that%20your%20host%20computer%20is%20connected%20to%20the%20target%20device%3A

@valfirst
Copy link
Collaborator

Tested in #5318

@valfirst valfirst merged commit e41e651 into vividus-framework:master Aug 20, 2024
17 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants