Webdriverio: تكوين الكفالة لا يعمل مع الياسمين في الإصدار الخامس

تم إنشاؤها على ٢٤ مايو ٢٠١٩  ·  3تعليقات  ·  مصدر: webdriverio/webdriverio

صِف سؤالك بأكبر قدر ممكن من التفاصيل
قمت مؤخرًا بترقية wdio من الإصدار 3 إلى الإصدار الخامس. كل شيء يعمل بشكل رائع باستثناء خيار الكفالة. سابقًا في الإصدار 3 ، عملت مع إعداد bail: 1 و stopOnSpecFailure: true في jasmineNodeOpts . ومع ذلك ، فهو لا يعمل على هذا النحو في الإصدار الخامس.

س: هل تغير شيء ما في الوظيفة هنا؟

متابعة س: أود أيضًا استخدام وظيفة كل من الكفالة و specFileRetries لإعادة محاولة الاختبار حتى 3 مرات عند الفشل الأول. هل يمكن تحقيق ذلك؟ كما أتذكر أنني قرأت شيئًا يمكن أن تتعارض فيه specFileRetries وإعداد الكفالة مع بعضهما البعض.

إذا كان الأمر يتعلق بجزء معين من التعليمات البرمجية ، فحاول تضمين بعضها لدعم سؤالك.
[...]

البيئة (يرجى استكمال المعلومات التالية):

  • إصدار WebdriverIO: ^ 5.0.0 [مثل 4.13.2]
  • الوضع: WDIO Testrunner [وضع مستقل أو WDIO Testrunner]
  • في حالة تشغيل WDIO Testrunner ، تشغيل sync / async: sync [مثل sync / async]
  • إصدار Node.js: 10.15.3 [مثل 8.11.2]
  • إصدار NPM: 6.4.1 [مثل 5.8.0]
  • اسم المتصفح وإصداره: Chrome 74 [مثل Chrome 68]
  • اسم النظام الأساسي وإصداره: Mac OS X و Linux [مثل Windows 10]
  • حزم wdio الإضافية المستخدمة (إن وجدت): @ wdio / jasmine-framework ، @ wdio / spec reporter ، @ wdio / local-runner ، @ wdio / cli ، @ wdio / sync

تكوين WebdriverIO

// ====================
// Runner Configuration
// ====================
//
// WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
// on a remote machine).
runner: 'local',
//
// ==================
// Specify Test Files
// ==================
//
suites: suites,
// Specs to include/exclude.
// specs: ,
// exclude: ,
//
// ============
// Capabilities
// ============
//
maxInstances: 10,
//
capabilities: [
    {
        maxInstances: 5,
        //
        browserName: 'chrome',
        'goog:chromeOptions': {
            // to run chrome headless the following flags are required
            // (see https://developers.google.com/web/updates/2017/04/headless-chrome)
            // args: ['--headless', '--disable-gpu'],
        }
        // If outputDir is provided WebdriverIO can capture driver session logs
        // it is possible to configure which logTypes to include/exclude.
        // excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
        // excludeDriverLogs: ['bugreport', 'server'],
    }
],
//
// ===================
// Test Configurations
// ===================
// Define all options that are relevant for the WebdriverIO instance here
//
// Level of logging verbosity: trace | debug | info | warn | error | silent
logLevel: 'trace',
//
// Set directory to store all logs into
outputDir: `${path.output}`,
// If you only want to run your tests until a specific amount of tests have failed use
// bail (default is 0 - don't bail, run all tests).
bail: 1,
//
baseUrl: url.base,
//
// Default timeout for all waitFor* commands.
waitforTimeout: waitTimeout,
//
// Default timeout in milliseconds for request
// if Selenium Grid doesn't send response
connectionRetryTimeout: 90000,
//
// Default request retries count
connectionRetryCount: 3,
//
// Make sure you have the wdio adapter package for the specific framework installed
// before running any tests.
framework: 'jasmine',
//
// The number of times to retry the entire specfile when it fails as a whole
specFileRetries: 0,
//
reporters: ['spec'],
//
// Options to be passed to Jasmine.
jasmineNodeOpts: {
    //
    // Jasmine default timeout
    defaultTimeoutInterval: parameter.testTimeout,
    //
    stopOnSpecFailure: true,
    // The Jasmine framework allows interception of each assertion in order to log the state of the application
    // or website depending on the result. For example, it is pretty handy to take a screenshot every time
    // an assertion fails.
    expectationResultHandler: function(passed, assertion) {
        /**
         * only take screenshot if assertion failed
         */
        if (passed) {
            return;
        }
    }
},

سياق إضافي
سياق سؤال المتابعة: نظرًا لأن بعض ملفات المواصفات كبيرة ، فسيكون من الرائع استخدام الكفالة لتوفير الوقت. لا يعمل خيار الكفالة مع أو بدون specFileRetries.

Bug🐛 good first pick help wanted

التعليق الأكثر فائدة

أواجه أيضًا نفس المشكلة أثناء الترقية من wdio v4-> v5

لقد جربت تباديل هذه الخيارات:

        bail: 1,
        stopSpecOnExpectationFailure: true,
        stopOnSpecFailure: true,

مع اختبار واحد ، يتم إعادة المحاولة حوالي 8 مرات (95 ثانية) حيث يحدث الفشل الأول حوالي 20 ثانية. يمكن أن يوفر لنا هذا الكثير من الوقت عند تصحيح أخطاء اختباراتنا.

ال 3 كومينتر

أواجه أيضًا نفس المشكلة أثناء الترقية من wdio v4-> v5

لقد جربت تباديل هذه الخيارات:

        bail: 1,
        stopSpecOnExpectationFailure: true,
        stopOnSpecFailure: true,

مع اختبار واحد ، يتم إعادة المحاولة حوالي 8 مرات (95 ثانية) حيث يحدث الفشل الأول حوالي 20 ثانية. يمكن أن يوفر لنا هذا الكثير من الوقت عند تصحيح أخطاء اختباراتنا.

بالنسبة للأشخاص الذين لا يزالون يواجهون هذه المشكلة ، كان الحل البديل الخاص بي هو تعيين failFast: true في JasmineNodeOpts ، بالإضافة إلى bail: 1 . يتوقف الآن عن التنفيذ عند الفشل الأول ويعيد المحاولة أيضًا باستخدام specFileRetries.

نظرًا لأن بعض ملفات المواصفات كبيرة ، فسيكون من الرائع استخدام الكفالة لتوفير الوقت. لا يعمل خيار الكفالة مع أو بدون specFileRetries.

آه ، أنا أفهم المشكلة الآن. يبحث خيار WebdriverIO bail فقط في ملفات مواصفات wdio. كما ورد في الوثائق :

إذا كنت ترغب فقط في تشغيل الاختبارات الخاصة بك حتى فشل عدد معين من الاختبارات ، فاستخدم الكفالة (الافتراضي هو 0 - لا تنقذ بكفالة ، قم بتشغيل جميع الاختبارات). ملاحظة: يرجى الانتباه إلى أنه عند استخدام عداء اختبار لجهة خارجية مثل Mocha ، قد تكون هناك حاجة إلى تكوين إضافي.

إذا كنت تريد الكفالة ضمن ملفات المواصفات ، فأنت بحاجة إلى استخدام خيارات محددة لإطار العمل.

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات