-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Selenium: Inspect methods logic in the "CodenvyEditor" pageobject and rework it where it necessary #9031
Conversation
ci-test |
ci-test build report: |
ci-test |
ci-test build report: |
ci-test |
ci-test build report: |
.waitVisibility(By.xpath(format(TAB_FILE_NAME_XPATH + "/parent::div", fileName))) | ||
.getAttribute("focused") | ||
!= null; | ||
} | ||
/** |
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.
empty line is missed
} | ||
|
||
public boolean waitAndCheckFocus(String fileName) { |
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.
It's hard to understand the method propose in context of Codenvy Editor.
@@ -132,6 +146,7 @@ public CodenvyEditor( | |||
String CONTEXT_MENU = "//div[@id='menu-lock-layer-id']/div[2]"; | |||
String EDITOR_TABS_PANEL = "gwt-debug-multiSplitPanel-tabsPanel"; | |||
String ACTIVE_LINE_NUMBER = "gwt-debug-cursorPosition"; | |||
String TAB_CONTEXT_MENU_BODY = "//*[@id='gwt-debug-contextMenu/closeAllEditors']/parent::tbody"; |
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.
Too complex xpath, IMHO. It's better to address the element by id, or name.
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.
Nothing complex just gets element by "ID" and gets it parent tag, only two steps and short note, this is usual case for "xpath".
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.
I meant parent::tbody
part. It's not reliable way to address parent element so as there could be anything instead of required one, isn't it?
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.
In this case it is quite acceptable.
@@ -141,8 +156,7 @@ public CodenvyEditor( | |||
String ORION_CONTENT_ACTIVE_EDITOR_XPATH = ORION_ACTIVE_EDITOR_CONTAINER_XPATH + "/div"; | |||
String ACTIVE_LINES_XPATH = | |||
"//div[@class='textviewSelection']/preceding::div[@class='annotationLine currentLine'][1]"; | |||
String ACTIVE_LINE_HIGHLIGHT = | |||
"//div[@class='annotationLine currentLine' and @role='presentation']"; | |||
String ACTIVE_LINE_HIGHLIGHT = "//div[@class='annotationLine currentLine']"; |
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.
XPath could be replaced by simpler variant - class name "annotationLine currentLine
".
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.
This is constant is not being used now. But it can be useful in the future. If I change the current constant to class name "annotationLine currentLine" it will be hard to understand what it means. Because it looks like "Id". In my opinion, "xpath" is better than constant name "CLASS_NAME_ACTIVE_LINE_HIGHLIGHT" , or comment.
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.
it will be hard to understand what it means. Because it looks like "Id"
Suffix _CLASS solves this problem.
XPath is the worst way to refer a web element so as it consists of redundant elements, syntax sugar etc, which make it much harder to read, understand and change. And it forces chromium to behave in procedural way to find an element.
Just compare:
String ACTIVE_LINE_HIGHLIGHT = "//div[@class='annotationLine currentLine']";
with
String ACTIVE_LINE_HIGHLIGHT_CLASS="annotationLine currentLine";
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.
"ACTIVE_LINE_HIGHLIGHT_CLASS" - I am thinking about the highlighted class name or something else but not about "By.className" locator.
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.
let's name it "ACTIVE_LINE_HIGHLIGHT__CLASS"
@@ -185,6 +199,7 @@ public CodenvyEditor( | |||
String JAVA_DOC_POPUP = "//div[@class='gwt-PopupPanel']//iframe"; | |||
String AUTOCOMPLETE_PROPOSAL_JAVA_DOC_POPUP = | |||
"//div//iframe[contains(@src, 'api/java/code-assist/compute/info?')]"; | |||
String HIGHLIGHT_ITEM = "//li[@selected='true']//span[text()='%s']"; |
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.
It's a pattern. It's better to express this moment in field name to avoid confusion.
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.
And what is your version? "HIGHLIGHT_ITEM_PATTERN" ?
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, it is.
ci-test |
ci-test build report: |
What does this PR do?
Inspect methods logic in the "CodenvyEditor" page object and rework it where it necessary
What issues does this PR fix or reference?
Issue: #9006
Release Notes
Docs PR