android_tests/lib/android/specs/android/helper.rb in appium_lib-3.0.0 vs android_tests/lib/android/specs/android/helper.rb in appium_lib-3.0.1

- old
+ new

@@ -72,6 +72,37 @@ wait { find('accessibility node provider').click } wait { id 'accessibility_node_provider' } # Accessibility/Accessibility Node Provider 2.times { back } end + t '_parse_current_app_line' do + # test values from appium's test/unit/adb-specs.js + expected = [ + # api 16 line + ['mFocusedApp=AppWindowToken{417ee228 token=Token{41602f78 ActivityRecord{41798a08 io.appium.android.apis/.ApiDemos}}}', + 'io.appium.android.apis', + '.ApiDemos'], + # api 18 line + ['mFocusedApp=AppWindowToken{41744660 token=Token{41ac7198 ActivityRecord{41af55c8 u0 io.appium.android.apis/.ApiDemos}}}', + 'io.appium.android.apis', + '.ApiDemos'], + # api 19 + ['mFocusedApp=AppWindowToken{b40af858 token=Token{b3e2ce38 ActivityRecord{b3eb47d8 u0 io.appium.android.apis/.ApiDemos t6}}}', + 'io.appium.android.apis', + '.ApiDemos' + # api 16 selendroid + ], + ['mFocusedApp=AppWindowToken{4157a2c8 token=Token{41582628 ActivityRecord{415821f0 com.android.launcher/com.android.launcher2.Launcher}}}', + 'com.android.launcher', + 'com.android.launcher2.Launcher' + ] + ] + + expected.each do |line, package, activity| + parsed = _parse_current_app_line(line) + raise "failed to parse #{line}" if parsed.nil? + parsed.package.must_equal package + parsed.activity.must_equal activity + parsed.am_start.must_equal package + '/' + activity + end + end end \ No newline at end of file