ElementTest.ts 55.6 KB
Newer Older
M
Mupceet 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052
/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import commonEvent from '@ohos.commonEvent';
import accessibility from '@ohos.accessibility';

const invalidString = 'xxx';

export class ElementTest {
    private context = undefined;
    private subScriber = undefined;
    private events: Array<any> = [];

    constructor(context) {
        this.context = context;
    }

    async init() {
        this.subScriber = await commonEvent.createSubscriber({events: ['caseExecute']});
        commonEvent.subscribe(this.subScriber, (err, data) => {
            console.info('ElementTest subscribe callback data:' + JSON.stringify(data));
            this.processCase(data);
        });
    }

    clear() {
        commonEvent.unsubscribe(this.subScriber);
        this.subScriber = undefined;
        this.context = undefined;
        this.events.length = 0;
    }

    pushEvent(event) {
        this.events.push(event);
    }

    private publishCaseResult(caseName: string, result: boolean) {
        let commonEventPublishData = {
            data: (result ? 'pass' : 'fail'),
            parameters: {
                case: caseName
            }
        }
        commonEvent.publish('caseResult', commonEventPublishData, (err) => {
            console.info("ElementTest publishCaseResult finish: " + JSON.stringify(commonEventPublishData));
        });
    }

    private async processCase(data) {
        let caseName = data.data;
        console.info('ElementTest processCase: ' + caseName);
        this.events.length = 0;
        let result = false;
        switch (caseName) {
            case 'AccessibilityElementTest_attributeNames_asyncPromise_0100':
                result = await this.executeAttributeNamesPromise(caseName);
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_0200':
                result = await this.executeAttributeValuePromise(caseName, 'componentId', 'number');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_0300':
                result = await this.executeAttributeValuePromise(caseName, 'pageId', 'number');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_0500':
                result = await this.executeAttributeValuePromise(caseName, 'inspectorKey', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_0600':
                result = await this.executeAttributeValuePromise(caseName, 'bundleName', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_0700':
                result = await this.executeAttributeValuePromise(caseName, 'componentType', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_0800':
                result = await this.executeAttributeValuePromise(caseName, 'inputType', 'number');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_0900':
                result = await this.executeAttributeValuePromise(caseName, 'text', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_1000':
                result = await this.executeAttributeValuePromise(caseName, 'hintText', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_1100':
                result = await this.executeAttributeValuePromise(caseName, 'description', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_1200':
                result = await this.executeAttributeValuePromise(caseName, 'resourceName', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_1400':
                result = await this.executeAttributeValuePromise(caseName, 'textLengthLimit', 'number');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_1500':
                result = await this.executeAttributeValuePromise(caseName, 'rect', 'object');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_1600':
                result = await this.executeAttributeValuePromise(caseName, 'checkable', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_1700':
                result = await this.executeAttributeValuePromise(caseName, 'checked', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_1800':
                result = await this.executeAttributeValuePromise(caseName, 'focusable', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_1900':
                result = await this.executeAttributeValuePromise(caseName, 'isVisible', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_2000':
                result = await this.executeAttributeValuePromise(caseName, 'accessibilityFocused', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_2100':
                result = await this.executeAttributeValuePromise(caseName, 'selected', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_2200':
                result = await this.executeAttributeValuePromise(caseName, 'clickable', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_2300':
                result = await this.executeAttributeValuePromise(caseName, 'longClickable', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_2400':
                result = await this.executeAttributeValuePromise(caseName, 'isEnable', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_2500':
                result = await this.executeAttributeValuePromise(caseName, 'isPassword', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_2600':
                result = await this.executeAttributeValuePromise(caseName, 'scrollable', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_2700':
                result = await this.executeAttributeValuePromise(caseName, 'editable', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_2900':
                result = await this.executeAttributeValuePromise(caseName, 'pluralLineSupported', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_3100':
                result = await this.executeAttributeValuePromise(caseName, 'isHint', 'boolean');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_3300':
                result = await this.executeAttributeValuePromise(caseName, 'itemCount', 'number');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_3400':
                result = await this.executeAttributeValuePromise(caseName, 'currentIndex', 'number');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_3500':
                result = await this.executeAttributeValuePromise(caseName, 'startIndex', 'number');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_3600':
                result = await this.executeAttributeValuePromise(caseName, 'endIndex', 'number');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_3700':
                result = await this.executeAttributeValuePromise(caseName, 'rangeInfo', 'object');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_4200':
                result = await this.executeAttributeValuePromise(caseName, 'error', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_4300':
                await this.executeAttributeValuePromiseTriggerAction(caseName);
                return;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_4400':
                result = await this.executeAttributeValuePromise(caseName, 'textMoveUnit', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_4500':
                result = await this.executeAttributeValuePromiseArray(caseName, 'contents', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_4600':
                result = await this.executeAttributeValuePromise(caseName, 'lastContent', 'string');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_4700':
                result = await this.executeAttributeValuePromise(caseName, 'parent', 'object');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_4800':
                result = await this.executeAttributeValuePromiseArray(caseName, 'children', 'object');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_5200':
                result = await this.executeAttributeValuePromise(caseName, 'isActive', 'boolean', true);
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_5300':
                result = await this.executeAttributeValuePromise(caseName, 'screenRect', 'object', true);
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_5400':
                result = await this.executeAttributeValuePromise(caseName, 'layer', 'number', true);
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_5500':
                result = await this.executeAttributeValuePromise(caseName, 'type', 'string', true);
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_5600':
                result = await this.executeAttributeValuePromiseRootElement(caseName);
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_5700':
                result = await this.executeAttributeValuePromise(caseName, 'windowId', 'number');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_5800':
                result = await this.executeAttributeValuePromise(caseName, 'isFocused', 'boolean');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_5900':
                result = await this.executeFindElementPromise5900(caseName);
                break;
            case 'AccessibilityElementTest_actionNames_asyncPromise_6000':
                result = await this.executeActionNamesPromise(caseName);
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_6100':
                result = await this.executePerformActionPromise(caseName, 'accessibilityFocus');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_6200':
                result = await this.executePerformActionPromise(caseName, 'clearAccessibilityFocus');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_6300':
                result = await this.executePerformActionPromise(caseName, 'focus');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_6400':
                result = await this.executePerformActionPromise(caseName, 'clearFocus');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_6500':
                result = await this.executePerformActionPromise(caseName, 'clearSelection');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_6600':
                result = await this.executePerformActionPromise(caseName, 'click');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_6700':
                result = await this.executePerformActionPromise(caseName, 'longClick');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_6800':
                result = await this.executePerformActionPromise(caseName, 'cut');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_6900':
                result = await this.executePerformActionPromise(caseName, 'copy');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_7000':
                result = await this.executePerformActionPromise(caseName, 'paste');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_7100':
                result = await this.executePerformActionPromise(caseName, 'select');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_7200':
                result = await this.executePerformActionPromise(caseName, 'setText');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_7300':
                result = await this.executePerformActionPromise(caseName, 'delete');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_7400':
                result = await this.executePerformActionPromise(caseName, 'scrollForward');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_7500':
                result = await this.executePerformActionPromise(caseName, 'scrollBackward');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_7600':
                result = await this.executePerformActionPromise(caseName, 'setSelection');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_7700':
                result = await this.executeFindElementPromiseByContent(caseName, 'xxx');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_7800':
                result = await this.executeFindElementPromiseByContent(caseName, 'button1');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_7900':
                result = await this.executeFindElementPromiseByFocusType(caseName, 'accessibility');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_8000':
                result = await this.executeFindElementPromiseByFocusType(caseName, 'normal');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_8100':
                result = await this.executeFindElementPromiseByFocusDirection(caseName, 'up');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_8200':
                result = await this.executeFindElementPromiseByFocusDirection(caseName, 'down');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_8300':
                result = await this.executeFindElementPromiseByFocusDirection(caseName, 'left');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_8400':
                result = await this.executeFindElementPromiseByFocusDirection(caseName, 'right');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_8500':
                result = await this.executeFindElementPromiseByFocusDirection(caseName, 'forward');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_8600':
                result = await this.executeFindElementPromiseByFocusDirection(caseName, 'backward');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_8700':
                result = await this.executeFindElementPromiseByFocusType(caseName, 'xxx');
                break;
            case 'AccessibilityElementTest_findElement_asyncPromise_8800':
                result = await this.executeFindElementPromiseByFocusDirection(caseName, 'xxx');
                break;
            case 'AccessibilityElementTest_performAction_asyncPromise_8900':
                result = await this.executePerformActionPromise(caseName, 'xxx');
                break;
            case 'AccessibilityElementTest_attributeValue_asyncPromise_9000':
                result = await this.executeAttributeValuePromise(caseName, 'xxx', '');
                break;
            case 'AccessibilityElementTest_attributeNames_asyncCallback_0100':
                await this.executeAttributeNamesCallback(caseName);
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_0200':
                await this.executeAttributeValueCallback(caseName, 'componentId', 'number');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_0300':
                await this.executeAttributeValueCallback(caseName, 'pageId', 'number');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_0500':
                await this.executeAttributeValueCallback(caseName, 'inspectorKey', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_0600':
                await this.executeAttributeValueCallback(caseName, 'bundleName', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_0700':
                await this.executeAttributeValueCallback(caseName, 'componentType', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_0800':
                await this.executeAttributeValueCallback(caseName, 'inputType', 'number');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_0900':
                await this.executeAttributeValueCallback(caseName, 'text', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_1000':
                await this.executeAttributeValueCallback(caseName, 'hintText', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_1100':
                await this.executeAttributeValueCallback(caseName, 'description', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_1200':
                await this.executeAttributeValueCallback(caseName, 'resourceName', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_1400':
                await this.executeAttributeValueCallback(caseName, 'textLengthLimit', 'number');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_1500':
                await this.executeAttributeValueCallback(caseName, 'rect', 'object');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_1600':
                await this.executeAttributeValueCallback(caseName, 'checkable', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_1700':
                await this.executeAttributeValueCallback(caseName, 'checked', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_1800':
                await this.executeAttributeValueCallback(caseName, 'focusable', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_1900':
                await this.executeAttributeValueCallback(caseName, 'isVisible', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_2000':
                await this.executeAttributeValueCallback(caseName, 'accessibilityFocused', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_2100':
                await this.executeAttributeValueCallback(caseName, 'selected', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_2200':
                await this.executeAttributeValueCallback(caseName, 'clickable', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_2300':
                await this.executeAttributeValueCallback(caseName, 'longClickable', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_2400':
                await this.executeAttributeValueCallback(caseName, 'isEnable', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_2500':
                await this.executeAttributeValueCallback(caseName, 'isPassword', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_2600':
                await this.executeAttributeValueCallback(caseName, 'scrollable', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_2700':
                await this.executeAttributeValueCallback(caseName, 'editable', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_2900':
                await this.executeAttributeValueCallback(caseName, 'pluralLineSupported', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_3100':
                await this.executeAttributeValueCallback(caseName, 'isHint', 'boolean');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_3300':
                await this.executeAttributeValueCallback(caseName, 'itemCount', 'number');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_3400':
                await this.executeAttributeValueCallback(caseName, 'currentIndex', 'number');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_3500':
                await this.executeAttributeValueCallback(caseName, 'startIndex', 'number');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_3600':
                await this.executeAttributeValueCallback(caseName, 'endIndex', 'number');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_3700':
                await this.executeAttributeValueCallback(caseName, 'rangeInfo', 'object');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_4200':
                await this.executeAttributeValueCallback(caseName, 'error', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_4300':
                await this.executeAttributeValueCallbackTriggerAction(caseName);
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_4400':
                await this.executeAttributeValueCallback(caseName, 'textMoveUnit', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_4500':
                await this.executeAttributeValueCallbackArray(caseName, 'contents', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_4600':
                await this.executeAttributeValueCallback(caseName, 'lastContent', 'string');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_4700':
                await this.executeAttributeValueCallback(caseName, 'parent', 'object');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_4800':
                await this.executeAttributeValueCallbackArray(caseName, 'children', 'object');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_5200':
                await this.executeAttributeValueCallback(caseName, 'isActive', 'boolean', true);
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_5300':
                await this.executeAttributeValueCallback(caseName, 'screenRect', 'object', true);
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_5400':
                await this.executeAttributeValueCallback(caseName, 'layer', 'number', true);
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_5500':
                await this.executeAttributeValueCallback(caseName, 'type', 'string', true);
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_5600':
                await this.executeAttributeValueCallbackRootElement(caseName);
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_5700':
                await this.executeAttributeValueCallback(caseName, 'windowId', 'number');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_5800':
                await this.executeAttributeValueCallback(caseName, 'isFocused', 'boolean');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_5900':
                await this.executeFindElementCallback5900(caseName);
                return;
            case 'AccessibilityElementTest_actionNames_asyncCallback_6000':
                await this.executeActionNamesCallback(caseName);
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_6100':
                await this.executePerformActionCallback(caseName, 'accessibilityFocus');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_6200':
                await this.executePerformActionCallback(caseName, 'clearAccessibilityFocus');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_6300':
                await this.executePerformActionCallback(caseName, 'focus');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_6400':
                await this.executePerformActionCallback(caseName, 'clearFocus');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_6500':
                await this.executePerformActionCallback(caseName, 'clearSelection');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_6600':
                await this.executePerformActionCallback(caseName, 'click');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_6700':
                await this.executePerformActionCallback(caseName, 'longClick');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_6800':
                await this.executePerformActionCallback(caseName, 'cut');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_6900':
                await this.executePerformActionCallback(caseName, 'copy');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_7000':
                await this.executePerformActionCallback(caseName, 'paste');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_7100':
                await this.executePerformActionCallback(caseName, 'select');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_7200':
                await this.executePerformActionCallback(caseName, 'setText');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_7300':
                await this.executePerformActionCallback(caseName, 'delete');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_7400':
                await this.executePerformActionCallback(caseName, 'scrollForward');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_7500':
                await this.executePerformActionCallback(caseName, 'scrollBackward');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_7600':
                await this.executePerformActionCallback(caseName, 'setSelection');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_7700':
                await this.executeFindElementCallbackByContent(caseName, 'xxx');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_7800':
                await this.executeFindElementCallbackByContent(caseName, 'button1');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_7900':
                await this.executeFindElementCallbackByFocusType(caseName, 'accessibility');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_8000':
                await this.executeFindElementCallbackByFocusType(caseName, 'normal');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_8100':
                await this.executeFindElementCallbackByFocusDirection(caseName, 'up');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_8200':
                await this.executeFindElementCallbackByFocusDirection(caseName, 'down');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_8300':
                await this.executeFindElementCallbackByFocusDirection(caseName, 'left');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_8400':
                await this.executeFindElementCallbackByFocusDirection(caseName, 'right');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_8500':
                await this.executeFindElementCallbackByFocusDirection(caseName, 'forward');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_8600':
                await this.executeFindElementCallbackByFocusDirection(caseName, 'backward');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_8700':
                await this.executeFindElementCallbackByFocusType(caseName, 'xxx');
                return;
            case 'AccessibilityElementTest_findElement_asyncCallback_8800':
                await this.executeFindElementCallbackByFocusDirection(caseName, 'xxx');
                return;
            case 'AccessibilityElementTest_performAction_asyncCallback_8900':
                await this.executePerformActionCallback(caseName, 'xxx');
                return;
            case 'AccessibilityElementTest_attributeValue_asyncCallback_9000':
                await this.executeAttributeValueCallback(caseName, 'xxx', '');
                return;
            default:
                console.warn('ElementTest processCase unknown!!!!!!!!!!');
                break;
        }
        this.publishCaseResult(caseName, result);
    }

    private async getBaseElement() {
        let element = undefined;
        if (this.context) {
            let root = await this.context.getWindowRootElement();
            let elements = await root.findElement('content', 'button1');
            element = elements[0];
        }
        return element;
    }

    private async getWindowElement() {
        let element = undefined;
        if (this.context) {
            let elements = await this.context.getWindows();
            element = elements[0];
        }
        return element;
    }

    private async executeAttributeNamesPromise(caseName: string): Promise<boolean> {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            let names = await element.attributeNames();
            console.info('ElementTest executeAttributeNamesPromise ' + caseName + ' names: ' + JSON.stringify(names));
            if (Array.isArray(names)) {
                result = true;
            }
        }
        return result;
    }

    private async executeAttributeValuePromise(caseName: string, input: string, outputType: string,
                                               isWindow: boolean = false): Promise<boolean> {
        let element = undefined;
        if (isWindow) {
            element = await this.getWindowElement();
        } else {
            element = await this.getBaseElement();
        }

        let result = false;
        if (element) {
            try {
                console.info('ElementTest executeAttributeValuePromise ' + caseName + ' input: ' + input + ', outputType: ' + outputType);
                let value = await element.attributeValue(input);
                console.info('ElementTest executeAttributeValuePromise ' + caseName + ' value: ' + JSON.stringify(value));
                if (typeof(value) == outputType) {
                    result = true;
                } else {
                    console.warn('ElementTest executeAttributeValuePromise ' + caseName + ' valueType: ' + typeof(value));
                }
            } catch (e) {
                console.info('ElementTest executeAttributeValuePromise ' + caseName + ' catch(e): ' + JSON.stringify(e));
                if (input == invalidString) {
                    result = true;
                }
            }
        }
        return result;
    }

    private async executeAttributeValuePromiseTriggerAction(caseName: string) {
        console.info('ElementTest executeAttributeValuePromiseTriggerAction ' + caseName + ' start');
        let event = new accessibility.EventInfo({});
        event.type = 'click';
        event.bundleName = 'com.example.myapplication';
        event.triggerAction = 'click';
        await accessibility.sendEvent(event);
        console.info('ElementTest executeAttributeValuePromiseTriggerAction ' + caseName + ' sendEvent finish');

        setTimeout(async () => {
            let result = false;
            console.info('ElementTest executeAttributeValuePromiseTriggerAction ' + caseName + ' events.length: ' + this.events.length);
            for (let e of this.events) {
                let target = e.target;
                let value = await target.attributeValue('triggerAction');
                console.info('ElementTest executeAttributeValuePromiseTriggerAction ' + caseName + ' valueType: ' + typeof(value));
                if (e.eventType == 'click' && typeof(value) == 'string') {
                    result = true;
                    break;
                }
            }
            this.publishCaseResult(caseName, result);
        }, 1000);
    }

    private async executeAttributeValuePromiseRootElement(caseName: string): Promise<boolean> {
        let element = undefined;
        if (this.context) {
            let base = await this.getBaseElement();
            if (base) {
                let baseWindowId = await base.attributeValue('windowId');
                let windows = await this.context.getWindows();
                for (let window of windows) {
                    let windowId = await window.attributeValue('windowId');
                    if (baseWindowId == windowId) {
                        element = window;
                        console.info('ElementTest executeAttributeValuePromiseRootElement ' + caseName + ' found window');
                        break;
                    }
                }
            }
        }

        let result = false;
        if (element) {
            console.info('ElementTest executeAttributeValuePromiseRootElement ' + caseName + ' input: rootElement, outputType: object');
            let value = await element.attributeValue('rootElement');
            console.info('ElementTest executeAttributeValuePromise ' + caseName + ' value: ' + JSON.stringify(value));
            if (typeof(value) == 'object') {
                result = true;
            } else {
                console.warn('ElementTest executeAttributeValuePromise ' + caseName + ' valueType: ' + typeof(value));
            }
        }
        return result;
    }

    private async executeAttributeValuePromiseArray(caseName: string, input: string, outputType: string): Promise<boolean> {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            console.info('ElementTest executeAttributeValuePromiseArray ' + caseName + ' input: ' + input + ', outputType: ' + outputType);
            let value = await element.attributeValue(input);
            console.info('ElementTest executeAttributeValuePromiseArray ' + caseName + ' value: ' + JSON.stringify(value));
            if (Array.isArray(value)) {
                if ((value.length == 0)||
                    (value.length > 0 && typeof(value[0]) == outputType)) {
                    result = true;
                }
            }
        }
        return result;
    }

    private async executeActionNamesPromise(caseName: string): Promise<boolean> {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            let actions = await element.actionNames();
            console.info('ElementTest executeActionNamesPromise ' + caseName + ' actions: ' + JSON.stringify(actions));
            if (Array.isArray(actions)) {
                if ((actions.length == 0) ||
                    (actions.length > 0 && typeof(actions[0]) == 'string')) {
                    result = true;
                }
            }
        }
        return result;
    }

    private async executePerformActionPromise(caseName: string, action: string, args?: object): Promise<boolean> {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            try {
                console.info('ElementTest executePerformActionPromise ' + caseName + ' action: ' + action + ', args: ' + JSON.stringify(args));
                let ret = await element.performAction(action, args);
                console.info('ElementTest executePerformActionPromise ' + caseName + ' ret: ' + JSON.stringify(ret));
                if (typeof(ret) == 'boolean') {
                    result = true;
                }
            } catch (e) {
                console.info('ElementTest executePerformActionPromise ' + caseName + ' catch(e): ' + JSON.stringify(e));
                if (action == invalidString) {
                    result = true;
                }
            }
        }
        return result;
    }

    private async executeFindElementPromiseByContent(caseName: string, condition: string): Promise<boolean> {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            try {
                console.info('ElementTest executeFindElementPromiseByContent ' + caseName + ' condition: ' + condition);
                let found = await element.findElement('content', condition);
                console.info('ElementTest executeFindElementPromiseByContent ' + caseName + ' element: ' + JSON.stringify(found));
                if (Array.isArray(found)) {
                    if (found.length == 0 || typeof(found[0]) == 'object') {
                        result = true;
                    }
                }
            } catch (e) {
                console.info('ElementTest executeFindElementPromiseByContent ' + caseName + ' catch(e): ' + JSON.stringify(e));
                if (condition == invalidString) {
                    result = true;
                }
            }
        }
        return result;
    }

    private async executeFindElementPromiseByFocusType(caseName: string, condition: string): Promise<boolean> {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            try {
                console.info('ElementTest executeFindElementPromiseByFocusType ' + caseName + ' condition: ' + condition);
                let action = (condition == 'accessibility') ? 'accessibilityFocus' : 'focus';
                let ret = await element.performAction(action);
                console.info('ElementTest executeFindElementPromiseByFocusType ' + caseName + ' performAction[' + action + '] ret: ' + ret);

                let found = await element.findElement('focusType', condition);
                console.info('ElementTest executeFindElementPromiseByFocusType ' + caseName + ' element: ' + JSON.stringify(found));
                if (typeof(found) == 'object') {
                    result = true;
                }

                if (ret) {
                    let clearAction = (condition == 'accessibility') ? 'clearAccessibilityFocus' : 'clearFocus';
                    await element.performAction(clearAction);
                }
            } catch (e) {
                console.info('ElementTest executeFindElementPromiseByFocusType ' + caseName + ' catch(e): ' + JSON.stringify(e));
                if (condition == invalidString) {
                    result = true;
                }
            }
        }
        return result;
    }

    private async executeFindElementPromiseByFocusDirection(caseName: string, condition: string): Promise<boolean> {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            try {
                console.info('ElementTest executeFindElementPromiseByFocusDirection ' + caseName + ' condition: ' + condition);
                let found = await element.findElement('focusDirection', condition);
                console.info('ElementTest executeFindElementPromiseByFocusDirection ' + caseName + ' element: ' + JSON.stringify(found));
                if (typeof(found) == 'object') {
                    result = true;
                }
            } catch (e) {
                console.info('ElementTest executeFindElementPromiseByFocusDirection ' + caseName + ' catch(e): ' + JSON.stringify(e));
                if (condition == invalidString) {
                    result = true;
                }
            }
        }
        return result;
    }

    private async executeFindElementPromise5900(caseName: string): Promise<boolean> {
        let result = false;
        let element = undefined;
        if (this.context) {
            let root = await this.context.getWindowRootElement();
            let elements = await root.findElement('content', 'button2');
            element = elements[0];
        }
        if (element) {
            console.info('ElementTest executeFindElementPromise5900 ' + caseName);
            let found = await element.findElement('focusDirection', 'down');
            console.info('ElementTest executeFindElementPromise5900 ' + caseName + ' element: ' + JSON.stringify(found));
            if (typeof(found) == 'object') {
                result = true;
            }
        }
        return result;
    }

    private async executeAttributeNamesCallback(caseName: string) {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            element.attributeNames((err, names) => {
                console.info('ElementTest executeAttributeNamesCallback ' + caseName + ' err: ' + JSON.stringify(err));
                console.info('ElementTest executeAttributeNamesCallback ' + caseName + ' names: ' + JSON.stringify(names));
                if (err.code == 0 && Array.isArray(names)) {
                    result = true;
                }
                this.publishCaseResult(caseName, result);
            });
        }
    }

    private async executeAttributeValueCallback(caseName: string, input: string,
                                                outputType: string, isWindow: boolean = false) {
        let element = undefined;
        if (isWindow) {
            element = await this.getWindowElement();
        } else {
            element = await this.getBaseElement();
        }

        let result = false;
        if (element) {
            console.info('ElementTest executeAttributeValueCallback ' + caseName + ' input: ' + input + ', outputType: ' + outputType);
            element.attributeValue(input, (err, value) => {
                console.info('ElementTest executeAttributeValueCallback ' + caseName + ' err: ' + JSON.stringify(err));
                console.info('ElementTest executeAttributeValueCallback ' + caseName + ' value: ' + JSON.stringify(value));
                if (input == invalidString && err.code != 0) {
                    result = true;
                } else if (err.code == 0 && typeof(value) == outputType) {
                    result = true;
                } else {
                    console.warn('ElementTest executeAttributeValueCallback ' + caseName + ' valueType: ' + typeof(value));
                }
                this.publishCaseResult(caseName, result);
            });
        }
    }

    private async executeAttributeValueCallbackTriggerAction(caseName: string) {
        console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' start');
        let event = new accessibility.EventInfo({});
        event.type = 'click';
        event.bundleName = 'com.example.myapplication';
        event.triggerAction = 'click';
        await accessibility.sendEvent(event);
        console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' sendEvent finish');

        setTimeout(() => {
            console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' events.length: ' + this.events.length);
            for (let i = 0; i < this.events.length; i++) {
                let target = this.events[i].target;
                let eventType = this.events[i].eventType;
                console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' target: ' + JSON.stringify(target));
                target.attributeValue('triggerAction', (err, value) => {
                    console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' err: ' + JSON.stringify(err));
                    console.info('ElementTest executeAttributeValueCallbackTriggerAction ' + caseName + ' valueType: ' + typeof(value));
                    if (err.code == 0 && eventType == 'click' && typeof(value) == 'string') {
                        this.publishCaseResult(caseName, true);
                    }
                });
            }
        }, 1000);
    }

    private async executeAttributeValueCallbackRootElement(caseName: string) {
        let element = undefined;
        if (this.context) {
            let base = await this.getBaseElement();
            if (base) {
                let baseWindowId = await base.attributeValue('windowId');
                let windows = await this.context.getWindows();
                for (let window of windows) {
                    let windowId = await window.attributeValue('windowId');
                    if (baseWindowId == windowId) {
                        element = window;
                        console.info('ElementTest executeAttributeValueCallbackRootElement ' + caseName + ' found window');
                        break;
                    }
                }
            }
        }

        let result = false;
        if (element) {
            console.info('ElementTest executeAttributeValueCallbackRootElement ' + caseName + ' input: rootElement, outputType: object');
            element.attributeValue('rootElement', (err, value) => {
                console.info('ElementTest executeAttributeValueCallback ' + caseName + ' err: ' + JSON.stringify(err));
                console.info('ElementTest executeAttributeValueCallback ' + caseName + ' value: ' + JSON.stringify(value));
                if (err.code == 0 && typeof(value) == 'object') {
                    result = true;
                } else {
                    console.warn('ElementTest executeAttributeValueCallback ' + caseName + ' valueType: ' + typeof(value));
                }
                this.publishCaseResult(caseName, result);
            });
        }
    }

    private async executeAttributeValueCallbackArray(caseName: string, input: string, outputType: string) {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            console.info('ElementTest executeAttributeValueCallbackArray ' + caseName + ' input: ' + input + ', outputType: ' + outputType);
            element.attributeValue(input, (err, value) => {
                console.info('ElementTest executeAttributeValueCallbackArray ' + caseName + ' err: ' + JSON.stringify(err));
                console.info('ElementTest executeAttributeValueCallbackArray ' + caseName + ' value: ' + JSON.stringify(value));
                if (err.code == 0 && Array.isArray(value)) {
                    if ((value.length == 0)||
                        (value.length > 0 && typeof(value[0]) == outputType)) {
                        result = true;
                    }
                }
                this.publishCaseResult(caseName, result);
            });
        }
    }

    private async executeActionNamesCallback(caseName: string) {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            element.actionNames((err, actions) => {
                console.info('ElementTest executeActionNamesCallback ' + caseName + ' err: ' + JSON.stringify(err));
                console.info('ElementTest executeActionNamesCallback ' + caseName + ' actions: ' + JSON.stringify(actions));
                if (err.code == 0 && Array.isArray(actions)) {
                    if ((actions.length == 0) ||
                        (actions.length > 0 && typeof(actions[0]) == 'string')) {
                        result = true;
                    }
                }
                this.publishCaseResult(caseName, result);
            });
            
        }
    }

    private async executePerformActionCallback(caseName: string, action: string, args?: object) {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            console.info('ElementTest executePerformActionCallback ' + caseName + ' action: ' + action + ', args: ' + JSON.stringify(args));
            element.performAction(action, args, (err, ret) => {
                console.info('ElementTest executePerformActionCallback ' + caseName + ' err: ' + JSON.stringify(err));
                console.info('ElementTest executePerformActionCallback ' + caseName + ' ret: ' + JSON.stringify(ret));
                if (action == invalidString && err.code != 0) {
                    result = true;
                } else if (err.code == 0 && typeof(ret) == 'boolean') {
                    result = true;
                }
                this.publishCaseResult(caseName, result);
            });
        }
    }

    private async executeFindElementCallbackByContent(caseName: string, condition: string) {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            console.info('ElementTest executeFindElementCallbackByContent ' + caseName + ' condition: ' + condition);
            element.findElement('content', condition, (err, found) => {
                console.info('ElementTest executeFindElementCallbackByContent ' + caseName + ' err: ' + JSON.stringify(err));
                console.info('ElementTest executeFindElementCallbackByContent ' + caseName + ' element: ' + JSON.stringify(found));
                if (condition == invalidString && err.code != 0) {
                    result = true;
                } else if (err.code == 0 && Array.isArray(found)) {
                    if (found.length == 0 || typeof(found[0]) == 'object') {
                        result = true;
                    }
                }
                this.publishCaseResult(caseName, result);
            });
        }
    }

    private async executeFindElementCallbackByFocusType(caseName: string, condition: string) {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' condition: ' + condition);
            let action = (condition == 'accessibility') ? 'accessibilityFocus' : 'focus';
            let ret = await element.performAction(action);
            console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' performAction[' + action + '] ret: ' + ret);

            element.findElement('focusType', condition, (err, found) => {
                console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' err: ' + JSON.stringify(err));
                console.info('ElementTest executeFindElementCallbackByFocusType ' + caseName + ' element: ' + JSON.stringify(found));
                if (condition == invalidString && err.code != 0) {
                    result = true;
                } else if (err.code == 0 && typeof(found) == 'object') {
                    result = true;
                }
                this.publishCaseResult(caseName, result);
            });

            setTimeout(async () => {
                if (ret && element) {
                    let clearAction = (condition == 'accessibility') ? 'clearAccessibilityFocus' : 'clearFocus';
                    await element.performAction(clearAction);
                }
            }, 1000);
        }
    }

    private async executeFindElementCallbackByFocusDirection(caseName: string, condition: string) {
        let result = false;
        let element = await this.getBaseElement();
        if (element) {
            console.info('ElementTest executeFindElementCallbackByFocusDirection ' + caseName + ' condition: ' + condition);
            element.findElement('focusDirection', condition, (err, found) => {
                console.info('ElementTest executeFindElementCallbackByFocusDirection ' + err + ' element: ' + JSON.stringify(err));
                console.info('ElementTest executeFindElementCallbackByFocusDirection ' + caseName + ' element: ' + JSON.stringify(found));
                if (condition == invalidString && err.code != 0) {
                    result = true;
                } else if (err.code == 0 && typeof(found) == 'object') {
                    result = true;
                }
                this.publishCaseResult(caseName, result);
            });
        }
    }

    private async executeFindElementCallback5900(caseName: string) {
        let result = false;
        let element = undefined;
        if (this.context) {
            let root = await this.context.getWindowRootElement();
            let elements = await root.findElement('content', 'button2');
            element = elements[0];
        }
        if (element) {
            console.info('ElementTest executeFindElementCallback5900 ' + caseName);
            element.findElement('focusDirection', 'down', (err, found) => {
                console.info('ElementTest executeFindElementCallback5900 ' + caseName + ' err: ' + JSON.stringify(err));
                console.info('ElementTest executeFindElementCallback5900 ' + caseName + ' element: ' + JSON.stringify(found));
                if (err.code == 0 && typeof(found) == 'object') {
                    result = true;
                }
                this.publishCaseResult(caseName, result);
            });
        }
    }
}