Open S4064172 opened 2 years ago
Looking at the code we notice that the problem is related to the JavaTool that does not put the wait instruction before the assert command.
Moreover, the wait should add before each item
From this:
By elem = By.name("semester_name"); MyUtils.WaitForElementLoaded(driver, elem); driver.findElement(By.name("semester_name")).click(); driver.findElement(By.name("semester_name")).clear(); driver.findElement(By.name("semester_name")).sendKeys(key1);
To:
WebElement MyFind(By elem) { MyUtils.WaitForElementLoaded(driver, elem); return driver.findElement(elem); }
MyFind(By.name("semester_name")).click(); MyFind(By.name("semester_name")).clear(); MyFind(By.name("semester_name")).sendKeys(key1);
added wait instruction before each Click command and each Assert
there is some problem with the method's name of the assert command
After the meeting, we decided to add the wait command each time the locator changes
The result is:
During the integration test, we notice some problems with the wait management: in some cases, the wait is put after the find instruction:
we fixed it
During the integration test, we notice some problems with the wait management: in some cases the tool is not able to add the wait command before the locator
(In the plugin) public void studentSignUpsuccessful() { System.out.println("{ASSESSOR}:Student:setAllField");
driver.findElement(By.cssSelector("main")).click(); { WebElement element = driver.findElement(By.id("inputIdCardNumber")); Actions builder = new Actions(driver); builder.moveToElement(element).clickAndHold().perform(); }
driver.findElement(By.id("inputAssignToClass")).click(); { WebElement dropdown = driver.findElement(By.id("inputAssignToClass")); dropdown.findElement(By.xpath("//option[. = 'Class1']")).click(); }
System.out.println("{ASSESSOR}backToMain"); }
(in the PO) By elem = By.cssSelector("main"); MyUtils.WaitForElementLoaded(driver, elem); driver.findElement(By.cssSelector("main")).click(); { WebElement element = driver.findElement(By.id("inputIdCardNumber")); Actions builder = new Actions(driver); builder.moveToElement(element).clickAndHold().perform(); } elem = By.id("inputAssignToClass"); MyUtils.WaitForElementLoaded(driver, elem); driver.findElement(By.id("inputAssignToClass")).click(); { WebElement dropdown = driver.findElement(By.id("inputAssignToClass")); dropdown.findElement(By.xpath("//option[. = '" + key1 + "']")).click(); }
we fixed it
The tool improves basic wait management and works quite well. The problem occurs when the web app is very slow and the tool is not able to insert the correct wait/time in order to wait the "item".