Example #1
0
        public dynamic CreateOptions(MemberInfo memberInfo, Type testClassType)
        {
            var sauceBuildName = Environment.GetEnvironmentVariable("SAUCE_BUILD_NAME");
            var buildName      = string.IsNullOrEmpty(sauceBuildName) ? BuildName : sauceBuildName;

            var driverOptions = GetDriverOptionsBasedOnBrowser(testClassType);

            AddAdditionalCapabilities(testClassType, driverOptions);

            var sauceOptions = new Dictionary <string, string>();

            string browserName = Enum.GetName(typeof(BrowserType), Browser);

            sauceOptions.Add("platform", Platform);
            sauceOptions.Add("version", BrowserVersion);
            sauceOptions.Add("screenResolution", ScreenResolution);
            sauceOptions.Add("recordVideo", RecordVideo.ToString());
            sauceOptions.Add("recordScreenshots", RecordScreenshots.ToString());
            sauceOptions.Add("extendedDebugging", EnableExtendedDebugging.ToString());
            sauceOptions.Add("capturePerformance", CapturePerformance.ToString());
            sauceOptions.Add("build", buildName);
            sauceOptions.Add("name", testClassType.FullName);

            var credentials = CloudProviderCredentialsResolver.GetCredentials();

            driverOptions.AddAdditionalCapability("username", credentials.Item1);
            driverOptions.AddAdditionalCapability("accessKey", credentials.Item2);
            driverOptions.AddAdditionalCapability("name", testClassType.FullName);

            return(driverOptions);
        }
        private RecordVideo _recordVideo(TestDetailDTO testObj, int currentTestRunNumber)
        {
            var returnValue = new RecordVideo();

            returnValue = testObj.RecordVideo;
            if (testObj.RecordVideo.Record == true)
            {
                string videoDirectory = testObj.OutputFullFilePath + "\\Video";
                if (!Directory.Exists(videoDirectory))
                {
                    Directory.CreateDirectory(videoDirectory);
                }

                string videoFullFilePath = videoDirectory + "\\No" + currentTestRunNumber + "_" + testObj.Name + "_" + DateTime.Now.ToString("dd_MM_yyyy_HH_mm_ss") + ".avi";
                testObj.RecordVideo.OutPutFullPath = videoFullFilePath;
                returnValue = testObj.RecordVideo;

                _screenRecorderHelper.RecordScreen(new RecorderParams(videoFullFilePath, 10, SharpAvi.KnownFourCCs.Codecs.Xvid, 50, testObj.RecordVideo.ScreenNumber));
            }

            return(returnValue);
        }