Best JavaScript code snippet using cavy
test.js
Source:test.js  
...3const DEFAULT_RUN_OPTIONS        = { selectorTimeout: DEFAULT_SELECTOR_TIMEOUT };4const DEFAULT_CHROME_RUN_OPTIONS = { only: 'chrome', selectorTimeout: DEFAULT_SELECTOR_TIMEOUT };5describe('[API] Selector', function () {6    it('Should provide basic properties in HTMLElement snapshots', function () {7        return runTests('./testcafe-fixtures/selector-test.js', 'HTMLElement snapshot basic properties', DEFAULT_RUN_OPTIONS);8    });9    it('Should provide basic properties in SVGElement snapshots', function () {10        return runTests('./testcafe-fixtures/selector-test.js', 'SVGElement snapshot basic properties', DEFAULT_RUN_OPTIONS);11    });12    it('Should provide input-specific properties in element snapshots', function () {13        return runTests('./testcafe-fixtures/selector-test.js', 'Input-specific element snapshot properties', DEFAULT_RUN_OPTIONS);14    });15    it('Should provide `innerText` property in element snapshots', function () {16        return runTests('./testcafe-fixtures/selector-test.js', '`innerText` element snapshot property', DEFAULT_RUN_OPTIONS);17    });18    it('Should provide node snapshots for non-element nodes', function () {19        return runTests('./testcafe-fixtures/selector-test.js', 'Non-element node snapshots', DEFAULT_RUN_OPTIONS);20    });21    it('Should accept string as constructor argument', function () {22        return runTests('./testcafe-fixtures/selector-test.js', 'String ctor argument', DEFAULT_RUN_OPTIONS);23    });24    it('Should wait for element to appear in DOM', function () {25        return runTests('./testcafe-fixtures/selector-test.js', 'Wait for element in DOM', DEFAULT_RUN_OPTIONS);26    });27    it('Should return `null` if element does not appear within given time', function () {28        return runTests('./testcafe-fixtures/selector-test.js', 'Element does not appear', { selectorTimeout: 300 });29    });30    it('Should check element visibility if option is enabled', function () {31        return runTests('./testcafe-fixtures/selector-test.js', 'Visibility check', DEFAULT_RUN_OPTIONS);32    });33    it('Should use timeout specified via property', function () {34        return runTests('./testcafe-fixtures/selector-test.js', 'Timeout', { selectorTimeout: 4000 });35    });36    it('Should provide "selector" method in node snapshot', function () {37        return runTests('./testcafe-fixtures/selector-test.js', 'Snapshot `selector` method', DEFAULT_RUN_OPTIONS);38    });39    it('Should provide "hasClass" method in node snapshot', function () {40        return runTests('./testcafe-fixtures/selector-test.js', 'Snapshot `hasClass` method', DEFAULT_RUN_OPTIONS);41    });42    it('Should provide "addCustomDOMProperties" method in node snapshot', function () {43        return runTests('./testcafe-fixtures/selector-test.js', 'Selector `addCustomDOMProperties` method', DEFAULT_RUN_OPTIONS);44    });45    it('Should provide "addCustomMethods" method in node snapshot', function () {46        return runTests('./testcafe-fixtures/selector-test.js', 'Selector `addCustomMethods` method', DEFAULT_RUN_OPTIONS);47    });48    it('Selector `addCustomMethods` method - Selector mode', function () {49        return runTests('./testcafe-fixtures/selector-test.js', 'Selector `addCustomMethods` method - Selector mode', DEFAULT_RUN_OPTIONS);50    });51    it('Should wait for element to appear on new page', function () {52        return runTests('./testcafe-fixtures/selector-test.js', 'Element on new page', DEFAULT_RUN_OPTIONS);53    });54    it('Should provide snapshot property shorthands on selector', function () {55        return runTests('./testcafe-fixtures/selector-test.js', 'Snapshot properties shorthands on selector', DEFAULT_CHROME_RUN_OPTIONS);56    });57    it('Should filter results with `nth()` method', function () {58        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "nth()" method', DEFAULT_CHROME_RUN_OPTIONS);59    });60    it('Should filter results with `withText()` method', function () {61        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "withText" method', DEFAULT_CHROME_RUN_OPTIONS);62    });63    it('Should filter results with `withExactText()` method', function () {64        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "withExactText" method', DEFAULT_CHROME_RUN_OPTIONS);65    });66    it('Should filter results with `withAttribute()` method', function () {67        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "withAttribute" method', DEFAULT_CHROME_RUN_OPTIONS);68    });69    it('Should filter results with `filter()` method', function () {70        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "filter" method', DEFAULT_CHROME_RUN_OPTIONS);71    });72    it('Should filter using combination of filter methods', function () {73        return runTests('./testcafe-fixtures/selector-test.js', 'Combination of filter methods', DEFAULT_CHROME_RUN_OPTIONS);74    });75    it('Should provide methods for filtering by visibility for plain structure of HTML elements', function () {76        return runTests('./testcafe-fixtures/selector-test.js', 'Selector `filterVisible/filterHidden` methods with plain structure', DEFAULT_RUN_OPTIONS);77    });78    it('Should provide methods for filtering by visibility for hierarchical structure of HTML elements', function () {79        return runTests('./testcafe-fixtures/selector-test.js', 'Selector `filterVisible/filterHidden` methods with hierarchical structure', DEFAULT_RUN_OPTIONS);80    });81    it('Should provide .find() method', function () {82        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "find" method', DEFAULT_RUN_OPTIONS);83    });84    it('Should provide .parent() method', function () {85        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "parent" method', DEFAULT_RUN_OPTIONS);86    });87    it('Should provide .child() method', function () {88        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "child" method', DEFAULT_RUN_OPTIONS);89    });90    it('Should provide .sibling() method', function () {91        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "sibling" method', DEFAULT_RUN_OPTIONS);92    });93    it('Should provide .nextSibling() method', function () {94        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "nextSibling" method', DEFAULT_RUN_OPTIONS);95    });96    it('Should provide .prevSibling() method', function () {97        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "prevSibling" method', DEFAULT_RUN_OPTIONS);98    });99    it('Should provide "exists" and "count" properties', function () {100        return runTests('./testcafe-fixtures/selector-test.js', 'Selector "count" and "exists" properties', DEFAULT_RUN_OPTIONS);101    });102    it('Should provide dependencies and index argument to selector filter', function () {103        return runTests('./testcafe-fixtures/selector-test.js', 'Selector filter dependencies and index argument', DEFAULT_CHROME_RUN_OPTIONS);104    });105    it('Should provide filter origin argument', function () {106        return runTests('./testcafe-fixtures/selector-test.js', 'Selector filter origin node argument', DEFAULT_CHROME_RUN_OPTIONS);107    });108    it('Should provide hasAttribute method', function () {109        return runTests('./testcafe-fixtures/selector-test.js', 'hasAttribute method', DEFAULT_RUN_OPTIONS);110    });111    describe('Errors', function () {112        it('Should handle errors in Selector code', function () {113            return runTests('./testcafe-fixtures/selector-error-test.js', 'Error in code', { shouldFail: true })114                .catch(function (errs) {115                    expect(errs[0]).contains('An error occurred in Selector code:');116                    expect(errs[0]).contains('Error: Hey ya!');117                    expect(errs[0]).contains('> 11 |    await selector();');118                });119        });120        it('Should raise error if non-DOM node returned', function () {121            return runTests('./testcafe-fixtures/selector-error-test.js', 'Return non-DOM node', { shouldFail: true })122                .catch(function (errs) {123                    expect(errs[0]).contains(124                        'Function that specifies a selector can only return a DOM node, an array of nodes, ' +125                        'NodeList, HTMLCollection, null or undefined. Use ClientFunction to return other values.'126                    );127                    expect(errs[0]).contains("> 15 |    await Selector(() => 'hey')();");128                });129        });130        it('Should raise an error if Selector ctor argument is not a function or string', function () {131            return runTests('./testcafe-fixtures/selector-error-test.js', 'Selector fn is not a function or string', {132                shouldFail: true,133                only:       'chrome'134            }).catch(function (errs) {135                expect(errs[0].indexOf(136                    'Selector is expected to be initialized with a function, CSS selector string, another Selector, ' +137                    'node snapshot or a Promise returned by a Selector, but number was passed.'138                )).eql(0);139                expect(errs[0]).contains('> 19 |    await Selector(123)();');140            });141        });142        it("Should raise error if snapshot property shorthand can't find element in DOM tree", function () {143            return runTests('./testcafe-fixtures/selector-error-test.js', "Snapshot property shorthand - selector doesn't match any element", {144                shouldFail: true,145                only:       'chrome'146            })147                .catch(function (errs) {148                    expect(errs[0]).contains(149                        'Cannot obtain information about the node because the specified selector does not match any node in the DOM tree.' +150                        '  > | Selector(\'#someUnknownElement\')'151                    );152                    expect(errs[0]).contains("> 23 |    await Selector('#someUnknownElement').tagName;");153                });154        });155        it("Should raise error if snapshot shorthand method can't find element in DOM tree", function () {156            return runTests('./testcafe-fixtures/selector-error-test.js', "Snapshot shorthand method - selector doesn't match any element", {157                shouldFail: true,158                only:       'chrome'159            })160                .catch(function (errs) {161                    expect(errs[0]).contains(162                        'Cannot obtain information about the node because the specified selector does not match any node in the DOM tree.' +163                        '  > | Selector(\'#someUnknownElement\')'164                    );165                    expect(errs[0]).contains("> 27 |    await Selector('#someUnknownElement').getStyleProperty('width');");166                });167        });168        it('Should raise error if error occurs in selector during shorthand property evaluation', function () {169            return runTests('./testcafe-fixtures/selector-error-test.js', 'Snapshot property shorthand - selector error', {170                shouldFail: true,171                only:       'chrome'172            })173                .catch(function (errs) {174                    expect(errs[0]).contains(175                        'An error occurred in Selector code:'176                    );177                    expect(errs[0]).contains('> 31 |    await Selector(() => [].someUndefMethod()).nodeType;');178                });179        });180        it('Should raise error if error occurs in selector during shorthand method evaluation', function () {181            return runTests('./testcafe-fixtures/selector-error-test.js', 'Snapshot shorthand method - selector error', {182                shouldFail: true,183                only:       'chrome'184            })185                .catch(function (errs) {186                    expect(errs[0]).contains(187                        'An error occurred in Selector code:'188                    );189                    expect(errs[0]).contains("> 35 |    await Selector(() => [].someUndefMethod()).hasClass('yo');");190                });191        });192        it('Should raise error if error occurs in selector during "count" property evaluation', function () {193            return runTests('./testcafe-fixtures/selector-error-test.js', 'Snapshot "count" property - selector error', {194                shouldFail: true,195                only:       'chrome'196            })197                .catch(function (errs) {198                    expect(errs[0]).contains(199                        'An error occurred in Selector code:'200                    );201                    expect(errs[0]).contains('> 39 |    await Selector(() => [].someUndefMethod()).count;');202                });203        });204        it('Should raise error if error occurs in selector during "exists" property evaluation', function () {205            return runTests('./testcafe-fixtures/selector-error-test.js', 'Snapshot "exists" property - selector error', {206                shouldFail: true,207                only:       'chrome'208            })209                .catch(function (errs) {210                    expect(errs[0]).contains(211                        'An error occurred in Selector code:'212                    );213                    expect(errs[0]).contains('> 43 |    await Selector(() => [].someUndefMethod()).exists;');214                });215        });216        it('Should raise error if custom DOM property throws an error',217            function () {218                return runTests('./testcafe-fixtures/selector-error-test.js', 'Add custom DOM properties method - property throws an error', {219                    shouldFail: true,220                    only:       'chrome'221                })222                    .catch(function (errs) {223                        expect(errs[0]).contains(224                            'An error occurred when trying to calculate a custom Selector property "prop":  Error: test'225                        );226                        expect(errs[0]).contains('> 53 |    await el();');227                    });228            }229        );230        it('Should raise error if custom method throws an error',231            function () {232                return runTests('./testcafe-fixtures/selector-error-test.js', 'Add custom method - method throws an error', {233                    shouldFail: true,234                    only:       'chrome'235                })236                    .catch(function (errs) {237                        expect(errs[0]).contains(238                            'An error occurred in customMethod code:  Error: test'239                        );240                        expect(errs[0]).contains('> 63 |    await el.customMethod();');241                    });242            }243        );244        it('Should raise error if custom method throws an error - Selector mode',245            function () {246                return runTests('./testcafe-fixtures/selector-error-test.js', 'Add custom method - method throws an error - Selector mode', {247                    shouldFail: true,248                    only:       'chrome'249                })250                    .catch(function (errs) {251                        expect(errs[0]).contains(252                            'An error occurred in Selector code:  Error: test'253                        );254                        expect(errs[0]).contains('> 73 |    await el.customMethod()();');255                    });256            }257        );258    });259    describe('Regression', function () {260        it("Should execute successfully if derivative selector doesn't have options (GH-716)", function () {261            return runTests('./testcafe-fixtures/selector-test.js', 'Derivative selector without options', DEFAULT_CHROME_RUN_OPTIONS);262        });263        it('Should select <option> element by text in Firefox (GH-861)', function () {264            return runTests('./testcafe-fixtures/selector-test.js', '<option> text selector', {265                only:            'firefox',266                selectorTimeout: 3000267            });268        });269    });...unit-tests.js
Source:unit-tests.js  
...14 * steps have already been performed.15 *16 * @param testName17 */18function runTests(testName){19    it(testName + '(runJalangi)', function (done) {                                     /* subtest 1: run the Jalangi-instrumented code */20        this.timeout(10000);21        common.runJalangi(testName, INPUT_DIR, ACTUAL_OUTPUT_DIR);22        done();23    });24    it(testName + '(checkoutput)', function (done) {                                    /* subtest 2: check that the expected output is computed */25        common.checkGeneratedCode(testName, ACTUAL_OUTPUT_DIR, EXPECTED_OUTPUT_DIR);26        done();27    });28    it(testName + 'checkGraph', function (done) {29        common.checkGeneratedGraph(testName, ACTUAL_OUTPUT_DIR, EXPECTED_OUTPUT_DIR);30        done();31    });32}33/**34 * The test suite. Runs all the sub-tests on all the test cases.35 */36describe('unit-tests', function() {37    // note: need to keep the "describe" here so that the WebStorm IDE will let us re-run individual tests.38    describe('NewPromiseImmediateResolve', function() { runTests('NewPromiseImmediateResolve'); }); // new Promise, resolve39    describe('NewPromiseImmediateReject', function() { runTests('NewPromiseImmediateReject'); }); // new Promise, reject40    describe('NewPromiseResolveThen1', function() { runTests('NewPromiseResolveThen1'); }); // new Promise, resolve, then (anon function)41    describe('NewPromiseResolveThen2', function() { runTests('NewPromiseResolveThen2'); }); // new Promise, resolve, then (named function)42    describe('PromiseResolveThen', function() { runTests('PromiseResolveThen'); }); // Promise.resolve(), then43    describe('NewPromiseThenThen', function() { runTests('NewPromiseThenThen'); }); // new Promise, then, then44    describe('NewPromiseResolveTwoArgThenThen', function() { runTests('NewPromiseResolveTwoArgThenThen'); });  // new Promise, resolve, two-arg then, then45    describe('NewPromiseRejectTwoArgThenCatch', function() { runTests('NewPromiseRejectTwoArgThenCatch'); });  // new Promise, reject, two-arg then, catch46    describe('NewPromiseResolveTwoArgThenCatch', function() { runTests('NewPromiseResolveTwoArgThenCatch'); });  // new Promise, resolve, two-arg then, catch (not triggered)47    describe('NewPromiseRejectTwoArgThenThen', function() { runTests('NewPromiseRejectTwoArgThenThen'); });    // new Promise, reject, two-arg then, then48    describe('PromiseChain1', function() { runTests('PromiseChain1'); }); // new Promise, resolve, then, then, catch49    describe('PromiseChain2', function() { runTests('PromiseChain2'); }); // new Promise, resolve, then, then, catch50    describe('PromiseChain3', function() { runTests('PromiseChain3'); }); // new Promise, resolve, then, then, catch51    describe('PromiseChain4', function() { runTests('PromiseChain4'); }); // new Promise, resolve, then, catch52    describe('PromiseChain5', function() { runTests('PromiseChain5'); }); // Promise.resolve, then, skip several thens, catch53    describe('PromiseChain6', function() { runTests('PromiseChain6'); }); // Promise.resolve, then, skip several thens, catch54    describe('BypassCatch', function() { runTests('BypassCatch'); }); // Promise.resolve, catch, using default catch onResolve55    describe('NewPromiseThenImplicitReturns', function() { runTests('NewPromiseThenImplicitReturns'); }); // new Promise, resolve, then (implicit return), then (implicit return)56    describe('NewPromiseBranchingThens1', function() { runTests('NewPromiseBranchingThens1'); }); // two then reactions on the same promise57    describe('NewPromiseBranchingThens2', function() { runTests('NewPromiseBranchingThens2'); }); // two then reactions on the same promise58    describe('NewPromiseBranchingThens3', function() { runTests('NewPromiseBranchingThens3'); }); // two then reactions on the same promise59    describe('NewPromiseResolveLater1', function() { runTests('NewPromiseResolveLater1'); }); // assign resolve fun to variable, invoke later60    describe('NewPromiseResolveLater2', function() { runTests('NewPromiseResolveLater2'); }); // assign resolve fun to variable, invoke later61    describe('NewPromiseResolveAsync', function() { runTests('NewPromiseResolveAsync'); }); // new Promise, resolve asynchronously via setTimeout62    describe('NewPromiseRejectAsync', function() { runTests('NewPromiseRejectAsync'); }); // new Promise, reject asynchronously via setTimeout63    describe('LinkedPromises1', function() { runTests('LinkedPromises1'); }); // example of linked promises64    describe('LinkedPromises2', function() { runTests('LinkedPromises2'); }); // example of linked promises with setTimeOut resolve65    describe('LinkedPromises3', function() { runTests('LinkedPromises3'); }); // example of linked promises with explicit then onReject66    describe('LinkedPromises4', function() { runTests('LinkedPromises4'); }); // example of linked promises with default then onReject67    describe('LinkedPromises5', function() { runTests('LinkedPromises5'); }); // example of linked promises with default then onReject and catch68    describe('LinkedPromises6', function() { runTests('LinkedPromises6'); }); // example of linked promises with setTimeOut reject69    describe('LinkedByResolve', function() { runTests('LinkedByResolve'); });70    describe('LinkedByResolve2', function() { runTests('LinkedByResolve2'); });71    describe('PromiseReturnObjReject', function() { runTests('PromiseReturnObjReject'); });72    describe('PromiseReturnObjResolve', function() { runTests('PromiseReturnObjResolve'); });73    describe('PromiseReturnObjLinking1', function() { runTests('PromiseReturnObjLinking1'); });74    describe('PromiseReturnObjLinking2', function() { runTests('PromiseReturnObjLinking2'); });75    describe('PromiseReturnObjChain1', function() { runTests('PromiseReturnObjChain1'); });76    describe('PromiseReturnObjChain2', function() { runTests('PromiseReturnObjChain2'); });77    describe('PromiseReturnObjChain3', function() { runTests('PromiseReturnObjChain3'); });78    describe('PromiseReturnFunReject', function() { runTests('PromiseReturnFunReject'); });79    describe('PromiseReturnFunResolve', function() { runTests('PromiseReturnFunResolve'); });80    describe('PromiseReturnFunAsync1', function() { runTests('PromiseReturnFunAsync1'); });81    describe('PromiseReturnFunAsync2', function() { runTests('PromiseReturnFunAsync2'); });82    describe('PromiseReturnArrReject', function() { runTests('PromiseReturnArrReject'); });83    describe('PromiseReturnArrResolve', function() { runTests('PromiseReturnArrResolve'); });84    describe('PromiseReturnArrCatch1', function() { runTests('PromiseReturnArrCatch1'); });85    describe('PromiseReturnArrCatch2', function() { runTests('PromiseReturnArrCatch2'); });86    describe('AllResolve', function() { runTests('AllResolve'); });   // resolved Promise.all()87    describe('AllResolveAndReject', function() { runTests('AllResolveAndReject'); });   // rejected Promise.all()88    describe('AllAsyncResolve', function() { runTests('AllAsyncResolve'); });   // Promise.all() asynchronously resolved (most cases)89    describe('AllAsyncReject', function() { runTests('AllAsyncReject'); });   // Promise.all() asynchronously rejected90    describe('AllSyncResolve', function() { runTests('AllSyncResolve'); });   // Promise.all() synchronously resolved (only with an empty input array)91    describe('AllFailFirstBehaviour', function() { runTests('AllFailFirstBehaviour'); });   // Promise.all() immediately rejected after first rejected input92    describe('AllPendingFulfillment', function() { runTests('AllPendingFulfillment'); });   // Promise.all() pending fulfillment when an argument is never fulfilled (and nothing is rejected)93    describe('AllRejectedWhilePending', function() { runTests('AllRejectedWhilePending'); });   // Promise.all() rejected (one input promise is never fulfilled)94    describe('RacePrimitivesOnly', function() { runTests('RacePrimitivesOnly'); });95    describe('RaceResolve1', function() { runTests('RaceResolve1'); });96    describe('RaceResolve2', function() { runTests('RaceResolve2'); });97    describe('RaceReject1', function() { runTests('RaceReject1'); });98    describe('RaceReject2', function() { runTests('RaceReject2'); });99    describe('RacePend', function() { runTests('RacePend'); });100    describe('RaceMultipleReject1', function() { runTests('RaceMultipleReject1'); });101    describe('RaceMultipleResolve1', function() { runTests('RaceMultipleResolve1'); });102    describe('MultipleFulfillPrim1', function() { runTests('MultipleFulfillPrim1'); });103    describe('MultipleFulfillPrim2', function() { runTests('MultipleFulfillPrim2'); });104    describe('MultipleFulfillFunc1', function() { runTests('MultipleFulfillFunc1'); });105    describe('MultipleFulfillFunc2', function() { runTests('MultipleFulfillFunc2'); });106    describe('MultipleFulfillObj1', function() { runTests('MultipleFulfillObj1'); });107    describe('MultipleFulfillObj2', function() { runTests('MultipleFulfillObj2'); });108    describe('PromiseBranch0', function() { runTests('PromiseBranch0'); });109    describe('PromiseBranch', function() { runTests('PromiseBranch'); });110    describe('PromiseBranch2', function() { runTests('PromiseBranch2'); });111    describe('PromiseBranch3', function() { runTests('PromiseBranch3'); });112    describe('PromiseBranch4', function() { runTests('PromiseBranch4'); });113    describe('PromiseProxyThen', function() { runTests('PromiseProxyThen'); });114    describe('ReturnNewBluebirdPromise', function() { runTests('ReturnNewBluebirdPromise'); }); // new bluebird Promise115    describe('ReturnNewBluebirdPromiseThen', function() { runTests('ReturnNewBluebirdPromiseThen'); }); // call then on new bluebird Promise116    describe('BluebirdPromiseChain', function() { runTests('BluebirdPromiseChain'); });117    describe('BluebirdPromiseReject', function() { runTests('BluebirdPromiseReject'); });118    describe('PosterExample', function() { runTests('PosterExample'); }); //git di119    // examples of buggy promise-based programs120    describe('BugDeadPromise1', function() { runTests('BugDeadPromise1'); }); //121    describe('BugDeadPromise2', function() { runTests('BugDeadPromise2'); }); //122    describe('BugDeadPromise3', function() { runTests('BugDeadPromise3'); }); //123    describe('BugDoubleSettle1', function() { runTests('BugDoubleSettle1'); }); //124    describe('BugDoubleSettle2', function() { runTests('BugDoubleSettle2'); }); //125    describe('BugMissingReturn1', function() { runTests('BugMissingReturn1'); }); //126    describe('BugMissingReturn2', function() { runTests('BugMissingReturn2'); }); //127    describe('BugMissingReturn3', function() { runTests('BugMissingReturn3'); }); //128    describe('BugMissingReturn4', function() { runTests('BugMissingReturn4'); }); //129    describe('BrokenPromiseChain', function() { runTests('BrokenPromiseChain'); }); //130    describe('BrokenPromiseChain2', function() { runTests('BrokenPromiseChain2'); }); //131    describe('PromiseCallbackHell', function() { runTests('PromiseCallbackHell'); });132    describe('MultipleThens1', function() { runTests('MultipleThens1'); }); // new Promise, resolve133    describe('MultipleThensError1', function() { runTests('MultipleThensError1'); }); // new Promise, resolve134    describe('MultipleThensError2', function() { runTests('MultipleThensError2'); }); // new Promise, resolve135    describe('PromisesInLoop1', function() { runTests('PromisesInLoop1'); }); // new Promise, resolve136    describe('PromisesInLoop2', function() { runTests('PromisesInLoop2'); }); // new Promise, resolve137    describe('MissingExceptionalReject2', function() { runTests('MissingExceptionalReject2'); }); //138    describe('MissingExceptionalReject3', function() { runTests('MissingExceptionalReject3'); }); //139    describe('MissingExceptionalRejectCaughtLater', function() { runTests('MissingExceptionalRejectCaughtLater'); }); //140    describe('MissingExceptionalRejectCaughtLater2', function() { runTests('MissingExceptionalRejectCaughtLater2'); }); //141    describe('ExplicitConstructionAntiPattern', function() { runTests('ExplicitConstructionAntiPattern'); });142    // several cases where a non-function argument is passed to "then" or "catch"143    // rename them to something more appropriate144    describe('BugOther1', function() { runTests('BugOther1'); }); //145    describe('BugOther2', function() { runTests('BugOther2'); }); //146    describe('BugOther3', function() { runTests('BugOther3'); }); //147    describe('BugOther4', function() { runTests('BugOther4'); }); //148    // bug patterns149    describe('DeadPromise', function() { runTests('DeadPromise'); }); //150    describe('MissingResolveOrReject', function() { runTests('MissingResolveOrReject'); }); //151    describe('MissingExceptionalReject', function() { runTests('MissingExceptionalReject'); }); //152    // create many promises in a loop153    describe('Loop1', function() { runTests('Loop1'); }); //154    // use the same function as a reaction for multiple promises155    describe('SharedReaction', function() { runTests('SharedReaction'); }); //156    describe('SharedReactionFunction', function() { runTests('SharedReactionFunction'); });157    // throwing a promise in a reaction TODO test doesn't exist158    // describe('ThrowPromise', function() { runTests('ThrowPromise'); }); //...runTests.js
Source:runTests.js  
1// REGISTER module path FOR PLUGINS2dojo.registerModulePath("plugins","../../plugins");	3dojo.registerModulePath("t","../../t/unit");	4// DOJO TEST MODULES5dojo.require("doh.runner");6//dojo.require("dojoc.util.loader");7// Agua TEST MODULES8dojo.require("t.doh.util");9// TESTED MODULES10dojo.require("plugins.dojox.Timer");11var Agua;12var Data;13var data;14var runStatus;15dojo.addOnLoad(function(){16	17doh.registerGroup("plugins.dojox.timing",18[19// TEST attenuate20{21	name: "attenuate",22	timeout : 30000,23	runTest: function() {24		25		console.log("runTests    attenuate");26	27		// SET DEFERRED OBJECT28		var deferred = new doh.Deferred({29			timeout: 40000});30		// FLAG31		var flag = false;32		var counter = 0;33		var checkFlag = function (object) {34			counter++;35			console.log("runTests    checkFlag " + counter + " onTick: " + new Date().toTimeString());36			return flag;37		};38		// SET TIMER39		var timer = new plugins.dojox.Timer({40			poll: checkFlag,41			interval: 1000,42			attenuate : true43		});44		timer.start();45		46		// TEST AFTER FIRST queryStatus47		setTimeout(function() {48			try {49				console.log("runTests    FIRST TIMEOUT");50				console.log("runTests    timer.completed IS FALSE");51				doh.assertFalse(timer.completed);52				console.log("runTests    flag NOT NULL");53				doh.assertFalse(flag == null);54				console.log("runTests    flag NOT TRUE");55				doh.assertFalse(flag == true);56				console.log("runTests    timer.polling IS TRUE");57				doh.assertTrue(timer.polling == true);58		59				//deferred.callback(true);60		61			} catch(e) {62			  deferred.errback(e);63			}64		}, 5000);65		66		// TEST AFTER FIRST queryStatus67		setTimeout(function() {68			try {69				console.log("runTests    SECOND TIMEOUT");70				console.log("runTests    timer.completed IS FALSE")71				doh.assertFalse(timer.completed);72				console.log("runTests    flag NOT NULL")73				doh.assertFalse(flag == null);74				console.log("runTests    flag NOT TRUE")75				doh.assertFalse(flag == true);76				flag = true;77				console.log("runTests    flag IS TRUE")78				doh.assertTrue(flag == true);79				console.log("runTests    timer.polling IS TRUE");80				doh.assertTrue(timer.polling == true);81				82				//deferred.callback(true);83				84			} catch(e) {}85		}, 10000);86		87		// TEST AFTER FIRST queryStatus88		setTimeout(function() {89			try {90				console.log("runTests    THIRD TIMEOUT");91				console.log("runTests    flag IS NOT FALSE")92				doh.assertFalse(flag == false);93				console.dir({timer:timer});94				console.log("runTests    timer.polling IS FALSE");95				doh.assertTrue(timer.polling == false);96				console.log("runTests    counter IS CORRECT");97				doh.assertTrue(counter == 4);98				99				100				deferred.callback(true);101				102				103			} catch(e) {104			  deferred.errback(e);105			}106		}, 18000);107		return deferred;108	}109}110//,111//// TEST interval112//{113//	name: "interval",114//	timeout: 30000,115//	runTest: function() {116//117//		// FLAG118//		var flag = false;119//		var counter = 0;120//		var checkFlag = function (object) {121//			counter++;122//			console.log("runTests    checkFlag " + counter + " onTick: " + new Date().toTimeString());123//			return flag;124//		};125//126//		// SET TIMER127//		var timer = new plugins.dojox.Timer({ poll: checkFlag, interval: 1000 });128//		timer.start();129//		130//		// SET DEFERRED OBJECT131//		var deferred = new doh.Deferred();132//		133//		// TEST AFTER FIRST queryStatus134//		setTimeout(function() {135//			try {136//				console.log("runTests    FIRST TIMEOUT");137//				console.log("runTests    timer.completed IS FALSE");138//				doh.assertFalse(timer.completed);139//				console.log("runTests    flag NOT NULL");140//				doh.assertFalse(flag == null);141//				console.log("runTests    flag NOT TRUE");142//				doh.assertFalse(flag == true);143//				console.log("runTests    timer.polling IS TRUE");144//				doh.assertTrue(timer.polling == true);145//			} catch(e) {146//			  deferred.errback(e);147//			}148//		}, 5000);149//150//		// TEST AFTER FIRST queryStatus151//		setTimeout(function() {152//			try {153//				console.log("runTests    SECOND TIMEOUT");154//				console.log("runTests    timer.completed IS FALSE")155//				doh.assertFalse(timer.completed);156//				console.log("runTests    flag NOT NULL")157//				doh.assertFalse(flag == null);158//				console.log("runTests    flag NOT TRUE")159//				doh.assertFalse(flag == true);160//				console.log("runTests    ***** SETTING flag TO TRUE *****")161//				flag = true;162//				console.log("runTests    flag IS TRUE")163//				doh.assertTrue(flag == true);164//				console.log("runTests    timer.polling IS TRUE");165//				doh.assertTrue(timer.polling == true);166//			} catch(e) {167//			}168//		}, 10000);169//170//		// TEST AFTER FIRST queryStatus171//		setTimeout(function() {172//			try {173//				console.log("runTests    THIRD TIMEOUT");174//				console.log("runTests    flag IS NOT FALSE")175//				doh.assertFalse(flag == false);176//				console.log("runTests    timer.polling IS FALSE");177//				doh.assertTrue(timer.polling == false);178//				console.log("runTests    counter IS CORRECT");179//				doh.assertTrue(counter == 10);180//181//				//deferred.callback(true);				182//183//			} catch(e) {184//			  deferred.errback(e);185//			}186//		}, 12000);187//188//				//deferred.callback(true);				189//		return deferred;190//	}191//}192//,193//194//// TEST arguments195//{196//	name: "arguments",197//	timeout: 30000,198//	runTest: function() {199//	200//		// FLAG201//		var flag = false;202//		var counter = 0 ;203//		var checkFlag = function (timerObject) {204//			timerObject.counter++;205//			counter++;206//			console.log("runTests    checkFlag " + timerObject.counter207//				+ " onTick: (counter: " + counter + "): "208//				+ new Date().toTimeString());209//			doh.assertTrue(timerObject.counter == counter);210//			return flag;211//		};212//	213//		// SET TIMER214//		var timer = new plugins.dojox.Timer({ poll: checkFlag, interval: 1000 });215//		timer.counter = 0;216//		timer.start();217//		218//		// SET DEFERRED OBJECT219//		var deferred = new doh.Deferred();220//		221//		// TEST AFTER FIRST queryStatus222//		setTimeout(function() {223//			try {224//				console.log("runTests    FIRST TIMEOUT");225//				console.log("runTests    timer.completed IS FALSE");226//				doh.assertFalse(timer.completed);227//				console.log("runTests    flag NOT NULL");228//				doh.assertFalse(flag == null);229//				console.log("runTests    flag NOT TRUE");230//				doh.assertFalse(flag == true);231//				console.log("runTests    timer.polling IS TRUE");232//				doh.assertTrue(timer.polling == true);233//	234//				timer.stop();235//				console.log("runTests    timer.counter: " + timer.counter);236//				console.log("runTests    counter: " + counter);237//	238//				doh.assertTrue(timer.counter == 4);239//				240//				deferred.callback(true);				241//	242//			} catch(e) {243//			  deferred.errback(e);244//			}245//		}, 5000);246//			247//		return deferred;248//	}249//}250]);	// doh.register251////]}}252//Execute D.O.H. in this remote file.253doh.run();254}); // dojo.addOnLoad...businessDashboard.visual.js
Source:businessDashboard.visual.js  
1import React from 'react';2import businessDashboardTheme from '../BusinessDashboard';3import { runTests as ButtonTests } from '../../../Button/test/Button.visual';4import { runTests as CircularProgressBarTests } from '../../../CircularProgressBar/test/CircularProgressBar.visual';5import { runTests as LinearProgressBarTests } from '../../../LinearProgressBar/test/LinearProgressBar.visual';6import { runTests as HeadingTests } from '../../../Heading/test/Heading.visual';7import { runTests as TextTests } from '../../../Text/test/Text.visual';8import { runTests as TextButtonTests } from '../../../TextButton/test/TextButton.visual';9import { runTests as IconButtonTests } from '../../../IconButton/test/IconButton.visual';10import { runTests as ListItemSelectTests } from '../../../ListItemSelect/test/ListItemSelect.visual';11import { runTests as SidebarTests } from '../../../Sidebar/test/Sidebar.visual';12import { runTests as SidebarBackButtonTests } from '../../../SidebarBackButton/test/SidebarBackButton.visual';13import { runTests as SidebarDividerTests } from '../../../SidebarDivider/test/SidebarDivider.visual';14import { runTests as SidebarHeaderTests } from '../../../SidebarHeader/test/SidebarHeader.visual';15import { runTests as SidebarSectionItemTests } from '../../../SidebarSectionItem/test/SidebarSectionItem.visual';16import { runTests as SidebarSectionTitleTests } from '../../../SidebarSectionTitle/test/SidebarSectionTitle.visual';17import { runTests as CardTests } from '../../../Card/Card.visual';18import { runTests as ListItemActionTests } from '../../../ListItemAction/test/ListItemAction.visual';19import { runTests as CarouselTests } from '../../../Carousel/test/Carousel.visual';20import { runTests as BadgeTests } from '../../../Badge/test/Badge.visual';21import { runTests as LoaderTests } from '../../../Loader/test/Loader.visual';22import { runTests as InputTests } from '../../../Input/test/Input.visual';23import { runTests as EmptyStateTests } from '../../../EmptyState/test/EmptyState.visual';24import { runTests as TrendIndicator } from '../../../TrendIndicator/test/TrendIndicator.visual';25import { runTests as CloseButtonTests } from '../../../CloseButton/test/CloseButton.visual';26import { runTests as TagTests } from '../../../Tag/test/Tag.visual';27import { runTests as CheckboxTests } from '../../../Checkbox/test/Checkbox.visual';28import { runTests as ThumbnailTests } from '../../../Thumbnail/test/Thumbnail.visual';29import { runTests as VerticalTabsItemTests } from '../../../VerticalTabsItem/test/VerticalTabsItem.visual';30import { runTests as CustomModalLayoutTests } from '../../../CustomModalLayout/test/CustomModalLayout.visual';31import { ThemeProvider } from '../../..';32const themeName = 'Business Dashboard';33const testWithTheme = test => {34  return (35    <ThemeProvider theme={businessDashboardTheme()}>36      <>{test}</>37    </ThemeProvider>38  );39};40ButtonTests({ themeName, testWithTheme });41CircularProgressBarTests({ themeName, testWithTheme });42LinearProgressBarTests({ themeName, testWithTheme });43HeadingTests({ themeName, testWithTheme });44TextTests({ themeName, testWithTheme });45TextButtonTests({ themeName, testWithTheme });46IconButtonTests({ themeName, testWithTheme });47CardTests({ themeName, testWithTheme });48CarouselTests({ themeName, testWithTheme });49SidebarTests({ themeName, testWithTheme });50SidebarBackButtonTests({ themeName, testWithTheme });51SidebarDividerTests({ themeName, testWithTheme });52SidebarHeaderTests({ themeName, testWithTheme });53SidebarSectionItemTests({ themeName, testWithTheme });54SidebarSectionTitleTests({ themeName, testWithTheme });55ListItemActionTests({ themeName, testWithTheme });56ListItemSelectTests({ themeName, testWithTheme });57BadgeTests({ themeName, testWithTheme });58LoaderTests({ themeName, testWithTheme });59InputTests({ themeName, testWithTheme });60EmptyStateTests({ themeName, testWithTheme });61TrendIndicator({ themeName, testWithTheme });62CloseButtonTests({ themeName, testWithTheme });63TagTests({ themeName, testWithTheme });64CheckboxTests({ themeName, testWithTheme });65ThumbnailTests({ themeName, testWithTheme });66VerticalTabsItemTests({ themeName, testWithTheme });...constants.js
Source:constants.js  
1const RUNTESTS_NAME = "RUNTESTS_NAME";2const RUNTESTS_ENVIRONMENT_ID = "RUNTESTS_ENVIRONMENT_ID";3const RUNTESTS_ENVIRONMENT_NAME = "RUNTESTS_ENVIRONMENT_NAME";4const RUNTESTS_TESTING_ENVIRONMENT_ID = "RUNTESTS_TESTING_ENVIRONMENT_ID";5const RUNTESTS_TESTING_ENVIRONMENT_NAME = "RUNTESTS_TESTING_ENVIRONMENT_NAME";6const RUNTESTS_USER_ROLE_ID = "RUNTESTS_USER_ROLE_ID";7const RUNTESTS_USER_ROLE_NAME = "RUNTESTS_USER_ROLE_NAME";8const RUNTESTS_THREAD = "RUNTESTS_THREAD";9const RUNTESTS_DATE = "RUNTESTS_DATE";10const RUNTESTS_TIME = "RUNTESTS_TIME";11const RUNTESTS_SELECTED_DATA = "RUNTESTS_SELECTED_DATA"12const IS_BACK_TO_RUNTESTS = "IS_BACK_TO_RUNTESTS"13const EDIT_TESTCASE = "EDIT_TESTCASE"14// const RUNTESTS_SELECTED_APPLICATIONS_ID = "RUNTESTS_SELECTED_APPLICATIONS_ID"15// const RUNTESTS_SELECTED_TESTCASES_ID = "RUNTESTS_SELECTED_TESTCASES_ID"16// const RUNTESTS_SELECTED_TESTCASES_NAME = "RUNTESTS_SELECTED_TESTCASES_NAME"17// const RUNTESTS_SELECTED_APPLICATIONS_NAME = "RUNTESTS_SELECTED_APPLICATIONS_NAME"18const TESTBUCKET_EXECUTION_NAME = "TESTBUCKET_EXECUTION_NAME"19const TESTBUCKET_TESTING_ENVIRONMENT_ID = "TESTBUCKET_TESTING_ENVIRONMENT_ID"20const TESTBUCKET_TESTING_ENVIRONMENT_NAME = "TESTBUCKET_TESTING_ENVIRONMENT_NAME"21const TESTBUCKET_SCHEDULE_DATE = "TESTBUCKET_SCHEDULE_DATE"22const TESTBUCKET_SCHEDULE_TIME = "TESTBUCKET_SCHEDULE_TIME"23  24const MESSAGE_ENTER_VALID_EXECUTION_NAME = "Please enter execution name without space"25const MESSAGE_ENTER_VALID_ENVIRONMENT = "Please enter valid environment"26const MESSAGE_ENTER_VALID_TESTING_ENVIRONMENT = "Please enter valid Browser"27const MESSAGE_ENTER_VALID_USERROLE = "Please enter valid user role"28const MESSAGE_ENTER_VALID_THREAD = "Please enter valid thread"29const MESSAGE_ENTER_VALID_DATE = "Please enter valid date"30const MESSAGE_ENTER_VALID_TIME = "Please enter valid time"31const MESSAGE_ENTER_VALID_TESTCASES = "Please enter valid testcases"32const MESSAGE_ENTER_VALID_TEST_BUCKET_NAME = "Please enter valid test logical group name"33const QUEUED = "QUEUED"34const PASSED = "PASSED"...sorts.spec.js
Source:sorts.spec.js  
1import * as Sorts from "./sorts.js";2describe("Sorts - ", () => {3    const runTests = function runTests(sorter) {4        it("handles no elems", () => {5            expect(sorter([])).toEqual([]);6        });7        it("handles one elem", () => {8            expect(sorter([4])).toEqual([4]);9        });10        it("handles two elems", () => {11            expect(sorter([7, 2])).toEqual([2, 7]);12        });13        it("handles three elems", () => {14            expect(sorter([6, 2, 7])).toEqual([2, 6, 7]);15        });16        it("handles repeats", () => {17            expect(sorter([4, 7, 3, 6, 3, 4])).toEqual([3, 3, 4, 4, 6, 7]);18        });19        it("handles many elems", () => {20            expect(sorter([2, 5, 8, 3, 10, 6, 7, 4, 1, 9])).toEqual([21                1,22                2,23                3,24                4,25                5,26                6,27                7,28                8,29                9,30                10,31            ]);32        });33    };34    describe("BubbleSort", () => {35        runTests(Sorts.BubbleSort);36    });37    describe("Insertion Sort", () => {38        runTests(Sorts.InsertionSort);39    });40    describe("Selection Sort", () => {41        runTests(Sorts.SelectionSort);42    });43    describe("Merge Sort", () => {44        runTests(Sorts.mergeSort);45    });46    describe("Merge Sort Iterative", () => {47        runTests(Sorts.mergeSortIter);48    });49    describe("Quick Sort Functional", () => {50        runTests(Sorts.quickSortFunc);51    });52    describe("Quick Sort", () => {53        runTests(Sorts.quickSort);54    });55    describe("Quick Sort Iterative", () => {56        runTests(Sorts.quickSortIter);57    });58    describe("Radix Sort", () => {59        runTests(Sorts.RadixSort);60    });61    describe("Heap Sort", () => {62        runTests(Sorts.HeapSort);63    });...runtest.js
Source:runtest.js  
1function saveRunTests(dataObj) {2	$.ajax({3		type: 'POST',4		data: JSON.stringify(dataObj),5		contentType: 'application/json',6		dataType: 'json',7		url: base_url + "/testcases/save",8		beforeSend: function (xhr) {9			xhr.setRequestHeader('Authorization', "Bearer " + readCookie("TAaccess"));10		},11		success: function (data) {12			displayTestcases();	13		}14	});15}16function clearRunTestPageData(){17	removeItem(RUNTESTS_NAME);18	removeItem(RUNTESTS_ENVIRONMENT_ID);19	removeItem(RUNTESTS_ENVIRONMENT_NAME);20	removeItem(RUNTESTS_TESTING_ENVIRONMENT_ID);21	removeItem(RUNTESTS_TESTING_ENVIRONMENT_NAME);22	removeItem(RUNTESTS_USER_ROLE_ID);23	removeItem(RUNTESTS_USER_ROLE_NAME);24	removeItem(RUNTESTS_THREAD);25	removeItem(RUNTESTS_DATE);26	removeItem(RUNTESTS_TIME);27	removeItem(RUNTESTS_SELECTED_DATA);28	// removeItem(RUNTESTS_SELECTED_APPLICATIONS_ID);29	// removeItem(RUNTESTS_SELECTED_TESTCASES_NAME);30	// removeItem(RUNTESTS_SELECTED_APPLICATIONS_NAME);...standalone.js
Source:standalone.js  
1load('tests/cli.js');2JSAN.use('MochiKit.Test');3print("[[ MochiKit.Base ]]");4runTests('tests.test_Base');5print("[[ MochiKit.Color ]]");6runTests('tests.test_Color');7print("[[ MochiKit.DateTime ]]");8runTests('tests.test_DateTime');9print("[[ MochiKit.Format ]]");10runTests('tests.test_Format');11print("[[ MochiKit.Iter ]]");12runTests('tests.test_Iter');13print("[[ MochiKit.Logging ]]");...Using AI Code Generation
1import { runTests } from 'cavy';2import { testHook } from 'cavy';3import { SpecReporter } from 'cavy';4import { TestHookStore } from 'cavy';5import { Tester } from 'cavy';6import { TestScope } from 'cavy';7import { TestScope } from 'cavy';8import { Tester } from 'cavy';9import { TestHookStore } from 'cavy';10import { SpecReporter } from 'cavy';11import { testHook } from 'cavy';12import { runTests } from 'cavy';13import { Tester } from 'cavy';14import { TestScope } from 'cavy';15import { TestHookStore } from 'cavy';16import { SpecReporter } from 'cavy';17import { testHook } from 'cavy';18import { runTests } from 'cavy';19import { Tester } from 'cavy';20import { TestScope } from 'cavy';21import { TestHookStore } from 'cavy';22import { SpecReporter } from 'cavy';23import { testHook } from 'cavy';24import { runTests } from 'cavy';Using AI Code Generation
1import { runTests } from 'cavy';2import spec from './spec';3runTests(spec);4import { describe, it, expect, element, by } from 'cavy';5const spec = function() {6  describe('Login Screen', function() {7    it('should have a login button', async function() {8      await expect(element(by.id('loginButton'))).toExist();9    });10  });11};12export default spec;13### `describe(description, test)`14### `it(description, test)`15### `expect(element)`16### `element(by.id('id'))`17### `by.id('id')`18### `by.text('text')`19### `by.type('type')`20import { describe, it, expect, element, byUsing AI Code Generation
1import { runTests } from 'cavy';2import { describe, it } from 'jest-circus';3runTests('myFirstTest', () => {4  describe('My first test', () => {5    it('should display "Hello, world!"', async () => {6      await expect(element(by.text('Hello, world!'))).toBeVisible();7    });8  });9});10Tests are written using the `describe` and `it` methods of [Jest Circus](Using AI Code Generation
1import { runTests } from 'cavy';2import Spec from './spec';3runTests(Spec);4import { describe, it, expect } from 'cavy';5describe('Test', function() {6  it('should pass', function() {7    expect(true).toBe(true);8  });9});10import { runTests } from 'cavy';11import Spec from './spec';12import { Provider } from 'react-redux';13import { createStore } from 'redux';14import { TestHookStore } from 'cavy';15const store = createStore(reducer);16const testHookStore = new TestHookStore();17runTests(Spec, {18});19import { describe, it, expect } from 'cavy';20describe('Test', function() {21  it('should pass', function() {22    expect(true).toBe(true);23  });24});Using AI Code Generation
1import { runTests } from 'cavy';2runTests();3import { describe, it, expect, beforeAll } from 'cavy';4describe('Example', () => {5  beforeAll(async function() {6    await this.prepareTestableApp();7  });8  it('should display a welcome message', async function() {9    await expect(this, 'welcome_message').toHaveText('Welcome to Cavy!');10  });11});12import { TestHook } from 'cavy';13const Example = () => (14);15export default Example;16import { TestHook, generateTestHook } from 'cavy';17const Example = () => (18);Using AI Code Generation
1import { runTests } from 'cavy';2import Spec from './spec';3runTests(Spec);4import { TestHookStore } from 'cavy';5import MyComponent from './MyComponent';6describe('MyComponent', () => {7  it('has a text input', () => {8    const testHookStore = new TestHookStore();9    const component = renderer.create(<MyComponent store={testHookStore} />);10    const usernameInput = testHookStore.getComponent('username');11    expect(usernameInput).toBeDefined();12  });13});14import { TestHookStore } from 'cavy';15import MyScreen from './MyScreen';16describe('MyScreen', () => {17  it('has a text input', () => {18    const testHookStore = new TestHookStore();19    const component = renderer.create(<MyScreen store={testHookStore} />);20    const usernameInput = testHookStore.getComponent('username');Using AI Code Generation
1import { runTests } from 'cavy';2import spec from './spec';3runTests(spec);4import { describe, it, expect } from 'cavy';5describe('Test Hello World', function() {6  it('should display "Hello, world!"', async function() {7    await expect(this, 'Hello, world!').toBeVisible();8  });9});10import { describe, it, expect } from 'cavy';11describe('Test Hello World', function() {12  it('should display "Hello, world!"', async function() {13    await expect(this, 'Hello, world!').toBeVisible();14  });15  it('should display "Goodbye, world!"', async function() {16    await expect(this, 'Goodbye, world!').toBeVisible();17  });18});19import { describe, it, expect } from 'cavy';20describe('Test Hello World', function() {Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
