def test_3_no_device_model():
        print(
            colored('Running: test_3_no_device_model - estimate: 45s',
                    'yellow'))

        for i in range(3):
            print(colored('\tnew meter ' + str(i + 1), 'magenta'))
            click_fab_button()

            browser.find_element_by_id('serial-number').send_keys('testing' +
                                                                  str(i + 1))
            click_save_button()

            confirmation = browser.switch_to_alert()

            print(
                colored(
                    '\ttest_3_no_device_model: confirmation dialog - asserting...',
                    'blue'))
            assert "Error occurred while saving meter" in confirmation.text

            confirmation.accept()
            close_modal()
            sleep(2 * SLEEP_INTERVAL)

        print(colored('\ttest_3_no_device_model: passed.', 'cyan'))
Esempio n. 2
0
    def test_2_confirm_no_network():
        print(
            colored('Running: test_2_confirm_no_network - estimate: 40s',
                    'yellow'))
        prompt_to_disable_network()

        for i in range(3):
            print(colored('\trandom account ' + str(i + 1), 'magenta'))
            active_user_row = get_random_row_in_account_table()
            active_user_cols = active_user_row.find_elements_by_tag_name('td')
            click_action_button(active_user_cols)

            browser.find_element_by_id('delete-button').send_keys(Keys.ENTER)
            sleep(SLEEP_INTERVAL)

            browser.switch_to_alert().accept()
            sleep(9 + SLEEP_INTERVAL)

            print(
                colored(
                    '\ttest_2_confirm_no_network: deletion failed - asserting...',
                    'blue'))
            confirmation = browser.switch_to_alert()
            assert 'Error occurred while deleting account' in confirmation.text

            confirmation.accept()
            browser.find_element_by_id('cancel-button').send_keys(Keys.ENTER)
            sleep(SLEEP_INTERVAL)

        print(colored('\ttest_2_confirm_no_network: passed.', 'cyan'))
        prompt_to_enable_network_and_setup(browser,
                                           'Administration/ManageUser')
    def test_4_dates():
        print(colored('Running: test_4_dates - estimate: 57s', 'yellow'))

        for i in range(3):
            print(colored('\trandom node ' + str(i + 1), 'magenta'))
            updated_serial = get_random_node()

            installed_on_input = browser.find_element_by_id('installed-on')
            serviced_on_input = browser.find_element_by_id('serviced-on')

            installed_on_input.send_keys(date.today().strftime("%d/%m/%Y"))
            serviced_on_input.send_keys(date.today().strftime("%d/%m/%Y"))

            sleep(SLEEP_INTERVAL)
            click_update_button()

            print(
                colored('\ttest_4_dates: confirm delete - asserting...',
                        'blue'))
            assert "The AMR Device with Hex. Address " + updated_serial + " has been updated successfully." in browser.page_source

            # get_back_previously_updated_node(updated_serial)
            #
            # new_installed_on = browser.find_element_by_id('installed-on').get_property('value')
            # new_activated_on = browser.find_element_by_id('activated-on').get_property('value')
            #
            # print(colored('\ttest_4_dates: is dates correct - asserting...', 'blue'))
            # self.assertEqual(new_installed_on, date.today().strftime("%d/%m/%Y"))
            # self.assertEqual(new_activated_on, date.today().strftime("%d/%m/%Y"))
            #
            # close_modal()

        print(colored('\ttest_4_dates: passed.', 'cyan'))
