add new testCases. prepare the test to have them into categories
[pub/Android/ownCloud.git] / automationTest / src / test / java / androidtest / tests / DeleteFileTestSuite.java
index a07bb97..d30b4c6 100644 (file)
@@ -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,30 +15,38 @@ 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.MainView;
 
 
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class DeleteFileTestSuite extends Common{
+public class DeleteFileTestSuite{
        
+       AndroidDriver driver;
+       Common common;
        private final String FILE_NAME = "test";
        
+       @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 testDeleteFile () 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(FILE_NAME, mainView);
                
                mainViewAfterUploadFile.scrollTillFindElement(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()))));
                
                Actions.deleteElement(FILE_NAME,mainViewAfterUploadFile, driver);
                assertFalse(mainViewAfterUploadFile.getFileElement().isDisplayed());
@@ -40,7 +54,7 @@ public class DeleteFileTestSuite extends Common{
 
        @After
        public void tearDown() throws Exception {
-               takeScreenShotOnFailed(getName());
+               common.takeScreenShotOnFailed(name.getMethodName());
                driver.removeApp("com.owncloud.android");
                driver.quit();
        }