/src/test/java/com/atlassian/jira/plugins/bitbucket/pageobjects/component/BitBucketRepository.java
Java | 62 lines | 34 code | 11 blank | 17 comment | 0 complexity | 1bc74dca34425fb643ae14c52b569738 MD5 | raw file
- package com.atlassian.jira.plugins.bitbucket.pageobjects.component;
-
- import com.atlassian.pageobjects.elements.PageElement;
- import com.atlassian.pageobjects.elements.PageElementFinder;
- import com.atlassian.pageobjects.elements.query.Poller;
- import com.atlassian.webdriver.AtlassianWebDriver;
- import org.openqa.selenium.By;
-
- import javax.inject.Inject;
-
- /**
- * Represents a repository that is linked to a project (a table row of <tt>BitBucketConfigureRepositoriesPage</tt>)
- */
- public class BitBucketRepository
- {
- private final PageElement row;
-
- @Inject
- AtlassianWebDriver driver;
-
- @Inject
- PageElementFinder elementFinder;
-
- public BitBucketRepository(PageElement row)
- {
- this.row = row;
- }
-
- /**
- * The url of this repo
- * @return Url
- */
- public String getUrl()
- {
- return row.find(By.tagName("a")).getText();
- }
-
- /**
- * The projec key
- * @return Key
- */
- public String getProjectKey()
- {
- return row.findAll(By.tagName("td")).get(1).getText();
- }
-
- /**
- * Deletes this repository from the list
- */
- public void delete()
- {
- // disable confirm popup
- driver.executeScript("window.confirm = function(){ return true; }");
-
- // add marker to wait for post complete
- driver.executeScript("document.getElementById('Submit').className = '_posting'");
- row.find(By.linkText("Delete")).click();
-
- //wait until marker is gone.
- Poller.waitUntilFalse(elementFinder.find(By.id("Submit")).timed().hasClass("_posting"));
- }
- }