diff --git a/Tests/SeleniumJava/FodSelenium/src/test/java/Tests/DashboardTest.java b/Tests/SeleniumJava/FodSelenium/src/test/java/Tests/DashboardTest.java index 195ea0d6beec1be28547ae218c98ee378e337014..fa96890349781dfe092c22931c8400b22cdcd541 100644 --- a/Tests/SeleniumJava/FodSelenium/src/test/java/Tests/DashboardTest.java +++ b/Tests/SeleniumJava/FodSelenium/src/test/java/Tests/DashboardTest.java @@ -697,6 +697,172 @@ public class DashboardTest { } + buffer.close(); + } + catch(Exception e) { + try(FileWriter fileWriter = new FileWriter(".\\logs\\log.txt")) { + fileWriter.write(e.getMessage()); + fileWriter.close(); + } catch (IOException ex) { + // Cxception handling + } + } + } + + @Test + static void LiveStatusAdd() { + for(int i = 0; i < 20; i++) + AddRuleWithName("testingLiveStatus"); + try(FileWriter fileWriter = new FileWriter(".\\logs\\DashboardReport.txt", true)) { + BufferedWriter buffer = new BufferedWriter(fileWriter); + buffer.newLine(); + buffer.append("LiveStatusAdd"); + buffer.newLine(); + try { + driver.findElement(By.id("navigation_dashboard_id")).click(); + buffer.append("Find and click on dashboard button: navigation_dashboard_id"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + try { + driver.findElement (By.xpath ("//*[contains(text(),'Rule add: testingLiveStatus')]")); + buffer.append("Find and text: Rule add: testingLiveStatus"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + + + buffer.close(); + } + catch(Exception e) { + try(FileWriter fileWriter = new FileWriter(".\\logs\\log.txt")) { + fileWriter.write(e.getMessage()); + fileWriter.close(); + } catch (IOException ex) { + // Cxception handling + } + } + } + + @Test + static void LiveStatusUpdate() { + for(int i = 0; i < 20; i++) + AddRuleWithName("testingLiveStatus"); + try(FileWriter fileWriter = new FileWriter(".\\logs\\DashboardReport.txt", true)) { + BufferedWriter buffer = new BufferedWriter(fileWriter); + buffer.newLine(); + buffer.append("LiveStatusUpdate"); + buffer.newLine(); + try { + driver.findElement (By.xpath ("//*[contains(name(),'edit_button_testingLiveStatus')]")); + buffer.append("Find and click on pending button: show_pending"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + try { + driver.findElement(By.id("id_comments")).sendKeys("1"); + buffer.append("Put 1 into comments input: id_comments"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage()); + buffer.newLine(); + } + try { + driver.findElement(By.id("applybutton")).click(); + buffer.append("Find and click Apply button: applybutton"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage()); + buffer.newLine(); + } + try { + driver.findElement(By.id("navigation_dashboard_id")).click(); + buffer.append("Find and click on dashboard button: navigation_dashboard_id"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + try { + driver.findElement (By.xpath ("//*[contains(text(),'Rule edit: testingLiveStatus')]")); + buffer.append("Find and text: Rule edit: testingLiveStatus"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + + + buffer.close(); + } + catch(Exception e) { + try(FileWriter fileWriter = new FileWriter(".\\logs\\log.txt")) { + fileWriter.write(e.getMessage()); + fileWriter.close(); + } catch (IOException ex) { + // Cxception handling + } + } + } + + @Test + static void LiveStatusUpdateFromDashboard() { + for(int i = 0; i < 20; i++) + AddRuleWithName("testingLiveStatus"); + try(FileWriter fileWriter = new FileWriter(".\\logs\\DashboardReport.txt", true)) { + BufferedWriter buffer = new BufferedWriter(fileWriter); + buffer.newLine(); + buffer.append("LiveStatusUpdateFromDashboard"); + buffer.newLine(); + try { + driver.findElement(By.id("navigation_dashboard_id")).click(); + buffer.append("Find and click on dashboard button: navigation_dashboard_id"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + try { + driver.findElement (By.xpath ("//*[contains(name(),'edit_button_testingLiveStatus')]")); + buffer.append("Find and click on pending button: show_pending"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + try { + driver.findElement(By.id("id_comments")).sendKeys("1"); + buffer.append("Put 1 into comments input: id_comments"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage()); + buffer.newLine(); + } + try { + driver.findElement(By.id("applybutton")).click(); + buffer.append("Find and click Apply button: applybutton"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage()); + buffer.newLine(); + } + + try { + driver.findElement (By.xpath ("//*[contains(text(),'Rule edit: testingLiveStatus')]")); + buffer.append("Find and text: Rule edit: testingLiveStatus"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + + buffer.close(); } catch(Exception e) { diff --git a/Tests/SeleniumJava/FodSelenium/src/test/java/Tests/MyRulesTest.java b/Tests/SeleniumJava/FodSelenium/src/test/java/Tests/MyRulesTest.java index 311c850440cd5869beee925ee578ec090c2f1b1a..cfe30ed6299747c0674356211c612ad8fc60d316 100644 --- a/Tests/SeleniumJava/FodSelenium/src/test/java/Tests/MyRulesTest.java +++ b/Tests/SeleniumJava/FodSelenium/src/test/java/Tests/MyRulesTest.java @@ -212,7 +212,7 @@ public class MyRulesTest { } } - public static void AddRuleWithName(Sting name) + public static void AddRuleWithName(String name) { Login(); try(FileWriter fileWriter = new FileWriter(".\\logs\\MyRulesReport.txt", true)) { @@ -2425,6 +2425,93 @@ public class MyRulesTest { } } + @Test + static void LiveStatusAdd() { + for(int i = 0; i < 20; i++) + AddRuleWithName("testingLiveStatus"); + try(FileWriter fileWriter = new FileWriter(".\\logs\\MyRulesReport.txt", true)) { + BufferedWriter buffer = new BufferedWriter(fileWriter); + buffer.newLine(); + buffer.append("LiveStatusAdd"); + buffer.newLine(); + + try { + driver.findElement (By.xpath ("//*[contains(text(),'Rule add: testingLiveStatus')]")); + buffer.append("Find and text: Rule add: testingLiveStatus"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + + + buffer.close(); + } + catch(Exception e) { + try(FileWriter fileWriter = new FileWriter(".\\logs\\log.txt")) { + fileWriter.write(e.getMessage()); + fileWriter.close(); + } catch (IOException ex) { + // Cxception handling + } + } + } + + @Test + static void LiveStatusUpdate() { + for(int i = 0; i < 20; i++) + AddRuleWithName("testingLiveStatus"); + try(FileWriter fileWriter = new FileWriter(".\\logs\\MyRulesReport.txt", true)) { + BufferedWriter buffer = new BufferedWriter(fileWriter); + buffer.newLine(); + buffer.append("LiveStatusUpdate"); + buffer.newLine(); + try { + driver.findElement (By.xpath ("//*[contains(name(),'edit_button_testingLiveStatus')]")); + buffer.append("Find and click on pending button: show_pending"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + try { + driver.findElement(By.id("id_comments")).sendKeys("1"); + buffer.append("Put 1 into comments input: id_comments"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage()); + buffer.newLine(); + } + try { + driver.findElement(By.id("applybutton")).click(); + buffer.append("Find and click Apply button: applybutton"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage()); + buffer.newLine(); + } + try { + driver.findElement (By.xpath ("//*[contains(text(),'Rule edit: testingLiveStatus')]")); + buffer.append("Find and text: Rule edit: testingLiveStatus"); + buffer.newLine(); + }catch(IOException exc) { + buffer.append(exc.getMessage() ); + buffer.newLine(); + } + + + buffer.close(); + } + catch(Exception e) { + try(FileWriter fileWriter = new FileWriter(".\\logs\\log.txt")) { + fileWriter.write(e.getMessage()); + fileWriter.close(); + } catch (IOException ex) { + // Cxception handling + } + } + } + @BeforeClass static void testSetUp() { diff --git a/templates/dashboard.html b/templates/dashboard.html index 9a821e01ab00d6fc4dd52e75d84daaac8c008b44..b703be65702c9764fb97a21e0344379a6cd67c7b 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -117,7 +117,7 @@ <a href="{% url 'edit-route' route.name %}" class="btn-info btn btn-xs btn-outline" id="edit_button_{{route.pk}}">{% trans "ReSync" %}</a> {% else %} {% ifequal route.status 'ERROR' %} - <a href="{% url 'edit-route' route.name %}" class="btn-info btn btn-xs btn-outline" id="edit_button_{{route.pk}}">{% trans "Fix it!" %}</a> + <a href="{% url 'edit-route' route.name %}" class="btn-info btn btn-xs btn-outline" name="edit_button_{{routename}}" id="edit_button_{{route.pk}}">{% trans "Fix it!" %}</a> {% else %} - {% endifequal %} diff --git a/templates/user_routes.html b/templates/user_routes.html index 88fdd16ace313bc805fb10e40b67f8ad069c5d93..ecee09161aa918ec934488ceb69fcfa0a9d0d915 100644 --- a/templates/user_routes.html +++ b/templates/user_routes.html @@ -394,7 +394,7 @@ $(document).ready( function(){ btn = '<a href="'+editurl+'" class="btn-info btn btn-sm btn-outline" id="edit_button_{{route.pk}}">{% trans "Resync" %}</a>'; } if (status == "ERROR" ){ - btn = '<a href="'+editurl+'" class="btn-info btn btn-sm btn-outline" id="edit_button_{{route.pk}}">{% trans "Fix it!" %}</a>'; + btn = '<a href="'+editurl+'" class="btn-info btn btn-sm btn-outline" name="edit_button_{{routename}}" id="edit_button_{{route.pk}}">{% trans "Fix it!" %}</a>'; } return btn; },