Open S4064172 opened 2 years ago
The tool now is able to create an inner page-object-method call in the same page-object-call.
To do this I have to add one role: the backToMain is mandatory, if we miss it the tool is not able to complete correctly the parse.
Could be good or do I have to add manually the backToMainBlock?
Moreover, if we try to inner in a page-object-class method of another page-object-class the tool is not able to complete correctly the parse.
Do I have to add some block or do I have to manage it?
After the meeting, we decided to keep just one level of deep. To do this we added a new command "BackToFather" which is optional: the tool can add this command if the tester doesn't insert it through the extension.
The result is the following:
(open questions)
Moreover, if we try to inner in a page-object-class method of another page-object-class the tool is not able to complete correctly the parse.
Do I have to add some block or do I have to manage it?
After the merge we notice a problem with the assertion management, when the assert is before o after an inner method, the tool was not able to put the assertion method in the main test.
During the integration test, we notice some problems with the declaration of PO and PO/method : If the tester forgets the backToMain and changes the PO the tool create an instance of the new PO in the previous PO method.
(in the plugin) System.out.println("{ASSESSOR}:DashBoard:addNewTeacher"); driver.findElement(By.linkText("Teachers")).click(); driver.findElement(By.linkText("Add Teacher")).click(); System.out.println("{ASSESSOR}:Teacher:checkCorrectPage"); assertThat(driver.findElement(By.cssSelector(".display-6")).getText(), is("Add Teacher")); System.out.println("{ASSESSOR}backToMain"); System.out.println("{ASSESSOR}:Teacher:setAllFields"); driver.findElement(By.id("inputFirstName")).click(); driver.findElement(By.id("inputFirstName")).sendKeys("Carla"); System.out.println("{ASSESSOR}backToMain");
(in the PO) public void addNewTeacher() { By elem = By.linkText("Teachers"); MyUtils.WaitForElementLoaded(driver, elem); driver.findElement(By.linkText("Teachers")).click(); elem = By.linkText("Add Teacher"); MyUtils.WaitForElementLoaded(driver, elem); driver.findElement(By.linkText("Add Teacher")).click(); Teacher _Teacher = new Teacher(driver, js, vars); }
public String addNewTeacher_1() { By elem = By.cssSelector(".display-6"); MyUtils.WaitForElementLoaded(driver, elem); return driver.findElement(By.cssSelector(".display-6")).getText(); }
(In the test) @Test public void studentSignUpsuccessful() { DashBoard _DashBoard = new DashBoard(driver, js, vars); _DashBoard.addNewTeacher(); assertThat(_DashBoard.addNewTeacher_1(), is("Add Teacher")); _Teacher.setAllFields("Carla"); }
Even if this is not a bug, we fixed it in order to prevent issues with the test case generation tool
When we interact with a form we want to create a function for each element, and when create a global function to use all the single method
From this:
MyUtils.WaitForElementLoaded(driver, elem); driver.findElement(By.id("customer_edit_form_comment")).click(); driver.findElement(By.id("customer_edit_form_comment")).clear(); driver.findElement(By.id("customer_edit_form_comment")).sendKeys(key1); driver.findElement(By.id("customer_edit_form_address")).click(); driver.findElement(By.id("customer_edit_form_address")).clear(); driver.findElement(By.id("customer_edit_form_address")).sendKeys(key2);
To:
public void setDescription(String description) { By _description = By.id("customer_edit_form_comment"); MyUtils.WaitForElementLoaded(driver, _description); driver.findElement(_description).clear(); driver.findElement(_description).sendKeys(description); }
public void setAllNonMandatoryFiels( String description, String address, ) { setDescription(description); setAddress(address); }