Esempio n. 4
0
    def test_2_page_content(self):
        print(colored('Running: test_2_page_content - estimate: 2s', 'yellow'))

        print(
            colored('\ttest_2_page_content: list container - asserting...',
                    'blue'))
        sleep(2 * SLEEP_INTERVAL)
        self.assertEqual(check_existence('account-lists'), True)

        print(
            colored('\ttest_2_page_content: account form - asserting...',
                    'blue'))
        self.assertEqual(
            check_existence(
                '//div[@class="MuiFormControl-root MuiFormControl-fullWidth"]',
                is_id=False), True)

        account_list_container = browser.find_element_by_id('account-lists')
        account_lists = account_list_container.find_elements_by_xpath(
            '//tbody[@class="MuiTableBody-root"]')

        print(
            colored('\ttest_2_page_content: list count - asserting...',
                    'blue'))
        self.assertGreaterEqual(len(account_lists), 1)

        print(colored('\ttest_2_page_content: passed.', 'cyan'))
    def test_1_no_network():
        print(colored('Running: test_1_no_network - estimate: 11s', 'yellow'))
        prompt_to_disable_network()

        browser.find_element_by_id('save-button').send_keys(Keys.ENTER)
        sleep(9 + SLEEP_INTERVAL)

        confirmation = browser.switch_to_alert()
        print(
            colored('\ttest_1_no_network: create failed - asserting...',
                    'blue'))
        assert 'Error occurred while creating new account' in confirmation.text

        confirmation.accept()

        print(colored('\ttest_1_no_network: passed.', 'cyan'))
        prompt_to_enable_network_and_setup(browser,
                                           'Administration/ManageUser')
    def test_5_active_switch():
        print(
            colored('Running: test_5_active_switch - estimate: 57s', 'yellow'))

        for i in range(3):
            print(colored('\trandom meter ' + str(i + 1), 'magenta'))
            updated_serial = get_random_meter()

            active_switch = browser.find_element_by_id('is-active')
            active_switch.click()
            sleep(SLEEP_INTERVAL)
            click_update_button()
 def __init__(self):
     self.keyword_input = browser.find_element_by_id('gw-search-keyword')
     self.search_fields = browser.find_elements_by_name('gw-search-fields')
     self.date_from_input = browser.find_element_by_id(
         'gw-search-date-from')
     self.date_to_input = browser.find_element_by_id('gw-search-date-to')
     self.inverted_input = browser.find_element_by_id('gw-search-inverted')
     self.inactive_input = browser.find_element_by_id('gw-search-inactive')
     self.form_clear_button = browser.find_element_by_id('gw-search-clear')
     self.search_button = browser.find_element_by_id('gw-search-button')
    def test_4_correct_details(self):
        print(colored('Running: test_4_correct_details - estimate: 5s', 'yellow'))
        account_table_headers = get_table_headers()

        active_user_row = get_random_row_in_account_table()
        active_user_cols = active_user_row.find_elements_by_tag_name('td')
        click_action_button(active_user_cols)

        fullname_in_table = active_user_cols[account_table_headers.index('Full Name')].get_attribute('innerHTML')
        username_in_table = active_user_cols[account_table_headers.index('Username')].get_attribute('innerHTML')
        email_in_table = active_user_cols[account_table_headers.index('Email')].get_attribute('innerHTML')

        fullname_in_form = browser.find_element_by_id('full-name').get_attribute('value')
        username_in_form = browser.find_element_by_id('username').get_attribute('value')
        email_in_form = browser.find_element_by_id('email-address').get_attribute('value')

        print(colored('\ttest_4_correct_details: user details - asserting...', 'blue'))
        self.assertEqual(fullname_in_table, fullname_in_form)
        self.assertEqual(username_in_table, username_in_form)
        self.assertEqual(email_in_table, email_in_form)

        browser.find_element_by_id('cancel-button').click()
        print(colored('\ttest_4_correct_details: passed.', 'cyan'))
    def test_3_form_dropdown(self):
        print(colored('Running: test_3_form_dropdown - estimate: 5s', 'yellow'))
        org_dropdown = browser.find_element_by_id('organization')
        org_dropdown.send_keys(Keys.ENTER)
        sleep(SLEEP_INTERVAL)

        org_items = browser.find_elements_by_xpath('//ul[@class="MuiList-root MuiMenu-list '
                                                   'MuiList-padding"]/div')
        print(colored('\ttest_3_form_dropdown: org dropdown count - asserting...', 'blue'))
        self.assertGreaterEqual(len(org_items), 1)

        random_org = get_random_dropdown_item(org_items)
        selected_item = random_org.find_element_by_xpath('//span/div/div').get_attribute('innerHTML')
        random_org.click()

        sleep(SLEEP_INTERVAL)
        selected_org = selected_item  # browser.find_element_by_id('organization').get_attribute('innerHTML')
        print(colored('\ttest_3_form_dropdown: selected org - asserting...', 'blue'))
        self.assertEqual(selected_org, selected_item)

        print(colored('\ttest_3_form_dropdown: passed.', 'cyan'))
    def test_4_create_success():
        print(colored('Running: test_4_create_success - estimate: 27s', 'yellow'))

        for i in range(3):
            print(colored('\tnew command ' + str(i + 1), 'magenta'))
            click_fab_button()

            browser.find_element_by_id('command-name').send_keys('test name ' + str(i + 1))
            pick_random_dropdown_item('device-model')
            pick_random_dropdown_item('command-type')
            browser.find_element_by_id('command-syntax').send_keys('syntax ' + str(int(datetime.now().timestamp())))
            browser.find_element_by_id('command-description').send_keys('command description testing')

            click_save_button()

            print(colored('\ttest_4_create_success: alert message - asserting...', 'blue'))
            assert "New command has been created successfully." in browser.page_source

        print(colored('\ttest_4_create_success: passed.', 'cyan'))
    def test_5_clashed_primary_key():
        print(colored('Running: test_5_clashed_primary_key - estimate: 27s', 'yellow'))

        command = get_random_table_data('Command')
        click_fab_button()

        browser.find_element_by_id('command-name').send_keys('test name')
        browser.find_element_by_id('command-syntax').send_keys(command)
        pick_random_dropdown_item('device-model')
        pick_random_dropdown_item('command-type')
        browser.find_element_by_id('command-description').send_keys('command description testing')

        click_save_button()
        confirmation = browser.switch_to_alert()

        print(colored('\ttest_5_clashed_primary_key: confirmation dialog - asserting...', 'blue'))
        assert "Error occurred while saving command" in confirmation.text

        confirmation.accept()
        close_modal()
        sleep(2*SLEEP_INTERVAL)
    def test_1_no_network():
        print(colored('Running: test_1_no_network - estimate: 3s', 'yellow'))
        active_user_row = get_random_row_in_account_table()
        active_user_cols = active_user_row.find_elements_by_tag_name('td')
        click_action_button(active_user_cols)
        sleep(2*SLEEP_INTERVAL)

        browser.find_element_by_id('account-password').send_keys('testing')
        browser.find_element_by_id('confirm-password').send_keys('testing')

        prompt_to_disable_network()

        browser.find_element_by_id('save-button').send_keys(Keys.ENTER)
        sleep(9+SLEEP_INTERVAL)

        confirmation = browser.switch_to_alert()
        print(colored('\ttest_1_no_network: create failed - asserting...', 'blue'))
        assert 'Error occurred while updating account' in confirmation.text

        confirmation.accept()

        print(colored('\ttest_1_no_network: passed.', 'cyan'))
        prompt_to_enable_network_and_setup(browser, 'Administration/ManageUser')
    def test_4_create_success():
        print(
            colored('Running: test_4_create_success - estimate: 27s',
                    'yellow'))

        for i in range(3):
            print(colored('\tnew meter ' + str(i + 1), 'magenta'))
            end_point = get_random_table_data('End Point')
            click_fab_button()
            serial = str(int(datetime.now().timestamp()))

            browser.find_element_by_id('meter-name').send_keys('testing name')
            browser.find_element_by_id('serial-number').send_keys(serial)
            browser.find_element_by_id('endpoint-address').send_keys(end_point)
            browser.find_element_by_id('pulse-weight').send_keys('1.23')
            browser.find_element_by_id('volume-unit').send_keys('GB')
            browser.find_element_by_id('pairing-status').send_keys(
                'testing pairing status note')
            browser.find_element_by_id('installed-on').send_keys(
                date.today().strftime("%d/%m/%Y"))
            browser.find_element_by_id('activated-on').send_keys(
                date.today().strftime("%d/%m/%Y"))
            random_device_model = pick_random_dropdown_item('device-model')
            # random_model_value = random_device_model.find_element_by_xpath('//span/div/div').get_attribute('innerHTML')

            click_save_button()

            print(
                colored(
                    '\ttest_4_create_success: alert message - asserting...',
                    'blue'))
            assert "New meter has been saved successfully with Serial No. " + serial in browser.page_source

        print(colored('\ttest_4_create_success: passed.', 'cyan'))
