Exemplo n.º 1
0
        public void BeforeEachTests()
        {
            Application.Get(ApplicationSourceRepository.ChromeNew()).Browser.Driver.Manage().Cookies.DeleteAllCookies();
            Application.Get(ApplicationSourceRepository.ChromeNew()).Browser.OpenUrl(Application.Get(ApplicationSourceRepository.ChromeNew()).ApplicationSource.HomePageUrl);

            //LogIn to the site
            MyAccountPage myAccountPage = new LoginPageMethods().LogIntoAccount(EMAIL, PASSWORD);

            //Click on "Address Book" link
            myAccountPage.ClickLinkAddressBook();
        }
Exemplo n.º 2
0
 public static TestsApplication Get(ApplicationSource applicationSource)
 {
     if (instance == null)
     {
         if (applicationSource == null)
         {
             applicationSource = ApplicationSourceRepository.Default();
         }
         instance = new TestsApplication(applicationSource);
     }
     return(instance);
 }
Exemplo n.º 3
0
 public static ApplicationSingleBrouser Get(ApplicationSource applicationSource)
 {
     if (instance == null)
     {
         if (applicationSource == null)
         {
             applicationSource = ApplicationSourceRepository.Default();
         }
         instance = new ApplicationSingleBrouser(applicationSource);
     }
     return(instance);
 }
Exemplo n.º 4
0
 public static Application Get(ApplicationSource applicationSource)
 {
     if (instance == null)
     {
         if (applicationSource == null)
         {
             applicationSource = ApplicationSourceRepository.Default();
         }
         instance = new Application(applicationSource);
         Thread.Sleep(500);
     }
     return(instance);
 }
Exemplo n.º 5
0
 public static Application Get(ApplicationSource applicationSource)
 {
     if (instance == null)
     {
         lock (lockingObject)
             if (instance == null)
             {
                 if (applicationSource == null)
                 {
                     applicationSource = ApplicationSourceRepository.Default();
                 }
                 instance = new Application(applicationSource);
             }
     }
     return(instance);
 }
Exemplo n.º 6
0
 public static Application Get(ApplicationSource applicationSource)
 {
     if (instance == null)
     {
         lock (lockingObject)
         {
             if (instance == null)
             {
                 if (applicationSource == null)
                 {
                     applicationSource = ApplicationSourceRepository.Default();
                 }
                 instance = new Application(applicationSource);
                 //
                 //instance.InitBrowser(applicationSource);
                 //instance.InitSearch();
             }
         }
     }
     return(instance);
 }
Exemplo n.º 7
0
 public void BeforeAllMethods()
 {
     Application.Get(ApplicationSourceRepository.Get().ChromeMaximizedWithUi());
 }
Exemplo n.º 8
0
 public void BeforeAllMethods()
 {
     Application.Get(ApplicationSourceRepository.Get().SauceLabsChromeRemote());
 }
Exemplo n.º 9
0
        private Branch CheckoutDeploymentManifest(Repository gitRepository, ApplicationSourceRepository repository,
                                                  UsernamePasswordGitCredentials credentials)
        {
            _log.LogInformation("CheckoutDeploymentManifest ...");

            var branchNames = gitRepository.Branches.Select(x => x.CanonicalName).ToList();

            var branch       = gitRepository.Branches.FirstOrDefault(b => b.FriendlyName == repository.Ref);
            var originBranch =
                gitRepository.Branches.FirstOrDefault(b => b.FriendlyName == $"origin/{repository.Ref}");

            if (branch != null || originBranch != null)
            {
                if (branch == null)
                {
                    // checkout branch from origin and make sure we are tracking the remote branchb
                    branch = gitRepository.CreateBranch(repository.Ref, originBranch.Tip);
                    branch = gitRepository.Branches.Update(branch,
                                                           b => b.TrackedBranch = originBranch.CanonicalName
                                                           );
                }

                // we already have a local copy of the branch, make sure it's the current head (if not switch to it)
                if (branch.Tip != gitRepository.Head.Tip)
                {
                    // switch to selected branch
                    _log.LogInformation("Switching from branch {currentBranch} to {requestedBranch}",
                                        gitRepository.Head.CanonicalName, branch.CanonicalName);
                    Commands.Checkout(gitRepository, branch);
                }

                var currentHash = gitRepository.Head.Tip.Sha;

                _log.LogInformation("Fetching latest sources for {branch} [{currentHash}] ...",
                                    branch.CanonicalName, currentHash);

                // TODO maybe this needs to be a fetch
                Commands.Pull(gitRepository,
                              new Signature("rig-deploy-bot", "*****@*****.**", DateTimeOffset.Now),
                              new PullOptions()
                {
                    FetchOptions = new FetchOptions()
                    {
                        Prune = true,
                        CredentialsProvider = (url, fromUrl, types) => new UsernamePasswordCredentials()
                        {
                            Username = credentials.Username,
                            Password = credentials.Password
                        }
                    },
                    MergeOptions = new MergeOptions()
                    {
                        FastForwardStrategy = FastForwardStrategy.FastForwardOnly
                    }
                });

                if (gitRepository.Head.Tip.Sha != currentHash)
                {
                    _log.LogInformation("Branch changed, triggered application refresh");
                }
            }
            else
            {
                var tag = gitRepository.Tags[repository.Ref];
                if (tag != null)
                {
                    var currentHash = tag.Target.Sha;

                    Commands.Fetch(
                        gitRepository,
                        "origin",
                        Enumerable.Empty <string>(),
                        new FetchOptions()
                    {
                        Prune = true,
                        CredentialsProvider = (url, fromUrl, types) => new UsernamePasswordCredentials()
                        {
                            Username = credentials.Username,
                            Password = credentials.Password
                        }
                    },
                        null);


                    tag = gitRepository.Tags[repository.Ref];

                    if (currentHash != tag.Target.Sha)
                    {
                        _log.LogInformation("Tag hash changed, triggered application refresh.");
                    }
                }
                else
                {
                    // its a git commit hash
                    var currentHash = gitRepository.Head.Tip.Sha;

                    if (currentHash != repository.Ref)
                    {
                        _log.LogInformation(
                            $"Current hash [{currentHash}] is not requested hash [{repository.Ref}], git checkout of commit will be triggered.");

                        Commands.Checkout(gitRepository, repository.Ref);
                    }
                }
            }

            return(branch);
        }
Exemplo n.º 10
0
 public MyAccountPage()
 {
     Search = Application.Get(ApplicationSourceRepository.Default()).Search;
 }