X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/2d95a83959c77a0c4820c6668b439f8e1b0d038a..a52fc9424444400d4c774b76cf9f59ba43f9dc12:/automationTest/src/test/java/androidtest/tests/RenameFileTestSuite.java diff --git a/automationTest/src/test/java/androidtest/tests/RenameFileTestSuite.java b/automationTest/src/test/java/androidtest/tests/RenameFileTestSuite.java index 4909fbbb..8a07e034 100644 --- a/automationTest/src/test/java/androidtest/tests/RenameFileTestSuite.java +++ b/automationTest/src/test/java/androidtest/tests/RenameFileTestSuite.java @@ -1,7 +1,13 @@ package androidtest.tests; +import static org.junit.Assert.*; +import io.appium.java_client.android.AndroidDriver; + import org.junit.After; import org.junit.Before; +import org.junit.Rule; +import org.junit.experimental.categories.Category; +import org.junit.rules.TestName; import org.junit.runners.MethodSorters; import org.junit.FixMethodOrder; import org.junit.Test; @@ -9,6 +15,8 @@ import org.openqa.selenium.By; import org.openqa.selenium.support.ui.ExpectedConditions; import androidtest.actions.Actions; +import androidtest.groups.NoIgnoreTestCategory; +import androidtest.groups.SmokeTestCategory; import androidtest.models.ElementMenuOptions; import androidtest.models.MainView; import androidtest.models.NewFolderPopUp; @@ -16,23 +24,28 @@ import androidtest.models.WaitAMomentPopUp; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class RenameFileTestSuite extends Common{ +public class RenameFileTestSuite{ + AndroidDriver driver; + Common common; private Boolean fileHasBeenCreated = false; private final String OLD_FILE_NAME = "test"; private final String FILE_NAME = "newNameFile"; private String CurrentCreatedFile = ""; - + + @Rule public TestName name = new TestName(); @Before public void setUp() throws Exception { - setUpCommonDriver(); + common=new Common(); + driver=common.setUpCommonDriver(); } @Test + @Category({NoIgnoreTestCategory.class, SmokeTestCategory.class}) public void testRenameFile () throws Exception { MainView mainView = Actions.login(Config.URL, Config.user,Config.password, Config.isTrusted, driver); - waitForTextPresent("ownCloud", mainView.getTitleTextElement()); + common.assertIsInMainView(); //TODO. if the file already exists, do not upload MainView mainViewAfterUploadFile = Actions.uploadFile(OLD_FILE_NAME, mainView); @@ -43,13 +56,13 @@ public class RenameFileTestSuite extends Common{ mainViewAfterUploadFile.scrollTillFindElement(OLD_FILE_NAME); assertTrue(fileHasBeenCreated = mainViewAfterUploadFile.getFileElement().isDisplayed()); CurrentCreatedFile = OLD_FILE_NAME; - waitTillElementIsNotPresent(mainViewAfterUploadFile.getProgressCircular(), 1000); - wait.until(ExpectedConditions.visibilityOf(mainViewAfterUploadFile.getFileElementLayout().findElement(By.id(MainView.getLocalFileIndicator())))); + Common.waitTillElementIsNotPresent(mainViewAfterUploadFile.getProgressCircular(), 1000); + common.wait.until(ExpectedConditions.visibilityOf(mainViewAfterUploadFile.getFileElementLayout().findElement(By.id(MainView.getLocalFileIndicator())))); ElementMenuOptions menuOptions = mainViewAfterUploadFile.longPressOnElement(OLD_FILE_NAME); NewFolderPopUp newFolderPopUp = menuOptions.clickOnRename(); newFolderPopUp.typeNewFolderName(FILE_NAME); WaitAMomentPopUp waitAMomentPopUp = newFolderPopUp.clickOnNewFolderOkButton(); - waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); + Common.waitTillElementIsNotPresent(waitAMomentPopUp.getWaitAMomentTextElement(), 100); mainViewAfterUploadFile.scrollTillFindElement(FILE_NAME); assertNotNull(mainViewAfterUploadFile.getFileElement()); assertTrue(mainViewAfterUploadFile.getFileElement().isDisplayed()); @@ -59,7 +72,7 @@ public class RenameFileTestSuite extends Common{ @After public void tearDown() throws Exception { - takeScreenShotOnFailed(getName()); + common.takeScreenShotOnFailed(name.getMethodName()); if (fileHasBeenCreated) { MainView mainView = new MainView(driver); Actions.deleteElement(CurrentCreatedFile,mainView, driver);