def test_testAdvancedParameterSectionReset(self):
        print '=== Advanced parameter section default state check (cold start), save value, restore value and reset to default ==='

        print 'Open systemConfiguration dashboard'
        dashboard.open(self.browser)
        dashboard.openSystemConfiguration(self.browser)

        print 'Check Advanced parameter section default state (cold start)'
        panel = dashboard.systemConfiguration.getPanel(self.browser)
        self.assertFalse(panel.isAdvancedParametersSectionActive())

        print 'Enable Advanced parameter section'
        panel.enableAdvancedParametersSection()
        panel.apply()
        dashboard.close(self.browser)

        print 'Check that advanced parameter section state was saved'
        self.browser.refresh()
        dashboard.open(self.browser)
        dashboard.openSystemConfiguration(self.browser)
        panel = dashboard.systemConfiguration.getPanel(self.browser)
        self.assertTrue(panel.isAdvancedParametersSectionActive())

        print 'Reset to default value'
        panel.resetToDefaultValues()
        modals.waitOkCancelModal(self.browser).ok()
        # Reseting to default values make page reload, wait for page reloaded
        yadomsServer.waitPageLoaded(self.browser)

        print 'Re-open systemConfiguration dashboard and check state was restored'
        dashboard.open(self.browser)
        dashboard.openSystemConfiguration(self.browser)
        panel = dashboard.systemConfiguration.getPanel(self.browser)
        self.assertFalse(panel.isAdvancedParametersSectionActive())
Exemplo n.º 2
0
    def test_refreshPageOptionSaveRestoreReset(self):
        print(
            '=== RefreshPage option default value check (cold start), save value, restore value and reset to default ==='
        )

        print(
            'Open systemConfiguration dashboard and active advanced parameters'
        )
        dashboard.open(self.browser)
        dashboard.openSystemConfiguration(self.browser)
        panel = dashboard.systemConfiguration.getPanel(self.browser)
        advancedParameterSection = panel.enableAdvancedParametersSection()

        print('Check RefreshPage option default value (cold start)')
        self.assertTrue(
            panel.getRefreshPageOptionState(advancedParameterSection))

        print('Change RefreshPage option value')
        panel.setRefreshPageOption(advancedParameterSection, False)
        panel.apply()

        print('Close dashboard')
        dashboard.close(self.browser)

        print(
            'Re-open systemConfiguration dashboard and active advanced parameters'
        )
        dashboard.open(self.browser)
        dashboard.openSystemConfiguration(self.browser)
        panel = dashboard.systemConfiguration.getPanel(self.browser)
        advancedParameterSection = panel.enableAdvancedParametersSection()

        print('Check RefreshPage option was saved')
        self.assertFalse(
            panel.getRefreshPageOptionState(advancedParameterSection))

        print('Reset to default value')
        panel.resetToDefaultValues()
        modals.waitOkCancelModal(self.browser).ok()
        # Reseting to default values make page reload, wait for page reloaded
        yadomsServer.waitPageLoaded(self.browser)

        print(
            'Re-open systemConfiguration dashboard and active advanced parameters'
        )
        dashboard.open(self.browser)
        dashboard.openSystemConfiguration(self.browser)
        panel = dashboard.systemConfiguration.getPanel(self.browser)
        advancedParameterSection = panel.enableAdvancedParametersSection()

        print('Check default value was restored')
        self.assertTrue(
            panel.getRefreshPageOptionState(advancedParameterSection))
Exemplo n.º 3
0
   def test_viewLogRunningRule(self):
      print '=== view log of running rule test ==='

      print '  Open rules dashboard'
      dashboard.open(self.browser)
      dashboard.openAutomation(self.browser)
      ruleNumber = 0

      print '  Start the rule'
      rulesTable = dashboard.automation.waitRulesTableHasNRules(self.browser, 1)
      tools.waitUntil(lambda: dashboard.automation.getRuleStartStopButton(rulesTable, ruleNumber).is_enabled())
      dashboard.automation.getRuleStartStopButton(rulesTable, ruleNumber).click()
      WebDriverWait(self.browser, 10).until(lambda browser: dashboard.automation.getRuleState(rulesTable, ruleNumber) is dashboard.automation.RuleState.Running)
      
      print '  View log'
      dashboard.automation.getRuleLogButton(rulesTable, ruleNumber).click()

      print '  Check log'
      logModal = dashboard.automation.waitLogRuleModal(self.browser)
      self.assertIsNotNone(re.match(r'.*#### START ####.*', logModal.getLogContent(), re.DOTALL))

      print '  Clear log'
      logModal.getClearButton().click()
      confirmationModal = modals.waitOkCancelModal(self.browser)
      confirmationModal.ok()

      print '  Reopen log modal'
      dashboard.automation.getRuleLogButton(rulesTable, ruleNumber).click()
      self.assertIsNone(re.match(r'.*#### START ####.*', logModal.getLogContent(), re.DOTALL))

      print '  Close log modal'
      logModal.getConfirmButton().click()
Exemplo n.º 4
0
    def test_dontConfirmRemoveRule(self):
        print('=== Don\'t confirm remove rule test ===')

        # Wait startup notifications are closed
        self.assertTrue(
            tools.waitUntil(lambda: notification.noNotification(self.browser)))

        print('  Open rules dashboard')
        dashboard.open(self.browser)
        dashboard.openAutomation(self.browser)
        ruleNumber = 0

        print('  Get rule table')
        rulesTable = dashboard.automation.waitRulesTableHasNRules(
            self.browser, 1)
        removeButton = dashboard.automation.getRuleRemoveButton(
            rulesTable, ruleNumber)

        self.assertEqual(
            dashboard.automation.getRuleState(rulesTable, ruleNumber),
            dashboard.automation.RuleState.Stopped)

        print('  Remove rule')
        removeButton.click()
        confirmationModal = modals.waitOkCancelModal(self.browser)
        print('  Cancel')
        confirmationModal.cancel()

        print('  Expect no notification')
        self.assertTrue(notification.noNotification(self.browser))
        print('  Expect no change in rule table')
        self.assertEqual(
            dashboard.automation.getRuleNumberInTable(self.browser,
                                                      rulesTable), 1)
Exemplo n.º 5
0
    def doTest_removeRule(self, initialConditionsFct):
        print('  Open rules dashboard')
        dashboard.open(self.browser)
        dashboard.openAutomation(self.browser)
        ruleNumber = 0

        print('  Get rule table')
        rulesTable = dashboard.automation.waitRulesTableHasNRules(
            self.browser, 1)
        removeButton = dashboard.automation.getRuleRemoveButton(
            rulesTable, ruleNumber)

        initialConditionsFct(rulesTable, ruleNumber)

        print('  Remove rule')
        removeButton.click()
        confirmationModal = modals.waitOkCancelModal(self.browser)
        confirmationModal.ok()

        print('  Expect notification')
        notification.waitText(
            self.browser, notification.Type.Success,
            i18n.get()["modals"]["dashboard"]["sub-windows"]
            ["automation-center"]["ruleDeleted"])
        print('  Check table was updated')
        self.assertTrue(
            tools.waitUntil(
                lambda: dashboard.automation.getRuleNumberInTable(
                    self.browser, rulesTable) == 0, 5))