Current Behavior:

If any TestCase is , not continuing with the next Testcase and holding to the same failed Testcase .
Waits for long time and throws A Jasmine spec timed out. Resetting the WebDriver Control Flow.

EXPECTED BEHAVIOR:

On failure on any Testcase, Protractor should continue with next TestCase.

Can anyone help with Sample script for it.

CONFIG.js :

 var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
    var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
    var fs = require('fs');
require('protractor/built/logger').Logger.logLevel = 1;


function rmDir (dirPath) {
    try {
        var files = fs.readdirSync(dirPath);
    }
    catch (e) {
        return;
    }
    if (files.length > 0)
        for (var i = 0; i < files.length; i++) {
            var filePath = dirPath + '/' + files[i];
            if (fs.statSync(filePath).isFile())
                fs.unlinkSync(filePath);
            else
                rmDir(filePath);
        }
    fs.rmdirSync(dirPath);
};


exports.config = {

    //seleniumServerJar: "node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.3.1.jar",
    framework: 'jasmine2',
    directConnect: true,
    capabilities: {

        'browserName': 'chrome',
        'chromeOptions': {
            'args': ['incognito', '--start-maximized'],  // this line is for maximize the window and incognito view

            prefs: {
                'profile:managed_default_content_settings.notifications': 1,
                args: ['--no-sandbox', '---type=browser'],
                'download': {
                    'prompt_for_download': false,
                    'default_directory': 'C:/Users/AAA/AppData/Roaming/npm/node_modules/protractor/Workspace/Reports/Download/'
                },
            },

        },
    },
    allScriptsTimeout: 500000,
    ignoreUncaughtExceptions: true,

    suites: {
        FindAccounts: ['./Spec/Find_Account_Page/FindAccount_By_AccountInfo.js', './Spec/Find_Account_Page/FindAccount_By_UserInfo.js'],
        LIST : './Spec/LIST/*Spec.js',
        USER_ROLES : ['./Spec/USER_ROLES/ACCMANG_USER_Role/*Spec.js','./Spec/USER_ROLES/ADMIN_USER_Role/*Spec.js','./Spec/USER_ROLES/Agent_USER_Role/*Spec.js',
         './Spec/USER_ROLES/CallCenter_USER_Role/*Spec.js','./Spec/USER_ROLES/REPORTING_USER_Role/*Spec.js',
         './Spec/USER_ROLES/SUPER_USER_Role/*Spec.js','./Spec/USER_ROLES/User_User_Role/*Spec.js']

    },

    jasmineNodeOpts: {
        isVerbose: true,
        showColors: true,
        includeStackTrace: true,
        displaySpecDuration: true,
        defaultTimeoutInterval: 360000,
        print: function () {
        }
    },

    onPrepare: function(){
        browser.manage().window().maximize();          // set browser size...
        rmDir('C:/Users/AAA/AppData/Roaming/npm/node_modules/protractor/Workspace/Reports/Download');
        require('./Data/waitReady.js');


        // better jasmine 2 reports...
        global.isAngularSite = function(flag){
            browser.driver.ignoreSynchronization = !flag;
        };
       // Remove files in Specified Directory

        jasmine.getEnv().addReporter(new SpecReporter({
            spec: {
                displayStacktrace: true,
                displayFailuresSummary: true
            }

        }));
        var jasmineReporters = require('jasmine-reporters');
        jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
            consolidateAll: true,
            savePath: './Reports/JunitXMLprotractor-result/',
            filePrefix: 'xmloutput'
        }));

        jasmine.getEnv().addReporter(
            new Jasmine2HtmlReporter({
                savePath: './Reports/Screenshots/',
                takeScreenshots: true,
                takeScreenshotsOnlyOnFailures: true,
                consolidateAll: true,
                showPassed: true,
                // filePrefix: sessionId + 'AutomationReport',
                filePrefix: 'AutomationReport',
                cleanDestination: true,
            })
        );


    },

       //  specs : './AAA/ListPage_EM_Acc_Spec.js',

       };



Source link https://sqa.stackexchange.com/questions/31147/-to-tell-protractor-to--or--the-test-if-any-test--is-f

LEAVE A REPLY

Please enter your comment!
Please enter your name here