public WebDriverSetup(ScenarioContext context)
 {
     DriverPath       = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
     _context         = context;
     _objectContext   = context.Get <ObjectContext>();
     _frameworkConfig = context.Get <FrameworkConfig>();
     _executionConfig = context.Get <EnvironmentConfig>();
 }
Ejemplo n.º 2
0
        public BasePage(ScenarioContext context)
        {
            _frameworkConfig          = context.Get <FrameworkConfig>();
            _webDriver                = context.GetWebDriver();
            _pageInteractionHelper    = context.Get <PageInteractionHelper>();
            _screenShotTitleGenerator = context.Get <ScreenShotTitleGenerator>();
            var objectContext = context.Get <ObjectContext>();

            _directory = objectContext.GetDirectory();
            _browser   = objectContext.GetBrowser();
        }
Ejemplo n.º 3
0
        //////////////////////////////////////////////////////////////////////////
        // TODO: unify config and system bundle's manifest
        public CSystemBundle(FrameworkConfig config, CManifest manifest)
            : base(0
			, "System Bundle"
			, manifest
			, DateTime.MinValue
			, null)
        {
            m_systemBundle = this;
            m_config = config;

            m_config.FrameworkWorkingDirectory = Path.GetDirectoryName(manifest.AssemblyPath);

            if (string.IsNullOrEmpty(m_config.BundleRegistryPath))
                m_config.BundleRegistryPath = Path.Combine(m_config.FrameworkWorkingDirectory, "repository");
        }
Ejemplo n.º 4
0
        //////////////////////////////////////////////////////////////////////////
        // TODO: unify config and system bundle's manifest
        public CSystemBundle(FrameworkConfig config, CManifest manifest)
            : base(0
			, "System Bundle"
			, manifest
			, DateTime.MinValue
			, null)
        {
            m_systemBundle = this;
            m_config = config;

            m_config.FrameworkWorkingDirectory = Path.GetDirectoryName(manifest.AssemblyPath);

            if (string.IsNullOrEmpty(m_config.BundleRegistryPath))
                m_config.BundleRegistryPath = Path.Combine(m_config.FrameworkWorkingDirectory, "repository");
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public override T GetConfig <T>()
        {
            DotNetConfigFileAttribute attribute = AttributeHelper.GetConfigAttribute <DotNetConfigFileAttribute>(typeof(T));

            if (attribute == null)
            {
                ConfigThrowHelper.ThrowConfigException(
                    R.ConfigError_NoConfigAttribute, typeof(T).FullName, typeof(DotNetConfigFileAttribute).FullName);
            }

            ConfigSettings           configSettings = FrameworkConfig.GetConfig <ConfigSettings>();
            string                   configFilePath = configSettings.GetConfigFilePath <T>();
            DotNetConfigGetParameter getParameter   = new DotNetConfigGetParameter(configFilePath, attribute.SectionName);

            return(GetConfig <T>(getParameter, attribute.RestartAppDomainOnChange));
        }
Ejemplo n.º 6
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     //GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     //  BaseController bc = new BaseController();
     // string p = Server.MapPath("/");
     //  bc.ListActionFromDB();
     // bc.WriteActionToFile(p);
     //  bc.ListActionFromFile(p);
     // ListAction();
     //注册框架配置
     FrameworkConfig.Register();
     t.Elapsed  += new System.Timers.ElapsedEventHandler(Timer_TimesUp);
     t.AutoReset = true;     //每到指定时间Elapsed事件是触发一次(false),还是一直触发(true)
     t.Start();
 }
Ejemplo n.º 7
0
        private Config()
        {
            // This has nothing to do with the Config class, it is just initializing the Log4net...shouldn't be here
            XmlConfigurator.Configure(new FileInfo("log4net.xml"));

            XmlSerializer marshaller = new XmlSerializer(typeof(FrameworkConfig));
            Stream        reader     = null;

            try
            {
                reader = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\FrameworkConfig.xml", FileMode.Open, FileAccess.Read, FileShare.Read);
                config = (FrameworkConfig)marshaller.Deserialize(reader);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public override T GetConfig <T>()
        {
            ConfigFileAttribute attribute = AttributeHelper.GetConfigAttribute <ConfigFileAttribute>(typeof(T));

            if (attribute == null)
            {
                ConfigThrowHelper.ThrowConfigException(
                    R.ConfigError_NoConfigAttribute, typeof(T).FullName, typeof(ConfigFileAttribute).FullName);
            }

            ConfigSettings configSettings = FrameworkConfig.GetConfig <ConfigSettings>();
            string         configFilePath = string.Empty;

            switch (attribute.ConfigPathType)
            {
            case ConfigPathType.FullPhysicalPath:
            {
                configFilePath = attribute.FileName;
            }
            break;

            case ConfigPathType.ServerPath:
                if (HttpContext.Current == null)
                {
                    configFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, attribute.FileName.Replace("~/", ""));
                    break;
                }
                configFilePath = HttpContext.Current.Server.MapPath(attribute.FileName);
                break;

            default:
            {
                configFilePath = configSettings.GetConfigFilePath <T>();
            }
            break;
            }
            XmlConfigGetParameter getParameter = new XmlConfigGetParameter(configFilePath, attribute.IncludeSubdirectories);

            return(GetConfig <T>(getParameter, attribute.RestartAppDomainOnChange));
        }
Ejemplo n.º 9
0
        public void Install()
        {
            _isInit   = true;
            _isEnable = true;
            _config   = FrameworkConfig.Instance;

            var eventsys = GameObject.Find("EventSystem");

            if (eventsys == null)
            {
                eventsys = new GameObject("EventSystem");
                eventsys.AddComponent <StandaloneInputModule>();
                eventsys.AddComponent <EventSystem>();
            }
            _currentEventSys = eventsys.GetComponent <EventSystem>();

            //给内部方法绑定一个计算当前是否是持续性按压状态
            TouchEndCallback        += CalculateTimeByPressOver;
            TouchStationaryCallback += CalculateTimeByPressStart;

            GameDriver.Instance.UpdateEventHandler += InputUpdateHandler;
        }
Ejemplo n.º 10
0
        public void SetUpConfiguration()
        {
            _context.Set(_configSection);

            var configuration = new FrameworkConfig
            {
                TimeOutConfig           = _configSection.GetConfigSection <TimeOutConfig>(),
                BrowserStackSetting     = _configSection.GetConfigSection <BrowserStackSetting>(),
                TakeEveryPageScreenShot = Configurator.IsVstsExecution
            };

            _context.Set(configuration);

            var executionConfig = new EnvironmentConfig {
                EnvironmentName = Configurator.EnvironmentName, ProjectName = Configurator.ProjectName
            };

            _context.Set(executionConfig);

            var testExecutionConfig = _configSection.GetConfigSection <TestExecutionConfig>();

            _objectContext.SetBrowser(testExecutionConfig.Browser);
        }
Ejemplo n.º 11
0
 public BrowserStackTearDown(ScenarioContext context)
 {
     _context         = context;
     _objectContext   = context.Get <ObjectContext>();
     _frameworkConfig = _context.Get <FrameworkConfig>();
 }
Ejemplo n.º 12
0
 private void OnEnable()
 {
     _config = ( FrameworkConfig )target;
 }
 public HelpersSetup(ScenarioContext context)
 {
     _context       = context;
     _objectContext = context.Get <ObjectContext>();
     _config        = context.Get <FrameworkConfig>();
 }