Example usage for org.openqa.selenium ScreenOrientation LANDSCAPE

List of usage examples for org.openqa.selenium ScreenOrientation LANDSCAPE

Introduction

In this page you can find the example usage for org.openqa.selenium ScreenOrientation LANDSCAPE.

Prototype

ScreenOrientation LANDSCAPE

To view the source code for org.openqa.selenium ScreenOrientation LANDSCAPE.

Click Source Link

Usage

From source file:com.comcast.magicwand.spells.appium.AbstractAppiumPhoenixDriverTest.java

License:Apache License

@Test
public void testRotate() {
    final ScreenOrientation input = ScreenOrientation.LANDSCAPE;

    this.myTestObj.rotate(input);
    verify(this.appiumDriverMock, only()).rotate(input);
}

From source file:com.github.wasiqb.coteafs.appium.android.VodQATest.java

License:Apache License

/**
 * @author wasiqb/*from  w  w w. j  a  v  a  2 s  . c  o m*/
 * @since Oct 21, 2018
 * @return orientation list
 */
@DataProvider
public static Iterator<Object[]> getOrientation() {
    final List<Object[]> data = new ArrayList<>();
    data.add(new Object[] { ScreenOrientation.LANDSCAPE });
    data.add(new Object[] { ScreenOrientation.PORTRAIT });
    return data.iterator();
}

From source file:com.google.android.testing.nativedriver.server.AndroidNativeDriver.java

License:Apache License

@Override
public ScreenOrientation getOrientation() {
    int orientation = context.getOnMainSyncRunner().run(doGetOrientation());

    if ((orientation == Surface.ROTATION_0) || (orientation == Surface.ROTATION_180)) {
        return ScreenOrientation.PORTRAIT;
    } else { // Surface.ROTATION_90 or Surface.ROTATION_270
        return ScreenOrientation.LANDSCAPE;
    }//from   w  ww  . j  a v  a  2 s . c  o  m
}

From source file:com.google.android.testing.nativedriver.server.AndroidNativeDriver.java

License:Apache License

@Override
public void rotate(ScreenOrientation orientation) {
    int activityOrientation;
    if (orientation == ScreenOrientation.LANDSCAPE) {
        activityOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else { // ScreenOrientation.PORTRAIT
        activityOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    }//from ww  w.  j  a  v  a 2  s  .co m
    context.getOnMainSyncRunner().run(doRotate(activityOrientation));
}

From source file:com.mengge.AppiumDriver.java

License:Apache License

@Override
public ScreenOrientation getOrientation() {
    Response response = execute(DriverCommand.GET_SCREEN_ORIENTATION);
    String orientation = response.getValue().toString().toLowerCase();
    if (orientation.equals(ScreenOrientation.LANDSCAPE.value())) {
        return ScreenOrientation.LANDSCAPE;
    } else if (orientation.equals(ScreenOrientation.PORTRAIT.value())) {
        return ScreenOrientation.PORTRAIT;
    } else {/*from  w  w w .  j  ava  2 s .c  o  m*/
        throw new WebDriverException("Unexpected orientation returned: " + orientation);
    }
}

From source file:com.owncloud.android.test.ui.actions.Actions.java

License:Open Source License

public static FileListView login(String url, String user, String password, Boolean isTrusted,
        AndroidDriver driver) throws InterruptedException {
    LoginForm loginForm = new LoginForm(driver);
    CertificatePopUp certificatePopUp = loginForm.typeHostUrl(url);
    if (!isTrusted) {
        WebDriverWait wait = new WebDriverWait(driver, 30);
        //sometimes the certificate has been already accept 
        //and it doesn't appear again
        try {/* ww w. j  a  v a 2  s  .  com*/
            wait.until(ExpectedConditions.visibilityOf(certificatePopUp.getOkButtonElement()));
            //we need to repaint the screen 
            //because of some element are misplaced
            driver.rotate(ScreenOrientation.LANDSCAPE);
            driver.rotate(ScreenOrientation.PORTRAIT);
            certificatePopUp.clickOnOkButton();
        } catch (NoSuchElementException e) {

        }

    }
    loginForm.typeUserName(user);
    loginForm.typePassword(password);
    //TODO. Assert related to check the connection?
    return loginForm.clickOnConnectButton();
}

From source file:com.owncloud.android.test.ui.testSuites.LoginTestSuite.java

License:Open Source License

@Test
@Category({ NoIgnoreTestCategory.class })
public void test2LoginLandscape() throws Exception {
    driver.rotate(ScreenOrientation.LANDSCAPE);
    Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    common.assertIsInFileListView();/*from  w w w. jav a  2 s  .  co  m*/
}

From source file:com.owncloud.android.test.ui.testSuites.LoginTestSuite.java

License:Open Source License

@Test
@Category({ NoIgnoreTestCategory.class, SmokeTestCategory.class })
public void test3MultiAccountRotate() throws Exception {
    driver.rotate(ScreenOrientation.LANDSCAPE);
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted,
            driver);/*  w w  w  . ja  va2 s.  c  o m*/
    common.assertIsInFileListView();

    driver.rotate(ScreenOrientation.PORTRAIT);
    MenuList menu = fileListView.clickOnMenuButton();
    SettingsView settingsView = menu.clickOnSettingsButton();

    settingsView.tapOnAddAccount(1, 1000);
    fileListView = Actions.login(Config.URL2, Config.user2, Config.password2, Config.isTrusted2, driver);
    common.assertIsInSettingsView();
}

From source file:com.owncloud.android.test.ui.testSuites.LoginTestSuite.java

License:Open Source License

@Test
@Category({ NoIgnoreTestCategory.class, SmokeTestCategory.class })
public void testMultiAccountAndShowFiles() throws Exception {
    driver.rotate(ScreenOrientation.LANDSCAPE);
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted,
            driver);//from   ww w  .j  a  v a2 s . c  om
    common.assertIsInFileListView();
    fileListView.scrollTillFindElement(Config.fileWhichIsInTheServer1);
    assertTrue(fileListView.getFileElement().isDisplayed());

    driver.rotate(ScreenOrientation.PORTRAIT);
    MenuList menu = fileListView.clickOnMenuButton();
    SettingsView settingsView = menu.clickOnSettingsButton();

    settingsView.tapOnAddAccount(1, 1000);
    fileListView = Actions.login(Config.URL2, Config.user2, Config.password2, Config.isTrusted2, driver);
    common.assertIsInSettingsView();
    settingsView.tapOnAccountElement(2, 1, 100);
    common.assertIsInFileListView();

    fileListView.scrollTillFindElement(Config.fileWhichIsInTheServer2);
    assertTrue(fileListView.getFileElement().isDisplayed());
}

From source file:com.owncloud.android.test.ui.testSuites.LoginTestSuite.java

License:Open Source License

@Test
@Category({ NoIgnoreTestCategory.class })
public void test4ExistingAccountRotate() throws Exception {
    driver.rotate(ScreenOrientation.PORTRAIT);
    FileListView fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted,
            driver);//from   w  w w  .  jav a 2  s .  c  o  m
    common.assertIsInFileListView();

    driver.rotate(ScreenOrientation.LANDSCAPE);
    MenuList menu = fileListView.clickOnMenuButton();
    SettingsView settingsView = menu.clickOnSettingsButton();
    settingsView.tapOnAddAccount(1, 1000);

    LoginForm loginForm = new LoginForm(driver);
    fileListView = Actions.login(Config.URL, Config.user, Config.password, Config.isTrusted, driver);
    assertTrue(common.waitForTextPresent(
            "An account for the same user and" + " server already exists in the device",
            loginForm.getAuthStatusText()));
}