visual-testing icon indicating copy to clipboard operation
visual-testing copied to clipboard

folder not created for mobile browser like desktop_chrome

Open amitAutoS opened this issue 5 years ago • 11 comments

I am using Perfecto cloud for my testing. When I run my scripts, I am able to create/see folders like desktop_chrome or desktop_firefox where it stores reference and actual screenshots. Now I am trying to test on Android mobile on Perfecto cloud. ISSUE: It is not creating the folders but storing the screenshots directly under reference/actual folder. How can I make it create another folder just like desktop_firefox. P.S - I am not using Appium.

Capabilities in wdio.conf.js:

// FF
    {
      maxInstances: 5,
      platformName: 'Mac',
      platformVersion: 'macOS Mojave',
      browserName: 'Firefox',
      browserVersion: '76',
      resolution: '1920x1080',
},

//Android Mobile browser
{
        maxInstances: 1,
        platformName: 'Android',       //iOS or Android
        platformVersion: 'latest',
        browserName: 'MobileOS',
        model: 'Pixel',
        orientation: 'PORTRAIT',
        openDeviceTimeout: 3
}

amitAutoS avatar May 12 '20 05:05 amitAutoS

Same here with Browserstack - tested with Google Pixel and iPhone 8.

smichaelsen avatar May 12 '20 19:05 smichaelsen

@amitAutoS and @smichaelsen

This is because of this line of code https://github.com/wswebcreation/webdriver-image-comparison/blob/cce70cb4174b8b3b94e4e8d17771a26ae8d90914/lib/helpers/utils.ts#L17

It will only be stored in a separate folder if the deviceName is present in the capabilities, which is not the case based on the provided capabilities. I can take a look at optimising this, can you do me a favour and post the outcome of the following line of code if you run this during the execution

console.log('capabilities = ', browser.capabilities)

Then I can see what both vendors are giving back and maybe I can then enhance the module in providing the correct data

wswebcreation avatar May 13 '20 06:05 wswebcreation

[0-0] capabilities =  {
  webStorageEnabled: false,
  locationContextEnabled: false,
  browserName: 'safari',
  platform: 'MAC',
  javascriptEnabled: true,
  databaseEnabled: false,
  takesScreenshot: true,
  networkConnectionEnabled: false,
  platformVersion: '12.1',
  useXctestrunFile: true,
  bootstrapPath: '/usr/local/.browserstack/config/wda_derived_data_29d7f376ebaf29d0ed70291cb4519e5fe8a0712c_1.16.0/Build/Products',
  orientation: 'PORTRAIT',
  'browserstack.isTargetBased': 'true',
  udid: '29d7f376ebaf29d0ed70291cb4519e5fe8a0712c',
  device: 'iphone',
  os_version: '13',
  real_mobile: true,
  'browserstack.appium_version': '1.16.0',
  acceptSslCerts: true,
  'browserstack.video': 'false',
  acceptSslCert: true,
  detected_language: 'webdriver/6.1.4',
  new_bucketing: true,
  osVersion: '13',
  deviceName: 'iPhone 8',
  'browserstack.appiumVersion': '1.16.0',
  buildName: 'Local: 13.05.2020, 10:22',
  projectName: 'XXX My Project Name XXX',
  'browserstack.debug': 'false',
  'browserstack.tunnelIdentifier': '',
  browser: 'iphone',
  'browserstack.appiumLogs': 'true',
  version: '',
  mobile: { browser: 'mobile', version: 'iPhone 8-13.2' },
  orig_os: 'ios',
  '64bit': false,
  proxy_type: 'node',
  realMobile: 'true',
  appium_port: 8086,
  automationName: 'XCUITest',
  safariInitialUrl: 'http://mobile-internet-check.browserstack.com',
  webkitResponseTimeout: 20000,
  deviceOrientation: 'portrait',
  'browserstack.ie.noFlash': 'false',
  platformName: 'iOS',
  autoAcceptAlerts: true,
  newCommandTimeout: 300,
  safariIgnoreFraudWarning: true,
  noReset: true,
  wda_port: '28406'
}

smichaelsen avatar May 13 '20 08:05 smichaelsen

When I run on Chrome/FF on Perfecto, I still don't see deviceName coming in capabilities but it does create the folder like desktop_chrome, here's the output:

