@@ -425,119 +425,6 @@ def test_file_management
425
425
File . delete 'pic_folder.zip'
426
426
end
427
427
428
- def test_image_element
429
- skip 'Requires `npm install -g appium opencv4nodejs`' unless `npm list -g opencv4nodejs` . include? 'opencv4nodejs'
430
-
431
- @driver . rotation = :portrait
432
-
433
- el = @driver . find_element :accessibility_id , 'NFC'
434
- @driver . save_element_screenshot el , 'test/functional/data/test_android_nfc.png'
435
-
436
- image_element = @driver . find_element_by_image AppiumLibCoreTest . path_of ( 'test/functional/data/test_android_nfc.png' )
437
-
438
- assert image_element . inspect
439
- assert image_element . hash
440
- assert image_element . ref =~ /\A appium-image-element-[a-z0-9\- ]+/
441
-
442
- el_location = el . location
443
- image_location = image_element . location
444
- assert_in_delta el_location . x , image_location . x , 1
445
- assert_in_delta el_location . y , image_location . y , 1
446
-
447
- el_size = el . size
448
- image_size = image_element . size
449
- assert_in_delta el_size . width , image_size . width , 1
450
- assert_in_delta el_size . height , image_size . height , 1
451
-
452
- el_rect = el . rect
453
- image_rect = image_element . rect
454
- assert_in_delta el_rect . x , image_rect . x , 1
455
- assert_in_delta el_rect . y , image_rect . y , 1
456
- assert_in_delta el_rect . width , image_rect . width , 1
457
- assert_in_delta el_rect . height , image_rect . height , 1
458
-
459
- assert_equal el . displayed? , image_element . displayed?
460
- image_element . click
461
-
462
- assert @driver . find_element :accessibility_id , 'TechFilter'
463
- @driver . back
464
- end
465
-
466
- def test_image_elements
467
- skip 'Requires `npm install -g appium opencv4nodejs`' unless `npm list -g opencv4nodejs` . include? 'opencv4nodejs'
468
-
469
- @driver . rotation = :landscape
470
-
471
- el = @driver . find_element :accessibility_id , 'App'
472
- @driver . save_element_screenshot el , 'test/functional/data/test_android_app.png'
473
-
474
- image_elements = @driver . find_elements_by_image AppiumLibCoreTest . path_of ( 'test/functional/data/test_android_app.png' )
475
- image_element = image_elements [ 0 ]
476
-
477
- assert image_element . inspect
478
- assert image_element . hash
479
- assert image_element . ref =~ /\A appium-image-element-[a-z0-9\- ]+/
480
-
481
- el_location = el . location
482
- image_location = image_element . location
483
- assert_in_delta el_location . x , image_location . x , 1
484
- assert_in_delta el_location . y , image_location . y , 1
485
-
486
- el_size = el . size
487
- image_size = image_element . size
488
- assert_in_delta el_size . width , image_size . width , 1
489
- assert_in_delta el_size . height , image_size . height , 1
490
-
491
- el_rect = el . rect
492
- image_rect = image_element . rect
493
- assert_in_delta el_rect . x , image_rect . x , 1
494
- assert_in_delta el_rect . y , image_rect . y , 1
495
- assert_in_delta el_rect . width , image_rect . width , 1
496
- assert_in_delta el_rect . height , image_rect . height , 1
497
-
498
- assert_equal el . displayed? , image_element . displayed?
499
- image_element . click
500
-
501
- assert @driver . find_element :accessibility_id , 'Action Bar'
502
- @driver . back
503
- end
504
-
505
- def test_template_scale_ratio
506
- skip 'Requires `npm install -g appium opencv4nodejs`' unless `npm list -g opencv4nodejs` . include? 'opencv4nodejs'
507
-
508
- @driver . rotation = :portrait
509
-
510
- el = @driver . find_element :accessibility_id , 'NFC'
511
- @driver . save_element_screenshot el , 'test/functional/data/test_android_nfc.png'
512
-
513
- @driver . update_settings ( { defaultImageTemplateScale : 4 } )
514
-
515
- image_element = @driver . find_element_by_image AppiumLibCoreTest . path_of ( 'test/functional/data/test_android_nfc_270.png' )
516
- assert image_element . inspect
517
- assert image_element . hash
518
- assert image_element . ref =~ /\A appium-image-element-[a-z0-9\- ]+/
519
-
520
- el_location = el . location
521
- image_location = image_element . location
522
- assert_in_delta el_location . x , image_location . x , 3
523
- assert_in_delta el_location . y , image_location . y , 3
524
-
525
- el_size = el . size
526
- image_size = image_element . size
527
- assert_in_delta el_size . width , image_size . width , 3
528
- assert_in_delta el_size . height , image_size . height , 3
529
-
530
- el_rect = el . rect
531
- image_rect = image_element . rect
532
- assert_in_delta el_rect . x , image_rect . x , 3
533
- assert_in_delta el_rect . y , image_rect . y , 3
534
- assert_in_delta el_rect . width , image_rect . width , 3
535
- assert_in_delta el_rect . height , image_rect . height , 3
536
-
537
- assert_equal el . displayed? , image_element . displayed?
538
- image_element . click
539
- end
540
-
541
428
private
542
429
543
430
def scroll_to ( text )
0 commit comments