S4064172 / Assessor

0 stars 0 forks source link

Wait Management #6

Open S4064172 opened 2 years ago

S4064172 commented 2 years ago

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".

S4064172 commented 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);

S4064172 commented 2 years ago

added wait instruction before each Click command and each Assert

Image

there is some problem with the method's name of the assert command

S4064172 commented 2 years ago

After the meeting, we decided to add the wait command each time the locator changes

The result is:

Image

S4064172 commented 2 years ago

During the integration test, we notice some problems with the wait management: in some cases, the wait is put after the find instruction:

Image

we fixed it

S4064172 commented 2 years ago

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