-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ios section to settings.json, added basic tests #6
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package samples.ios; | ||
|
||
import aquality.appium.application.ApplicationManager; | ||
import io.appium.java_client.ios.IOSDriver; | ||
import org.testng.Assert; | ||
import org.testng.annotations.AfterClass; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
import samples.ios.testapp.screens.MainScreen; | ||
import samples.ios.testapp.screens.TwoItemsAlertScreen; | ||
|
||
public class IOSBasicInteractionsTest { | ||
private IOSDriver<?> driver; | ||
|
||
@BeforeClass | ||
public void setUp() { | ||
driver = (IOSDriver<?>) ApplicationManager.getApplication().getDriver(); | ||
} | ||
|
||
@AfterClass | ||
public void tearDown() { | ||
ApplicationManager.getApplication().quit(); | ||
} | ||
|
||
@Test | ||
public void testSendKeysToInput() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please, rename all the tests to patter like: do we really need MainScreen for such tests? Can we use elements factory directly here? |
||
MainScreen mainScreen = new MainScreen(); | ||
Assert.assertTrue(mainScreen.isDisplayed(), "Main screen of app wasn't loaded"); | ||
mainScreen.enterTextToFirstField("Hello World!"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move "Hello World!" to local method variable |
||
Assert.assertEquals(mainScreen.getValueFromFirstTextBox(), "Hello World!"); | ||
} | ||
|
||
@Test | ||
public void testAcceptAlertViaButtons() { | ||
MainScreen mainScreen = new MainScreen(); | ||
mainScreen.tapShowAlert(); | ||
TwoItemsAlertScreen twoItemsAlertScreen = new TwoItemsAlertScreen(); | ||
Assert.assertTrue(twoItemsAlertScreen.isDisplayed(), "Alert wasn't opened"); | ||
Assert.assertEquals(twoItemsAlertScreen.getTitle(), "Cool title"); | ||
twoItemsAlertScreen.acceptAlert(); | ||
} | ||
|
||
@Test | ||
public void testAcceptAlertViaDriver() { | ||
MainScreen mainScreen = new MainScreen(); | ||
mainScreen.tapShowAlert(); | ||
TwoItemsAlertScreen twoItemsAlertScreen = new TwoItemsAlertScreen(); | ||
Assert.assertTrue(twoItemsAlertScreen.isDisplayed(), "Alert wasn't opened"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we verify the same twice? |
||
Assert.assertEquals(twoItemsAlertScreen.getTitle(), "Cool title"); | ||
driver.switchTo().alert().accept(); | ||
Assert.assertTrue(mainScreen.isDisplayed(), "Main screen wasn't opened"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package samples.ios.testapp.screens; | ||
|
||
import aquality.appium.elements.interfaces.IButton; | ||
import aquality.appium.elements.interfaces.ITextBox; | ||
import aquality.appium.screens.IOSScreen; | ||
import io.appium.java_client.MobileBy; | ||
import org.openqa.selenium.By; | ||
|
||
public class MainScreen extends IOSScreen { | ||
|
||
private static final By FIRST_TEXT_FIELD_LOCATOR = MobileBy.AccessibilityId("TextField1"); | ||
private final ITextBox txbFirstTextField = getElementFactory().getTextBox(FIRST_TEXT_FIELD_LOCATOR, "First text field"); | ||
private final IButton btnShowAlert = getElementFactory().getButton(MobileBy.AccessibilityId("show alert"), "Show alert"); | ||
|
||
public MainScreen() { | ||
super(FIRST_TEXT_FIELD_LOCATOR, "Main screen"); | ||
} | ||
|
||
public String getValueFromFirstTextBox() { | ||
return txbFirstTextField.getText(); | ||
} | ||
|
||
public void enterTextToFirstField(String value) { | ||
txbFirstTextField.typeSecret(value); | ||
} | ||
|
||
public void tapShowAlert() { | ||
btnShowAlert.click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package samples.ios.testapp.screens; | ||
|
||
import aquality.appium.elements.interfaces.IButton; | ||
import aquality.appium.elements.interfaces.ILabel; | ||
import aquality.appium.screens.IOSScreen; | ||
import io.appium.java_client.MobileBy; | ||
import org.openqa.selenium.By; | ||
|
||
public class TwoItemsAlertScreen extends IOSScreen { | ||
|
||
private static final By TITLE_LOCATOR = MobileBy.AccessibilityId("Cool title"); | ||
private final ILabel lblAlertTitle = getElementFactory().getLabel(MobileBy.AccessibilityId("Cool title"), "Title"); | ||
private final IButton btnOk = getElementFactory().getButton(MobileBy.AccessibilityId("OK"), "OK"); | ||
|
||
public TwoItemsAlertScreen() { | ||
super(TITLE_LOCATOR, "Alert screen"); | ||
} | ||
|
||
public String getTitle() { | ||
return lblAlertTitle.getText(); | ||
} | ||
|
||
public void acceptAlert() { | ||
btnOk.click(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > | ||
<suite name="iOS demo test suite"> | ||
<test name="Basic interactions tests"> | ||
<classes> | ||
<class name="samples.ios.IOSBasicInteractionsTest"/> | ||
</classes> | ||
</test> | ||
</suite> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need folder 'sample'?
why we test only 'Basic'? Our goal is up to 90% of the code should be covered with tests. Will the rest of tests developed later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes , will cover the other functionality in next prs