Похожие презентации:
Page elements JDI
1. PAGE ELEMENTS JDI
29 JAN 20182.
PLANUI Objects. JDI
• JDI. Composite elements
• JDI Settings
• JDI for any UI
2
3.
AGENDAJDI ?
Simple Test
UI Objects
Simple Elements
Complex Elements
3
4. JDI?
45.
JDI SETUPhttps://github.com/epam/JDI
http://jdi.epam.com/
https://vk.com/jdi_framework
README
5
6.
JDI SETUP6
7.
DEMO: TEST PROJECT FROM SCRATCH7
8.
SIMPLE TESTProductPage.productType.select(«jacket»);
ProductPage.price.select(«500$»);
ProductPage.colors.check(«black», «white»);
Assert.isTrue(ProductPage.label.getText(), «Armani Jacket»)
9
9.
SIMPLE TESTLoginPage.open();
LoginPage.loginForm.login(admin);
SearchPage.search.find(«Cup»);
Assert.AreEqual(ResultsPage.products.count(), expected);
10
10.
DEMO: JDI UI OBJECTS11
11.
PAGE ELEMENTS12
12. Page elements
PAGE OBJECTSTests
Driver
(Engine)
Page Objects
Application
ELEMENTS
private WebElement UserName;
private WebElement Password;
private WebElement LoginButton;
• ACTIONS
• BUSINESS ACTIONS
• EnterUserName(String name); • Login(User user)
• EnterPassword(String name);
• ClickLoginButton();
13
13.
PAGE ELEMENTSELEMENTS
ELEMENT
public TextField UserName;
public TextField Password;
public Button LoginButton;
public DropDown UserStatus;
• ACTIONS
• ---
• BUSINESS ACTIONS
• ACTIONS
Select(string option)
bool IsSelcted()
List<string> AllOptions()
string GetValue()
• Login(User user)
14
14.
ELEMENTSSimple
Complex
Composite
15
15.
SIMPLEELEMENTS
16
16. Simple elements
SIMPLE ELEMENTS@FindBy (css=“.description”)
public Text description;
public Button submit;
public Label productName;
public Link followMe;
public TextField password;
public TextArea abuse;
public CheckBox rememberMe;
public DatePicker date;
public FileInput upload;
public Image photo;
NEWS
17
17.
SIMPLE ELEMENTS@FindBy (css=“.btn”)
public Button submit;
public Button submit =
new Button(By.css(“.btn”));
@FindBy (css=“.btn”)
public IButton submit;
@FindBy (css=“.btn”)
@FindBy (xpath=“//button”)
@FindBy (id=“button-id”)
@FindBy (name=“button”)
@JFindBy (text=“Submit”)
@JFindBy (model=“btn-model”)
@JFindBy (binding=“btn”)
@JFindBy (repeater=“r-button”)
18
18.
DEMO: SIMPLE ELEMENTS20
19.
COMPLEXELEMENTS
22
20.
COMPLEX ELEMENTSpublic Dropdown colors;
public Checklist settings;
public ComboBox tags;
public DropList shirtSizes;
public List<Element> searchResults;
public Elements reviews;
public Table products;
public Menu mainMenu;
public Tabs areas;
public Selector vote;
public RadioButtons rating;
public TextList chat;
23
21.
COMPLEX ELEMENTS@JDropdown (
root = @FindBy(css = “.colors"),
value = @FindBy(css = “.value"),
elementByName = @FindBy(tagName = “li"))
public Dropdown colors;
@JTable(
root
= @FindBy (css = “.offers"),
row
= @FindBy (xpath = ".//li[%s]//div"),
column = @FindBy (xpath = ".//li//div[%s]"),
header = {“ID", “Title", “Apply”} )
public Table offers;
24
22. complex elements
COMPLEX ELEMENTS@FindBy(css = “.colors")
public Dropdown colors;
@FindBy(css = “.table”)
public Table offers;
@FindBy(css = “.menu li”)
public Menu navigation;
@FindBy(css = “.menu ul”)
public Menu navigation;
@FindBy(xpath = “//*[@class=‘menu’]//li[text()=‘%s’]”)
public Menu navigation;
25
23.
USING ENUMS26
24.
ENUMS IN COMPLEX ELEMENTSpublic Menu<Options> topMenu;
public enum Options {
Home, About, Contacts }
topMenu.select(About);
topMenu.select(Options.About);
public Dropdown<Colors> colors;
public Tabs<Areas> areas;
public Checklist<Settings> settings;
public ComboBox<Tags> tags;
public DropList<Sizes> shirtSizes;
public Selector<VoteOptions> vote;
public RadioButtons<Ratings> rating;
public enum Options {
Home(‘option-1’),
About(‘option-3’),
public String value;
Options (String value) { this.value = value; }
@Override
public String toString() { return value; }
}
27
25.
DEMO: COMPLEX ELEMENTS28
26. Using enums
TYPIFIED ELEMENTS• Code readability
• Clear behavior
• Union of all element’s locators
• Union of element and its actions
• Detailed logging
29
27.
COMPAREText Description;
Button Submit;
Label ProductName;
Link FollowMe;
TextField Password;
TextArea Abuse;
CheckBox RememberMe;
DatePicker Date;
FileInput Upload;
Image Photo;
WebElement Description;
WebElement SubmitButton;
WebElement ProductName;
WebElement FollowMeLink;
WebElement PasswordField;
WebElement Abuse;
WebElement RememberMe;
WebElement DatePicker;
WebElement Upload;
WebElement Photo;
30
28.
COMPARE@JDropdown (root = @FindBy(css = “.colors"),
value
= @FindBy(css = “.value"),
elementByName = @FindBy(tagName = “li"))
Dropdown Colors;
@FindBy(css = “.colors .value")
WebElement ColorsValue;
@FindBy(css = “.colors li")
List<WebElement> ColorsList;
public string getColor() {
return ColorsValue.getText();
}
public void selectColor(string colorName) {
ColorsValue.Click();
for (WebElement color : ColorsList)
if (color.getText().Equals(colorName) {
color.Click();
return;
31
}
29.
COMPARE@FindBy (id = “trades")
public Table Colors;
@FindBy(css = "")
private List<WebElement> resultsColHeaders;
@FindBy(css = "")
private List<WebElement> resultsRowsHeaders;
@FindBy(css = "")
private List<WebElement> resultsCellsHeaders;
@FindBy(css = "")
private List<WebElement> resultsColumn;
@FindBy(css = "")
private List<WebElement> resultsRow;
ICell cell(Column column, Row row) { }
column) { }
ITable useCache(boolean value) { }
ICell cell(String columnName, String
MapArray<String, ICell> row(String value,
ITable useCache() { }
rowName) { }
Column column) { }
Table clone() { }
ICell cell(int columnIndex, int rowIndex) { }
MapArray<String, ICell> column(String value, Table copy() { }
List<ICell> cells(String value) { }
Row row) { }
ITable hasAllHeaders() { }
List<ICell> cellsMatch(String regex) { }
MapArray<String, ICell> row(int rowNum) { } ITable hasNoHeaders() { }
ICell cell(String value) { }
MapArray<String, ICell> row(String rowName) ITable hasOnlyColumnHeaders() { }
ICell cellMatch(String regex) { }
{}
ITable hasOnlyRowHeaders() { }
MapArray<String, MapArray<String, ICell>> List<String> rowValue(int colNum) { }
ITable hasColumnHeaders(List<String> value)
rows(String... colNameValues) { }
List<String> rowValue(String colName) { }
{}
MapArray<String, MapArray<String, ICell>> MapArray<String, ICell> column(int colNum) { <THeaders extends Enum> ITable
columns(String... rowNameValues) { }
}
hasColumnHeaders(Class<THeaders> headers)
boolean waitValue(String value, Row row) { } MapArray<String, ICell> column(String
{}
boolean waitValue(String value, Column
colName) { }
ITable hasRowHeaders(List<String> value) { }
column) { }
List<String> columnValue(int colNum) { }
<THeaders extends Enum> ITable
boolean isEmpty() { }
List<String> columnValue(String colName) { } hasRowHeaders(Class<THeaders> headers) { }
boolean waitHaveRows() { }
MapArray<String, SelectElement> header() { } ITable setColumnsCount(int value) { }
boolean waitRows(int count) { }
SelectElement header(String name) { }
ITable setRowsCount(int value) { }
ICell cell(String value, Row row) { }
List<String> headers() { }
ICell cell(String value, Column column) { }
List<String> footer() { }
List<ICell> cellsMatch(String regex, Row row) { List<ICell> getCells() { }
}
void clean() { }
List<ICell> cellsMatch(String regex, Column void clear() { }
32
30.
NEXTUI Objects. JDI
JDI. Composite elements
JDI Settings
JDI for any UI
34
31.
QUESTIONSroman.Iovlev
[email protected]
troektor1988osu
[email protected]
prox318is
[email protected]
atlasova_julia
[email protected]
35