Esempio n. 14
0
    def test_3_confirm_success():
        print(
            colored('Running: test_2_confirm_no_network - estimate: 20s',
                    'yellow'))
        account_table_headers = get_table_headers()

        for i in range(2):
            print(colored('\trandom account ' + str(i + 1), 'magenta'))
            active_user_row = get_random_row_in_account_table()
            active_user_cols = active_user_row.find_elements_by_tag_name('td')
            click_action_button(active_user_cols)

            browser.find_element_by_id('delete-button').send_keys(Keys.ENTER)
            sleep(SLEEP_INTERVAL)
            browser.switch_to_alert().accept()
            sleep(2 * SLEEP_INTERVAL)

            active_users_table = browser.find_element_by_xpath(
                '//tbody[@class="MuiTableBody-root"]')
            active_users_rows = active_users_table.find_elements_by_tag_name(
                'tr')
            active_users = [
                row for row in active_users_rows
                if len(row.find_elements_by_tag_name('td')) > 0
            ]

            user_names = []
            for user in active_users:
                user_names.append(
                    user.find_elements_by_tag_name('td')
                    [account_table_headers.index('Full Name')].get_attribute(
                        'innerHTML'))

            print(
                colored('\ttest_1_unconfirmed: active users - asserting...',
                        'blue'))
            assert active_user_cols[account_table_headers.index(
                'Full Name')] not in user_names

            if len(
                    browser.find_elements_by_xpath(
                        '//tbody[@class="MuiTableBody-root"]')) > 1:
                inactive_users_table = browser.find_elements_by_xpath(
                    '//tbody[@class="MuiTableBody-root"]')[1]
                inactive_users_rows = inactive_users_table.find_elements_by_tag_name(
                    'tr')
                inactive_users = [
                    row for row in inactive_users_rows
                    if len(row.find_elements_by_tag_name('td')) > 0
                ]

                in_user_names = []
                for user in inactive_users:
                    in_user_names.append(
                        user.find_elements_by_tag_name('td')[
                            account_table_headers.index(
                                'Full Name')].get_attribute('innerHTML'))

                print(
                    colored(
                        '\ttest_1_unconfirmed: inactive users - asserting...',
                        'blue'))
                assert active_user_cols[account_table_headers.index(
                    'Full Name')] in in_user_names

            print(colored('\ttest_1_unconfirmed: passed.', 'cyan'))
