PageRenderTime 52ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/src/test/java/com/atlassian/jira/plugins/bitbucket/pageobjects/component/BitBucketRepository.java

https://bitbucket.org/atlassian/jira-bitbucket-connector/
Java | 62 lines | 34 code | 11 blank | 17 comment | 0 complexity | 1bc74dca34425fb643ae14c52b569738 MD5 | raw file
  1. package com.atlassian.jira.plugins.bitbucket.pageobjects.component;
  2. import com.atlassian.pageobjects.elements.PageElement;
  3. import com.atlassian.pageobjects.elements.PageElementFinder;
  4. import com.atlassian.pageobjects.elements.query.Poller;
  5. import com.atlassian.webdriver.AtlassianWebDriver;
  6. import org.openqa.selenium.By;
  7. import javax.inject.Inject;
  8. /**
  9. * Represents a repository that is linked to a project (a table row of <tt>BitBucketConfigureRepositoriesPage</tt>)
  10. */
  11. public class BitBucketRepository
  12. {
  13. private final PageElement row;
  14. @Inject
  15. AtlassianWebDriver driver;
  16. @Inject
  17. PageElementFinder elementFinder;
  18. public BitBucketRepository(PageElement row)
  19. {
  20. this.row = row;
  21. }
  22. /**
  23. * The url of this repo
  24. * @return Url
  25. */
  26. public String getUrl()
  27. {
  28. return row.find(By.tagName("a")).getText();
  29. }
  30. /**
  31. * The projec key
  32. * @return Key
  33. */
  34. public String getProjectKey()
  35. {
  36. return row.findAll(By.tagName("td")).get(1).getText();
  37. }
  38. /**
  39. * Deletes this repository from the list
  40. */
  41. public void delete()
  42. {
  43. // disable confirm popup
  44. driver.executeScript("window.confirm = function(){ return true; }");
  45. // add marker to wait for post complete
  46. driver.executeScript("document.getElementById('Submit').className = '_posting'");
  47. row.find(By.linkText("Delete")).click();
  48. //wait until marker is gone.
  49. Poller.waitUntilFalse(elementFinder.find(By.id("Submit")).timed().hasClass("_posting"));
  50. }
  51. }