Ejemplo n.º 1
0
        private static async Task GenerateBearerTokens(TestContext context)
        {
            context.TestApiBearerToken = await ConfigurationManager.GetBearerToken(
                context.WebConfig.AzureAdConfiguration, context.WebConfig.VhServices.TestApiResourceId);

            context.TestApiBearerToken.Should().NotBeNullOrEmpty();
        }
Ejemplo n.º 2
0
        private static async Task GenerateBearerTokens(TestContext context)
        {
            var tokenProvider = new TokenProvider(Options.Create(context.WebConfig.AzureAdConfiguration));

            context.TestApiBearerToken = await tokenProvider.GetClientAccessToken(context.WebConfig.AzureAdConfiguration.ClientId, context.WebConfig.AzureAdConfiguration.ClientSecret, context.WebConfig.VhServices.TestApiResourceId);

            context.TestApiBearerToken.Should().NotBeNullOrEmpty();
        }
 public void SkipScenario(TestContext context, ScenarioContext scenario)
 {
     new ShouldTestBeIgnored()
     .ForTest(scenario.ScenarioInfo)
     .WithBrowser(context.WebConfig.TestConfig.TargetBrowser)
     .WithDevice(context.WebConfig.TestConfig.TargetDevice)
     .WithOS(context.WebConfig.TestConfig.TargetOS)
     .Check();
 }
Ejemplo n.º 4
0
 private void RegisterHearingServices(TestContext context)
 {
     context.WebConfig.VhServices = GetTargetTestEnvironment() == string.Empty ? Options.Create(_configRoot.GetSection("VhServices").Get <ServiceWebVhServicesConfig>()).Value
         : Options.Create(_configRoot.GetSection($"Testing.{GetTargetTestEnvironment()}.VhServices").Get <ServiceWebVhServicesConfig>()).Value;
     if (context.WebConfig.VhServices == null && GetTargetTestEnvironment() != string.Empty)
     {
         throw new TestSecretsFileMissingException(GetTargetTestEnvironment());
     }
     ConfigurationManager.VerifyConfigValuesSet(context.WebConfig.VhServices);
 }
Ejemplo n.º 5
0
 private void RegisterTestUserSecrets(TestContext context)
 {
     context.WebConfig.TestConfig            = Options.Create(_configRoot.GetSection("TestUserSecrets").Get <ServiceWebTestConfig>()).Value;
     context.WebConfig.TestConfig.CommonData = LoadXmlFile.SerialiseCommonData();
     context.WebConfig.TestConfig.TestData   = new DefaultDataManager().SerialiseTestData();
     context.WebConfig.TestConfig.TargetBrowser.Should().NotBeNull();
     context.WebConfig.TestConfig.TargetDevice.Should().NotBeNull();
     context.WebConfig.TestConfig.TargetOS.Should().NotBeNull();
     context.WebConfig.TestConfig.TestUsernameStem.Should().NotBeNull();
     context.WebConfig.TestConfig.TestUserPassword.Should().NotBeNull();
 }
Ejemplo n.º 6
0
 public async Task RegisterSecrets(TestContext context)
 {
     RegisterAzureSecrets(context);
     RegisterTestUserSecrets(context);
     RegisterDefaultData(context);
     RegisterIsLive(context);
     RegisterHearingServices(context);
     RegisterSauceLabsSettings(context);
     RunningServiceWebLocally(context);
     await GenerateBearerTokens(context);
 }
Ejemplo n.º 7
0
 private void RegisterSauceLabsSettings(TestContext context)
 {
     context.WebConfig.SauceLabsConfiguration = RunOnSauceLabsFromLocal() ?  Options.Create(_configRoot.GetSection("LocalSaucelabs").Get <SauceLabsSettingsConfig>()).Value
         : Options.Create(_configRoot.GetSection("Saucelabs").Get <SauceLabsSettingsConfig>()).Value;
     if (!context.WebConfig.SauceLabsConfiguration.RunningOnSauceLabs())
     {
         return;
     }
     context.WebConfig.SauceLabsConfiguration.SetRemoteServerUrlForDesktop(context.WebConfig.TestConfig.CommonData.CommonConfig.SauceLabsServerUrl);
     context.WebConfig.SauceLabsConfiguration.AccessKey.Should().NotBeNullOrWhiteSpace();
     context.WebConfig.SauceLabsConfiguration.Username.Should().NotBeNullOrWhiteSpace();
     context.WebConfig.SauceLabsConfiguration.RealDeviceApiKey.Should().NotBeNullOrWhiteSpace();
 }
Ejemplo n.º 8
0
 private void RegisterIsLive(TestContext context)
 {
     context.WebConfig.IsLive = _configRoot.GetValue <bool>("IsLive");
     context.WebConfig.Should().NotBeNull();
 }
Ejemplo n.º 9
0
 private static void RegisterDefaultData(TestContext context)
 {
     context.Test = new Test {
         Answers = new List <SuitabilityAnswer>()
     };
 }
Ejemplo n.º 10
0
 private void RegisterAzureSecrets(TestContext context)
 {
     context.WebConfig.AzureAdConfiguration = Options.Create(_configRoot.GetSection("AzureAd").Get <ServiceWebSecurityConfiguration>()).Value;
     ConfigurationManager.VerifyConfigValuesSet(context.WebConfig.AzureAdConfiguration);
 }
Ejemplo n.º 11
0
 public ConfigHooks(TestContext context)
 {
     _configRoot       = ConfigurationManager.BuildConfig("CF5CDD5E-FD74-4EDE-8765-2F899C252122", "c0ed2a82-9b1f-4dd2-925a-abb1740093dc");
     context.WebConfig = new ServiceWebConfig();
     context.Users     = new List <UserDto>();
 }
Ejemplo n.º 12
0
 private static void RunningServiceWebLocally(TestContext context)
 {
     context.WebConfig.VhServices.RunningServiceWebLocally = context.WebConfig.VhServices.ServiceWebUrl.Contains("localhost");
 }
Ejemplo n.º 13
0
 private void RegisterSeleniumElementTimeout(TestContext context)
 {
     context.WebConfig.SeleniumElementTimeout = _configRoot.GetValue <int>("SeleniumElementTimeout");
 }