capabilities =  {
  reportPdfUrl: 'https://*.app.perfectomobile.com/export/api/v1/test-executions/pdf?externalId[0]=192E7E0AFB2B82C8078D421509BE9287--@@100.72.231.232@@1589359382763',
  networkConnectionEnabled: false,
  videoStartTime: 1589359384345,
  testGridReportUrl: 'https://*.app.perfectomobile.com/reporting/library?externalId[0]=192E7E0AFB2B82C8078D421509BE9287--@@100.72.231.232@@1589359382763',
  browserActualVersion: '81',
  pageLoadStrategy: 'normal',
  streamInfo: '{\n' +
    '  "url": "https://*.web.au.perfectomobile.com/fast/view/?sessionId\\u003d192E7E0AFB2B82C8078D421509BE9287--@@100.72.228.129@@1589359382763@971341d9-b04d-47a9-99ea-7a7df14b5515",\n' +
    '  "type": "JS_STREAM",\n' +
    '  "authenticationType": "PERFECTO_HEADER"\n' +
    '}',
  deviceId: '2_35A1F2CA-B0C4-45A9-B8C3-*',
  resolution: '1920x1080',
  version: '81',
  platform: 'MAC',
  executionId: '192E7E0AFB2B82C8078D421509BE9287--@@100.72.231.232@@1589359382763',
  videoUrl: 'https://*.vod-download-01.perfectomobile.com/*/9b1a6d14a5a9b292d6ea9aa9d8dbdb757c6a05914b3284eb12d4f218a48977a2/26120886241d9eb580110814cf8ed95e4048644c2188ae7d14b06ae0f1daf8ef.mp4',
  'webdriver.remote.sessionid': '192E7E0AFB2B82C8078D421509BE9287--@@100.72.231.232@@1589359382763',
  browserVersion: '81',
  platformVersion: 'macOS Mojave',
  browserName: 'Chrome',
  takesScreenshot: true,
  javascriptEnabled: true,
  location: 'APAC-AUS-SYD',
  platformName: 'Mac',
  cssSelectorsEnabled: true
}

When I run on Mobile browser on Perfecto, I see deviceName coming in capabilities BUT it does not create the folder, here's the output:

[0-0] capabilities =  {
  assert_javascript_enabled: true,
  browserName: 'MobileOS',
  deviceName: 'FA6AF0302631',
  deviceSessionId: 'amit.*@com_RemoteWebDriver_20-05-13_08_48_08_65647',
  entityType: 'remote_web_driver',
  executionId: 'amit.*@com_RemoteWebDriver_20-05-13_08_48_08_65647',
  host: '*.perfectomobile.com',
  model: 'Pixel',
  openDeviceTimeout: 3,
  orientation: 'PORTRAIT',
  password: '',
  platformName: 'android',
  platformVersion: 'latest',
  reportPdfUrl: 'https://*.app.perfectomobile.com/export/api/v1/test-executions/pdf?externalId[0]=amit.*@com_RemoteWebDriver_20-05-13_08_48_08_65647&_timestamp[0]=1589359688360',
  scriptName: 'RemoteWebDriver',
  securityToken: '',
  serverConnector: '',
  streamInfo: '{"url":"https://fast-image-ap-southeast-2.aws-prod.perfectomobile.com/stream/61282a53-1d22-4f90-b993-199eedff3901/","type":"FAST_IMAGE_STREAM","httpMethod":null,"authenticationType":null}',
  testGridReportUrl: 'https://*.app.perfectomobile.com/reporting/library?externalId[0]=amit.*@com_RemoteWebDriver_20-05-13_08_48_08_65647&_timestamp[0]=1589359688360',
  user: '',
  'webdriver.remote.sessionid': 'b772e291-3619-4963-b7f9-5c1416e489ee'
}

amitAutoS avatar May 13 '20 08:05 amitAutoS

@amitAutoS

deviceName is something for mobile devices, officially it is a mandatory field for Appium. Cloud vendors tend to work around that one. The module looks at how YOU determine the deviceName in the capabilities, not in how the vendor is giving them back. The reason for asking you to log it was for me to understand how I solve this in the future

You can also see the difference between what Perfecto and Browserstack are giving back for information. In your case I can use the deviceName, but Perfecto gives the deviceName back as a unrecognisable string. So I don't know if that is useful for you

wswebcreation avatar May 13 '20 09:05 wswebcreation

    iPhone8: {
        device: 'iPhone 8',
        deviceName: 'iPhone 8',
        os_version: '13',
        real_mobile: 'true',
    },

With these capabilities the correct folder is created, which is great. 👍

I do screenshots with Chrome in 2 resolutions. I'd also like two separate folders for them. However setting something like deviceName: 'Chome XL', does not work, because BrowserStack evaluates this property and doesn't know that browser.

How about introducing a new property like folderName?

smichaelsen avatar May 13 '20 12:05 smichaelsen

@smichaelsen

Yeah, that would be an option, need to think of it, but if you have a solution feel free to come up with a PR for https://github.com/wswebcreation/webdriver-image-comparison

wswebcreation avatar May 21 '20 06:05 wswebcreation

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 22 '20 18:08 stale[bot]

Any update on this issue? Its still a problem when using browserstack as the above suggestion doesn't resolve the folder creation issue

AKQA-DanH avatar Jun 09 '22 16:06 AKQA-DanH

No, not yet, any help would be appreciated

wswebcreation avatar Jun 13 '22 05:06 wswebcreation

This is at least solved for Browserstack

wswebcreation avatar Mar 17 '24 07:03 wswebcreation