Esempio n. 15
0
    def test_1_unconfirmed(self):
        print(colored('Running: test_1_unconfirmed - estimate: 3s', 'yellow'))
        account_table_headers = get_table_headers()

        active_user_row = get_random_row_in_account_table()
        active_user_cols = active_user_row.find_elements_by_tag_name('td')
        click_action_button(active_user_cols)

        browser.find_element_by_id('delete-button').send_keys(Keys.ENTER)
        sleep(SLEEP_INTERVAL)

        confirmation = browser.switch_to_alert()
        print(
            colored('\ttest_1_unconfirmed: cancel deletion - asserting...',
                    'blue'))
        self.assertEqual(
            confirmation.text, 'Delete the account ' +
            active_user_cols[account_table_headers.index('Full Name')] +
            '. Continue?')

        active_users_table = browser.find_element_by_xpath(
            '//tbody[@class="MuiTableBody-root"]')
        active_users_rows = active_users_table.find_elements_by_tag_name('tr')
        active_users = [
            row for row in active_users_rows
            if len(row.find_elements_by_tag_name('td')) > 0
        ]

        user_names = []
        for user in active_users:
            user_names.append(
                user.find_elements_by_tag_name('td')[
                    account_table_headers.index('Full Name')].get_attribute(
                        'innerHTML'))

        print(
            colored('\ttest_1_unconfirmed: active users - asserting...',
                    'blue'))
        assert active_user_cols[account_table_headers.index(
            'Full Name')] in user_names

        if len(
                browser.find_elements_by_xpath(
                    '//tbody[@class="MuiTableBody-root"]')) > 1:
            inactive_users_table = browser.find_elements_by_xpath(
                '//tbody[@class="MuiTableBody-root"]')[1]
            inactive_users_rows = inactive_users_table.find_elements_by_tag_name(
                'tr')
            inactive_users = [
                row for row in inactive_users_rows
                if len(row.find_elements_by_tag_name('td')) > 0
            ]

            in_user_names = []
            for user in inactive_users:
                in_user_names.append(
                    user.find_elements_by_tag_name('td')
                    [account_table_headers.index('Full Name')].get_attribute(
                        'innerHTML'))

            print(
                colored('\ttest_1_unconfirmed: inactive users - asserting...',
                        'blue'))
            assert active_user_cols[account_table_headers.index(
                'Full Name')] not in in_user_names

        print(colored('\ttest_1_unconfirmed: passed.', 'cyan'))
 def __init__(self):
     self.username_input = browser.find_element_by_css_selector("button[type='submit']")
     self.password_input = browser.find_element_by_id('username')
     self.login_button = browser.find_element_by_id('password')
    def test_4_create_success():
        print(
            colored('Running: test_4_create_success - estimate: 27s',
                    'yellow'))

        for i in range(3):
            print(colored('\tnew gateway ' + str(i + 1), 'magenta'))
            click_fab_button()

            imei = str(int(datetime.now().timestamp())) + "-" + str(i + 1)
            browser.find_element_by_id('gateway-imei').send_keys(imei)
            browser.find_element_by_id('gateway-name').send_keys('test name')
            browser.find_element_by_id('phone-number').send_keys('test phone')
            browser.find_element_by_id('hex-address').send_keys('hex address')
            browser.find_element_by_id('dec-address').send_keys('dec address')
            browser.find_element_by_id('ip-address').send_keys('ip address')
            browser.find_element_by_id('software-version').send_keys(
                'sw version')
            browser.find_element_by_id('firmware-version').send_keys(
                'fw version')
            browser.find_element_by_id('sim-serial').send_keys('sim serial')
            browser.find_element_by_id('sim-puk').send_keys('sim puk')

            gateway_detail_form = browser.find_element_by_xpath(
                '//div[@class="MuiFormControl-root"]')
            device_model_dropdown = gateway_detail_form.find_element_by_id(
                'device-model')
            device_model_dropdown.send_keys(Keys.ENTER)
            sleep(SLEEP_INTERVAL)
            device_model_items = browser.find_elements_by_xpath(
                '//ul[@class="MuiList-root MuiMenu-list '
                'MuiList-padding"]/li')
            random_device_model = get_random_dropdown_item(device_model_items)
            random_device_model.click()

            click_save_button()

            print(
                colored(
                    '\ttest_4_create_success: alert message - asserting...',
                    'blue'))
            assert "New gateway has been created successfully with IMEI " + imei in browser.page_source

        print(colored('\ttest_4_create_success: passed.', 'cyan'))
    def test_5_clashed_primary_key():
        print(
            colored('Running: test_5_clashed_primary_key - estimate: 27s',
                    'yellow'))

        hex = get_random_table_data('Hex. Address')
        click_fab_button()

        browser.find_element_by_id('device-name').send_keys('test name')
        browser.find_element_by_id('hex-address').send_keys(hex)
        browser.find_element_by_id('dec-address').send_keys('decimal')
        browser.find_element_by_id('serial-number').send_keys('test serial')
        browser.find_element_by_id('installed-on').send_keys(
            date.today().strftime("%d/%m/%Y"))
        browser.find_element_by_id('serviced-on').send_keys(
            date.today().strftime("%d/%m/%Y"))
        random_device_model = pick_random_dropdown_item('device-model')

        click_save_button()
        confirmation = browser.switch_to_alert()

        print(
            colored(
                '\ttest_5_clashed_primary_key: confirmation dialog - asserting...',
                'blue'))
        assert "Error occurred while saving device" in confirmation.text

        confirmation.accept()
        close_modal()
        sleep(2 * SLEEP_INTERVAL)
    def test_4_create_success():
        print(
            colored('Running: test_4_create_success - estimate: 27s',
                    'yellow'))

        for i in range(3):
            print(colored('\tnew node ' + str(i + 1), 'magenta'))
            click_fab_button()

            browser.find_element_by_id('device-name').send_keys('test name ' +
                                                                str(i + 1))
            browser.find_element_by_id('hex-address').send_keys(
                str(int(datetime.now().timestamp())))
            browser.find_element_by_id('dec-address').send_keys('decimal' +
                                                                str(i + 1))
            browser.find_element_by_id('serial-number').send_keys(
                'test serial ' + str(i + 1))
            browser.find_element_by_id('installed-on').send_keys(
                date.today().strftime("%d/%m/%Y"))
            browser.find_element_by_id('serviced-on').send_keys(
                date.today().strftime("%d/%m/%Y"))
            random_device_model = pick_random_dropdown_item('device-model')
            # random_model_value = random_device_model.find_element_by_xpath('//span/div/div').get_attribute('innerHTML')

            click_save_button()

            print(
                colored(
                    '\ttest_4_create_success: alert message - asserting...',
                    'blue'))
            assert "New AMR Device has been saved successfully with Hex. Address" in browser.page_source

        print(colored('\ttest_4_create_success: passed.', 'cyan'))
    def test_5_clashed_primary_key():
        print(
            colored('Running: test_5_clashed_primary_key - estimate: 27s',
                    'yellow'))
        end_point = get_random_table_data('End Point')
        serial = get_random_table_data('Serial No.')
        click_fab_button()

        browser.find_element_by_id('meter-name').send_keys('testing name')
        browser.find_element_by_id('serial-number').send_keys(serial)
        browser.find_element_by_id('endpoint-address').send_keys(end_point)
        browser.find_element_by_id('pulse-weight').send_keys('1.23')
        browser.find_element_by_id('volume-unit').send_keys('GB')
        browser.find_element_by_id('pairing-status').send_keys(
            'testing pairing status note')
        browser.find_element_by_id('installed-on').send_keys(
            date.today().strftime("%d/%m/%Y"))
        browser.find_element_by_id('activated-on').send_keys(
            date.today().strftime("%d/%m/%Y"))
        random_device_model = pick_random_dropdown_item('device-model')

        click_save_button()
        confirmation = browser.switch_to_alert()

        print(
            colored(
                '\ttest_5_clashed_serial: confirmation dialog - asserting...',
                'blue'))
        assert "Error occurred while saving meter" in confirmation.text

        confirmation.accept()
        close_modal()
        sleep(2 * SLEEP_INTERVAL)
    def test_5_clashed_primary_key():
        print(
            colored('Running: test_5_clashed_primary_key - estimate: 27s',
                    'yellow'))

        imei = get_random_table_data('Imei')
        click_fab_button()

        browser.find_element_by_id('gateway-imei').send_keys(imei)
        browser.find_element_by_id('gateway-name').send_keys('test name')
        browser.find_element_by_id('phone-number').send_keys('test phone')
        browser.find_element_by_id('hex-address').send_keys('hex address')
        browser.find_element_by_id('dec-address').send_keys('dec address')
        browser.find_element_by_id('ip-address').send_keys('ip address')
        browser.find_element_by_id('software-version').send_keys('sw version')
        browser.find_element_by_id('firmware-version').send_keys('fw version')
        browser.find_element_by_id('sim-serial').send_keys('sim serial')
        browser.find_element_by_id('sim-puk').send_keys('sim puk')

        gateway_detail_form = browser.find_element_by_xpath(
            '//div[@class="MuiFormControl-root"]')
        device_model_dropdown = gateway_detail_form.find_element_by_id(
            'device-model')
        device_model_dropdown.send_keys(Keys.ENTER)
        sleep(SLEEP_INTERVAL)
        device_model_items = browser.find_elements_by_xpath(
            '//ul[@class="MuiList-root MuiMenu-list '
            'MuiList-padding"]/li')
        random_device_model = get_random_dropdown_item(device_model_items)
        random_device_model.click()

        click_save_button()
        confirmation = browser.switch_to_alert()

        print(
            colored(
                '\ttest_5_clashed_serial: confirmation dialog - asserting...',
                'blue'))
        assert "Error occurred while saving gateway" in confirmation.text

        confirmation.accept()
        close_modal()
        sleep(2 * SLEEP_INTERVAL)