示例#1
0
class MyTestSuite_Diksha_tpds(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(100)
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.page_loading(self.driver)

    def test_issue01(self):

        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                content_course_regression_suite.cQube_content_course_regression
            )
        ])
        p = pwd()
        outfile = open(p.get_diksha_tpds_regression_report(), "w")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='Content BY Course Regression Test Report',
            verbosity=1,
        )
        runner1.run(regression_test)
        outfile.close()

    def test_issue02(self):

        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                content_textbook_regression_suite.
                cQube_content_textbook_regression)
        ])
        p = pwd()
        outfile = open(p.get_diksha_tpds_regression_report(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='Content By Textbook report Regression Test Report',
            verbosity=1,
        )
        runner1.run(regression_test)
        outfile.close()

    def test_issue03(self):

        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                usage_by_course_regression_suite.
                cQube_diskha_course_regression_report)
        ])
        p = pwd()
        outfile = open(p.get_diksha_tpds_regression_report(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title=' Usage By Course Report Regression Test Report',
            verbosity=1,
        )
        runner1.run(regression_test)
        outfile.close()

    def test_issue04(self):

        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                usage_by_textbook_regression_suite.
                cQube_usage_textbook_regression_report)
        ])
        p = pwd()
        outfile = open(p.get_diksha_tpds_regression_report(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title=' Usage By Textbook Report Regression Test Report',
            verbosity=1,
        )
        runner1.run(regression_test)
        outfile.close()

    def test_issue05(self):

        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                lpd_content_regression_test.cQube_lpdcontent_regression_Test)
        ])
        p = pwd()
        outfile = open(p.get_diksha_tpds_regression_report(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='TPD course Progress Regression Test Report',
            verbosity=1,
        )
        runner1.run(regression_test)
        outfile.close()

    def test_issue06(self):

        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                lpd_percentage_regression_test.
                cQube_lpdpercentage_regression_Test)
        ])
        p = pwd()
        outfile = open(p.get_diksha_tpds_regression_report(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='TPD Percentage Progress Regression Test Report',
            verbosity=1,
        )
        runner1.run(regression_test)
        outfile.close()

    def test_issue07(self):
        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                enrollment_regression_test.cQube_enrollment_regression)
        ])
        p = pwd()
        outfile = open(p.get_diksha_tpds_regression_report(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='TPD Enrollment Regression Test Report',
            verbosity=1,
        )
        runner1.run(regression_test)
        outfile.close()

    def test_issue08(self):
        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                completion_regression_test.
                cQube_completion_percentage_regression)
        ])
        p = pwd()
        outfile = open(p.get_diksha_tpds_regression_report(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='TPD Completion percentage Regression Test Report',
            verbosity=1,
        )
        runner1.run(regression_test)
        outfile.close()

    @classmethod
    def tearDownClass(self):
        self.driver.close()
class Health_card_regression_test(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(200)
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.page_loading(self.driver)
        self.data.navigate_to_health_card_index()
        self.data.page_loading(self.driver)
        time.sleep(20)

    def test_healthcard_icon_from_landingpage(self):
        function = Health_card_btn(self.driver)
        method = function.check_landing_healthcard_icon()
        self.assertEqual(0,
                         method,
                         msg="Failed to health card icon is not working ")
        self.data.page_loading(self.driver)

    def test_select_level_as_Districts_text(self):
        function = levels_dropdown(self.driver)
        method = function.select_level_as_Districts_text()
        self.assertEqual(
            0,
            method,
            msg="Passed district name records are not displayed in health card"
        )
        self.data.page_loading(self.driver)

    def test_select_level_as_blocks_text(self):
        function = levels_dropdown(self.driver)
        method = function.select_level_as_Blocks_text()
        self.assertEqual(
            0,
            method,
            msg="Passed Block name records are not displayed in health card")
        self.data.page_loading(self.driver)

    def test_select_level_as_clusters_text(self):
        function = levels_dropdown(self.driver)
        method = function.select_level_as_Clusters_text()
        self.assertEqual(
            0,
            method,
            msg="Passed Cluster name records are not displayed in health card")
        self.data.page_loading(self.driver)

    def test_select_level_as_school_text(self):
        function = levels_dropdown(self.driver)
        method = function.select_level_as_School_text()
        self.assertEqual(
            0,
            method,
            msg="Passed School name records are not displayed in health card")
        self.data.page_loading(self.driver)

    def test_select_level_as_Districts_id(self):
        function = levels_dropdown(self.driver)
        method = function.select_level_as_Districts_id()
        self.assertEqual(
            0,
            method,
            msg="Passed district id records displayed in health card")
        self.data.page_loading(self.driver)

    def test_select_level_as_blocks_id(self):
        function = levels_dropdown(self.driver)
        method = function.select_level_as_Blocks_id()
        self.assertEqual(
            0,
            method,
            msg="Passed Block id records are not displayed in health card")
        self.data.page_loading(self.driver)

    def test_select_level_as_clusters_id(self):
        function = levels_dropdown(self.driver)
        method = function.select_level_as_Clusters_id()
        self.assertEqual(
            0,
            method,
            msg="Passed Cluster id records are not displayed in health card")
        self.data.page_loading(self.driver)

    def test_select_level_as_school_id(self):
        function = levels_dropdown(self.driver)
        method = function.select_level_as_School_id()
        self.assertEqual(
            0,
            method,
            msg="Passed School id records are not displayed in health card")
        self.data.page_loading(self.driver)

    def test_Access_districtwise_to_Reports(self):
        func = Access_to_Reports(self.driver)
        res = func.check_with_districts_all_reports()
        self.assertEqual(0, res, msg='Goto to report is failed ')

    def test_blocks_accesss_reports(self):
        func = Access_to_Reports(self.driver)
        res1 = func.check_with_blocks_all_report()
        self.assertEqual(0, res1, msg='Goto to report is failed ')

    def test_clusters_accesss_reports(self):
        func = Access_to_Reports(self.driver)
        res2 = func.check_with_clusters_all_report()
        self.assertEqual(0, res2, msg='Goto to report is failed ')

    def test_school_accesss_reports(self):
        func = Access_to_Reports(self.driver)
        res3 = func.check_with_school_all_report()
        self.assertEqual(0, res3, msg='Goto to report is failed ')

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#3
0
 def setUp(self):
     self.data = GetData()
     self.driver = self.data.get_driver()
     self.data.open_cqube_appln(self.driver)
     self.data.page_loading(self.driver)
class School_wise_records():
    def __init__(self, driver):
        self.driver = driver

    def Clusters_select_box(self):
        self.p = pwd()
        self.load = GetData()
        count = 0
        self.fname = file_extention()
        self.driver.find_element_by_xpath(Data.hyper_link).click()
        self.load.page_loading(self.driver)
        clust = Select(self.driver.find_element_by_id(Data.cluster_dropdown))
        dists = Select(self.driver.find_element_by_id(Data.district_dropdown))
        Blocks = Select(self.driver.find_element_by_id(Data.blocks_dropdown))
        for i in range(len(dists.options) - 1, len(dists.options)):
            dists.select_by_index(i)
            self.load.page_loading(self.driver)
            for j in range(len(Blocks.options) - 1, len(Blocks.options)):
                Blocks.select_by_index(j)
                self.load.page_loading(self.driver)
                for k in range(1, len(clust.options)):
                    clust.select_by_index(k)
                    self.load.page_loading(self.driver)
                    value = self.driver.find_element_by_id(
                        Data.cluster_dropdown).get_attribute('value')
                    value = value[3:] + '_'
                    self.driver.find_element_by_id(Data.Download).click()
                    time.sleep(3)
                    self.filename = self.p.get_download_dir(
                    ) + '/' + self.fname.tpd_school() + value.strip(
                    ) + self.load.get_current_date() + '.csv'
                    print(self.filename)
                    file = os.path.isfile(self.filename)
                    if file != True:
                        print(
                            dists.options[i].text, Blocks.options[j].text,
                            clust.options[k].text,
                            'School wise records csv file is not downloaded')
                        count = count + 1
                    else:
                        with open(self.filename) as fin:
                            csv_reader = csv.reader(fin, delimiter=',')
                            header = next(csv_reader)
                            data = list(csv_reader)
                            row_count = len(data)
                        os.remove(self.filename)
                        time.sleep(2)
                        if row_count == 0:
                            print("records are not found in csv file ")
                            count = count + 1
                        self.load.page_loading(self.driver)
        return count
示例#5
0
class periodic_regression(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(100)
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.navigate_to_periodic_report()
        self.data.page_loading(self.driver)

    def test_dashboard_patreport(self):
        count = 0
        self.driver.find_element_by_xpath(Data.hyper_link).click()
        self.data.page_loading(self.driver)
        self.driver.find_element_by_id(Data.home).click()
        self.data.page_loading(self.driver)
        self.data.navigate_to_periodic_report()
        time.sleep(3)
        if 'pat-report' in self.driver.current_url:
            print('Navigated to Periodic Assessment report')
        else:
            print('Pat report icon is not working')
            count = count + 1
        self.assertEqual(count, 0, msg='Pat report button is not working')
        self.data.page_loading(self.driver)

    def test_DistrictwiseCsv(self):
        cls = DistrictwiseCsv(self.driver)
        func = cls.click_download_icon()
        self.assertEqual(0,
                         func,
                         msg='Mismatch found at Districtwise footer values')
        print('Downloading district level csv file is working')
        self.data.page_loading(self.driver)

    def test_blockbutton_footers(self):
        b = Block_level_footers(self.driver)
        res1, res2 = b.check_with_footervalues()
        self.assertNotEqual(0,
                            res1,
                            msg='markers are not present on block levels')
        self.assertEqual(0, res2, msg='Footer values mis match found')
        print('Block level records are working fine')
        self.data.page_loading(self.driver)

    def test_clusterbutton_footers(self):
        b = Clusterwise_footers(self.driver)
        res1, res2 = b.check_with_footervalues()
        self.assertNotEqual(0,
                            res1,
                            msg='markers are not present on block levels')
        self.assertEqual(0, res2, msg='Footer values mis match found')
        print('cluster level records are working fine')
        self.data.page_loading(self.driver)

    def test_schoolbutton_footers(self):
        b = Schoolwise_footers(self.driver)
        res1, res2 = b.check_with_footers()
        self.assertNotEqual(0,
                            res1,
                            msg='markers are not present on block levels')
        self.assertEqual(0, res2, msg='Footer values mis match found')
        print('School level records are working fine')
        self.data.page_loading(self.driver)

    def test_TotalStudentsSchools(self):
        b = TotalStudentsSchools(self.driver)
        res1, res2, res3, res4, res5, res6, res7, res8 = b.block_cluster_schools_footer_info(
        )
        self.assertEqual(int(res1),
                         int(res3),
                         msg='Block level student info is mis matched')
        self.assertEqual(int(res2),
                         int(res4),
                         msg='Block level school info is mis matched')
        self.assertEqual(int(res1),
                         int(res5),
                         msg='Cluster level student info is mis matched')
        self.assertEqual(int(res2),
                         int(res6),
                         msg='Cluster level school info is mis matched')
        self.assertEqual(int(res1),
                         int(res7),
                         msg='School level student info is mis matched')
        self.assertEqual(int(res2),
                         int(res8),
                         msg='School level school info is mis matched')
        print(
            'Checked with footer values accross block ,cluster , school levels '
        )
        self.data.page_loading(self.driver)

    def test_homebtn(self):
        b = Home(self.driver)
        res = b.click_HomeButton()
        self.assertEqual(0, res, msg='home button is not worked ')
        print('Home button is working ')
        self.data.navigate_to_periodic_report()
        self.data.page_loading(self.driver)

    def test_check_hyperlinks(self):
        hyperlinks = Hyperlink(self.driver)
        result1, result2, choose_dist = hyperlinks.click_on_hyperlinks()
        if result1 == False and result2 == False and choose_dist == "Choose a District":
            print("hyperlinks are working")
        else:
            raise self.failureException("hyperlinks are not working")
        self.data.page_loading(self.driver)

    def test_Logout(self):
        b = Logout(self.driver)
        res = b.click_on_logout()
        self.assertEqual('Log in to cQube',
                         res,
                         msg='Logout button is not working')
        self.data.page_loading(self.driver)
        print('Logout button is button and navigated to login page ')
        self.data.login_cqube(self.driver)
        self.data.navigate_to_periodic_report()
        self.data.page_loading(self.driver)

    def test_each_district(self):
        b = District(self.driver)
        res = b.check_district()
        self.assertEqual(0,
                         res,
                         msg='Some mis match found at districtwise records')
        print('Districtwise records are working fine')
        self.data.page_loading(self.driver)

    def test_district_block_clusterwise(self):
        b = DistrictBlockCluster(self.driver)
        res = b.check_district_block_cluster()
        self.assertEqual(0,
                         res,
                         msg='Some mis match found at school level records')
        print('School level records are working fine')
        self.data.page_loading(self.driver)

    def test_periodic_grades(self):
        b = periodic_grades(self.driver)
        res = b.check_grade_dropdown_options()
        print("checking with each grades")
        self.data.page_loading(self.driver)

    def test_grades_subjects(self):
        b = periodic_grades(self.driver)
        res = b.select_subjects_dropdown()
        print("checking with each grades with subjects")
        self.data.page_loading(self.driver)

    def test_timeseries(self):
        b = timeseries(self.driver)
        res = b.test_options_times()
        self.assertNotEqual(0, res, msg="Time series options are not present ")
        print("checking with time period options ")
        self.data.page_loading(self.driver)

    def test_timeseries_with_downloading(self):
        b = timeseries(self.driver)
        res = b.time_over_all()
        self.assertEqual(0, res, msg="Some mismatch found in footer values")
        print("checking with time period options ")
        self.data.page_loading(self.driver)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#6
0
class cQube_diskha_chart(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(50)
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.navigate_to_diksha_graph()
        self.data.page_loading(self.driver)

    def test_navigate_diksha(self):
        b = Diksha_page(self.driver)
        result = b.test_navigation()
        self.data.page_loading(self.driver)

    def test_click_on_diksha_chart_icon(self):
        self.driver.find_element_by_id('homeBtn').click()
        self.data.page_loading(self.driver)
        count = 0
        self.driver.find_element_by_xpath("//img[@alt='dikshaChart']").click()
        self.data.page_loading(self.driver)
        if "diksha-chart" in self.driver.current_url:
            print("Diksha chart report page is present ")
        else:
            print("Diksha chart page is not exist")
            count = count + 1
        self.assertEqual(0, count, msg="Diksha chart icon is not working ")
        self.data.page_loading(self.driver)

    def test_hyperlink(self):
        b = Diksha_hyperlink(self.driver)
        result = b.test_hyperlink()
        self.data.page_loading(self.driver)

    def test_choosedistricts(self):
        b = district_list(self.driver)
        res = b.test_each_districts()
        self.assertEqual(0,
                         res,
                         msg="Some district's content play  are missing ")
        self.data.page_loading(self.driver)

    def test_timeperiods(self):
        self.driver.find_element_by_xpath(Data.hyper_link).click()
        self.data.page_loading(self.driver)
        times = Select(self.driver.find_element_by_name('timePeriod'))
        count = len(times.options) - 1
        for i in range(1, len(times.options)):
            times.select_by_index(i)
            time.sleep(2)
        self.assertNotEqual(0, count, msg="Time periods are not present")
        self.data.page_loading(self.driver)

    def test_all_data_file_donwload(self):
        b = Diksha_overall_download(self.driver)
        res = b.test_overall_file()
        self.assertTrue(res, msg="All data csv file is downloaded")
        self.data.page_loading(self.driver)

    def test_Diksha_students_download(self):
        b = Diksha_students_download(self.driver)
        res = b.test_student_file()
        self.assertTrue(res, msg="student data csv file is downloaded")
        self.data.page_loading(self.driver)

    def test_Diksha_teacher_download(self):
        b = Diksha_teacher_download(self.driver)
        res = b.test_teacher_file()
        self.assertTrue(res, msg="teacher data csv file is downloaded")
        self.data.page_loading(self.driver)

    def test_Diksha_others_download(self):
        b = Diksha_others_download(self.driver)
        res = b.test_others_file()
        self.assertTrue(res, msg="Others data csv file is downloaded")
        self.data.page_loading(self.driver)

    def test_lastday_records(self):
        b = Districtwise_overall_chart(self.driver)
        res = b.test_each_districts()
        self.assertNotEqual(
            res, 0, msg="Some of charts are showing  No Data Available ")
        self.data.page_loading(self.driver)

    def test_lastmonth_wise(self):
        b = Districtwise_lastmonth_chart(self.driver)
        res = b.test_each_districts()
        self.assertNotEqual(
            res, 0, msg="Some of charts are showing  No Data Available ")
        self.data.page_loading(self.driver)

    def test_lastweek_wise(self):
        b = Districtwise_lastweek_chart(self.driver)
        res = b.test_each_districts()
        self.assertNotEqual(
            res, 0, msg="Some of charts are showing  No Data Available ")
        self.data.page_loading(self.driver)

    def test_Diksha_homeicon(self):
        b = Diksha_homeicon(self.driver)
        res = b.test_homeicon()
        self.assertEqual(res, 0, msg="Homeicon is not working ")
        self.data.page_loading(self.driver)

    def test_Diksha_logout(self):
        b = Diksha_logout(self.driver)
        res = b.test_logout()
        self.assertEqual(res, 'Log in to cQube', msg="Logout is not working")
        self.data.page_loading(self.driver)

    def test_contentplay_for_lastmonth(self):
        b = test_all_data(self.driver)
        res = b.test_last30_days()
        self.assertEqual(
            0,
            res,
            msg=
            "some mismatch found at csv file content sum and ui side content plays "
        )
        print("Checked with all type of last month content plays count ")
        self.data.page_loading(self.driver)

    def test_contentplay_for_lastday(self):
        b = test_all_data(self.driver)
        res = b.test_last_day()
        self.assertEqual(
            0,
            res,
            msg=
            "some mismatch found at csv file content sum and ui side content plays "
        )
        print("Checked with all type of last day content plays count ")
        self.data.page_loading(self.driver)

    def test_contentplay_for_last7day(self):
        b = test_all_data(self.driver)
        res = b.test_last_7_day()
        self.assertEqual(
            0,
            res,
            msg=
            "some mismatch found at csv file content sum and ui side content plays "
        )
        print("Checked with all type of last 7 days content plays count ")
        self.data.page_loading(self.driver)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#7
0
class cQube_lpdcontent_system_Test(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(100)
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.page_loading(self.driver)
        self.data.navigate_to_tpd_content_progress()

    def test_navigation_from_hamburger(self):
        count = 0
        self.driver.find_element_by_xpath(Data.hyper_link).click()
        self.data.page_loading(self.driver)
        self.driver.find_element_by_id(Data.home).click()
        self.data.page_loading(self.driver)
        if 'dashboard' in self.driver.current_url:
            print('Landing page is displayed ')
        else:
            print('Home btn is not worked')
            count = count + 1
        self.data.navigate_to_tpd_content_progress()
        self.data.page_loading(self.driver)
        if 'tpd-course-progress' in self.driver.current_url:
            print('Diksha lpd content progress report is present')
        else:
            print('LPD Content progress report is not displayed')
            count = count + 1
        self.assertEqual(0, count, msg='Navigation failed in landing page')
        self.data.page_loading(self.driver)

    def test_lastday_csv_download(self):
        b = Time_periods(self.driver)
        res = b.check_last_day_districtwise_download()
        self.assertEqual(0, res, msg='Csv file is not downloaded')
        print('Last Day content progress district wise csv file is downloaded')
        self.data.page_loading(self.driver)

    def test_last7day_csv_download(self):
        b = Time_periods(self.driver)
        res = b.check_last_7_days_districtwise_download()
        self.assertEqual(0, res, msg='Csv file is not downloaded')
        print(
            'Last 7 Days content progress district wise csv file is downloaded'
        )
        self.data.page_loading(self.driver)

    def test_last30day_csv_download(self):
        b = Time_periods(self.driver)
        res = b.check_last_30_day_districtwise_download()
        self.assertEqual(0, res, msg='Csv file is not downloaded')
        print(
            'Last 30 Days content progress district wise csv file is downloaded'
        )
        self.data.page_loading(self.driver)

    def test_all_type_csv_download(self):
        b = Time_periods(self.driver)
        res = b.check_all_districtwise_download()
        self.assertEqual(0, res, msg='Csv file is not downloaded')
        print('All time content progress district wise csv file is downloaded')
        self.data.page_loading(self.driver)

    def test_all_districts(self):
        b = district_level_records(self.driver)
        res = b.test_all_districtwise()
        self.assertEqual(
            0, res, msg='All type some district wise csv file not downloaded')
        print('checked with all period all districts')
        self.data.page_loading(self.driver)

    def test_Cluster_wise_records(self):
        b = Cluster_wise_records(self.driver)
        res = b.Blocks_select_box()
        self.assertEqual(0, res, msg="some cluster csv file not downloaded")
        print("checked with cluster wise records")

    def test_School_wise_records(self):
        b = School_wise_records(self.driver)
        res = b.Clusters_select_box()
        self.assertEqual(0, res, msg="School wise csv file is not downloaded")
        print("checked school wise records")
        self.data.page_loading(self.driver)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#8
0
class composite_system_report(unittest.TestCase):

    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(50)
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.navigate_to_composite_report()
        self.data.page_loading(self.driver)


    def test_composite_icon(self):
        self.data.page_loading(self.driver)
        count = 0
        self.driver.find_element_by_id(Data.home).click()
        self.data.page_loading(self.driver)
        if 'home' in self.driver.current_url:
            print("Landing page is displayed ")
        else:
            print('Home button is not working ')
            count = count + 1
        self.assertEqual(0,count,msg="Home btn is not working ")
        self.driver.find_element_by_id('composite').click()
        self.data.page_loading(self.driver)

    def test_districtwise_csv_download(self):
        b = Districtwise_download(self.driver)
        res = b.test_districtwise()
        self.assertTrue(res, msg="Districtwise csv file is not downloaded ")
        print("Checked district wise csv downloading functionality is working ")
        b.remove_csv()
        self.data.page_loading(self.driver)

    def test_blockwise_csv_download(self):
        b = download_blockwise_csv(self.driver)
        res = b.test_blockwise()
        self.assertTrue(res, msg="Blockwise csv file is not downloaded ")
        print("Checked block wise csv downloading functionality is working ")
        b.remove_file()
        self.data.page_loading(self.driver)

    def test_clusterwise_csv_download(self):
        b = download_clusterwise_csv(self.driver)
        res = b.test_clusterwise()
        self.assertTrue(res, msg="Clusterwise csv file is not downloaded ")
        print("Checked cluster wise csv downloading functionality is working ")
        b.remove_file()
        self.data.page_loading(self.driver)

    def test_school_wise_download(self):
        b = school_wise_download(self.driver)
        res = b.test_schoolwise()
        self.assertTrue(res, msg="Schoolwise csv file is not downloaded ")
        print("Checked school wise csv downloading functionality is working ")
        b.remove_file()
        self.data.page_loading(self.driver)

    def test_composite_schoolwise_records(self):
        b = composite_schoolevel_records(self.driver)
        res = b.check_csv_download()
        self.assertTrue(res, msg="Some of school csv file is not downloaded ")
        print("Checked with School wise csv file downloading ")
        self.data.page_loading(self.driver)



    def test_blocks_clusters_schools(self):
        b = Blocks_cluster_schools_Buttons(self.driver)
        res = b.click_on_blocks_button()
        self.assertEqual(0, res, msg="Blocks graph is displayed ")
        print("Block wise graph is displayed ")
        self.data.page_loading(self.driver)

        b = Blocks_cluster_schools_Buttons(self.driver)
        res = b.click_on_clusters_button()
        self.assertEqual(0, res, msg="Cluster graph is displayed ")
        print("Cluster wise graph is displayed ")
        self.data.page_loading(self.driver)



    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#9
0
    def check_districts_block(self):
        cal = GetData()
        self.fname = file_extention()
        cal.click_on_state(self.driver)
        cal.page_loading(self.driver)
        select_district = Select(self.driver.find_element_by_id('choose_dist'))
        select_block = Select(self.driver.find_element_by_id('choose_block'))
        count = 0
        for x in range(
                len(select_district.options) - 1,
                len(select_district.options)):
            select_district.select_by_index(x)
            cal.page_loading(self.driver)
            for y in range(
                    len(select_block.options) - 1, len(select_block.options)):
                select_block.select_by_index(y)
                cal.page_loading(self.driver)
                markers = self.driver.find_elements_by_class_name(Data.dots)
                if len(markers) - 1 == 0:
                    print("District" +
                          select_district.first_selected_option.text +
                          "Block" + select_block.first_selected_option.text +
                          "No Data")
                    count = count + 1
                else:
                    time.sleep(2)
                    self.driver.find_element_by_id('download').click()
                    time.sleep(2)
                    p = pwd()
                    self.filename = p.get_download_dir(
                    ) + "/" + self.fname.sr_blockwise()
                    if not os.path.isfile(self.filename):
                        print("District" +
                              select_district.first_selected_option.text +
                              "Block" +
                              select_block.first_selected_option.text +
                              "csv is not downloaded")
                        count = count + 1
                    else:
                        with open(self.filename) as fin:
                            csv_reader = csv.reader(fin, delimiter=',')
                            header = next(csv_reader)
                            total = 0
                            schools = 0
                            for row in csv.reader(fin):
                                total += int(row[13].replace(',', ''))
                                schools += int(row[14].replace(',', ''))
                            students = self.driver.find_element_by_id(
                                "students").text
                            res = re.sub('\D', "", students)

                            school = self.driver.find_element_by_id(
                                "schools").text
                            sc = re.sub('\D', "", school)
                            if int(res) != total:
                                print("District" + select_district.
                                      first_selected_option.text + "Block" +
                                      select_block.first_selected_option.text +
                                      "student count mismatched")
                                count = count + 1
                            if int(sc) != schools:
                                print("District" + select_district.
                                      first_selected_option.text + "Block" +
                                      select_block.first_selected_option.text +
                                      "school count mismatched")
                                count = count + 1
                        self.remove_csv()

        return count
class cQube_SI_Map_Report(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.total_tests = 39
        self.tests = [0] * 40
        self.data = GetData()
        self.logger = self.data.get_regression_log("schoolinframap")
        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.navigate_to_school_infrastructure_map()
        time.sleep(5)

    def test_check_district_names(self):
        self.tests.pop()
        self.logger.info("test_check_district_names" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = District_names(self.driver)
        result = b.test_districtlist()
        self.assertNotEqual(
            0, result, msg="All Districts are not present in select box!..")
        print("District names order checked")
        self.logger.info("test_check_district_names is completed...")

    def test_check_markes_on_map(self):
        self.tests.pop()
        self.logger.info("test_check_markes_on_map" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = check_markers_on_map(self.driver)
        result = b.test_map()
        self.assertNotEqual(0, result, msg="Data not present on map")
        self.data.page_loading(self.driver)
        print("markers on map ")
        self.logger.info("test_check_markes_on_map is completed...")

    def test_infrascore(self):
        self.tests.pop()
        self.logger.info("test_infrascore" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = SchoolInfra_scores(self.driver)
        infra_score = b.infra_score()
        b.remove_csv()
        self.assertNotEqual(0, infra_score, msg='Failed')

        boy_toilet = b.Boys_toilet_percentage()
        b.remove_csv()
        self.assertNotEqual(0, boy_toilet, msg='Failed')

        drinking_water = b.drinking_water()
        b.remove_csv()
        self.assertNotEqual(0, drinking_water, msg='Failed')

        Electricity = b.Electricity()
        b.remove_csv()
        self.assertNotEqual(0, Electricity, msg='Failed')

        girl_toilet = b.girls_toilet()
        b.remove_csv()
        self.assertNotEqual(0, girl_toilet, msg='Failed')

        Handpump = b.Handpump()
        b.remove_csv()
        self.assertNotEqual(0, Handpump, msg='Failed')

        Handwash = b.Handwash()
        b.remove_csv()
        self.assertNotEqual(0, Handwash, msg='Failed')

        Library = b.Library()
        b.remove_csv()
        self.assertNotEqual(0, Library, msg='Failed')

        Solar_panel = b.Solar_panel()
        b.remove_csv()
        self.assertNotEqual(0, Solar_panel, msg='Failed')

        Tapwater = b.Tapwater()
        b.remove_csv()
        self.assertNotEqual(0, Tapwater, msg='Failed')

        Toilet = b.Toilet()
        b.remove_csv()
        self.assertNotEqual(0, Toilet, msg='Failed')
        self.logger.info("test_infrascore is completed...")

    def test_school_infra_options(self):
        self.tests.pop()
        self.logger.info("test_school_infra_options" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = School_infra_options(self.driver)
        res1, res2 = b.test_options()
        self.assertEqual(res1, "Report", msg="option is not available")
        self.assertEqual(res2,
                         "Map based Report",
                         msg="option is not available")
        print("School infrastructure report contains two reports ")
        self.data.page_loading(self.driver)
        self.logger.info("test_school_infra_options is completed...")

    def test_download(self):
        self.tests.pop()
        self.logger.info("test_download" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = download_icon(self.driver)
        res = b.test_donwload()
        if "school-infra-map" in self.driver.current_url:
            print("School infrastructure map based report present")
        else:
            print("School infra map report is not exist")
        self.logger.info("test_download is completed...")

    def test_click_on_home(self):
        self.tests.pop()
        self.logger.info("test_click_on_home" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_on_home(self.driver)
        c1, c2, c3 = b.test_home()
        self.assertNotEqual(0, c1, msg="Records are not present on map ")
        self.assertNotEqual(0, c2, msg="Records are not present on map ")
        self.assertNotEqual(0, c3, msg="Records are not present on map ")
        print("cluser level home icon is working")
        self.logger.info("test_click_on_home is completed...")

    def test_blockelevel_home_click(self):
        self.tests.pop()
        self.logger.info("test_blockelevel_home_click" + " " + "Total :" +
                         " " + str(self.total_tests) + " " + "Remaining :" +
                         " " + str(len(self.tests) - 1))
        b = block_level_home(self.driver)
        res = b.test_blocks()
        if "school-infra-map" in self.driver.current_url:
            print("School infra map based report")
        else:
            print("school infra map report is not loaded ")
        self.logger.info("test_blockelevel_home_click is completed...")

    def test_school_count(self):
        self.tests.pop()
        self.logger.info("test_school_count" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = school_count(self.driver)
        res = b.test_count()
        self.assertNotEqual(0, int(res), msg="wrong schools count")
        print("checked with school count values")
        self.logger.info("test_school_count is completed...")

    def test_no_of_schools(self):
        self.tests.pop()
        self.logger.info("test_no_of_schools" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = Block_school_count(self.driver)
        r, r1, r2, r3 = b.test_counter()
        self.assertEqual(int(r),
                         int(r1),
                         msg="mis match found in no of school in block level")
        self.assertEqual(
            int(r),
            int(r2),
            msg="mis match found in no of school in cluster level")
        self.assertEqual(int(r),
                         int(r3),
                         msg="mis match found in no of school in school level")
        self.data.page_loading(self.driver)
        print("checked with comapared with footer values ")
        self.logger.info("test_no_of_schools is completed...")

    def test_click_on_block(self):
        self.tests.pop()
        self.logger.info("test_click_on_block" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_on_blocks(self.driver)
        res = b.test_blocks_button()
        self.assertNotEqual(0, res, msg="Records are not present on map ")
        print("Block buttons is working...")
        self.logger.info("test_click_on_block is completed...")

    def test_blocklevel_file(self):
        self.tests.pop()
        self.logger.info("test_blocklevel_file" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = Blockwise_csv_download(self.driver)
        result = b.test_download_blockwise()
        self.assertNotEqual(0, result, msg="Records are not present on map ")
        print("blocklevel file is downloaded")
        self.logger.info("test_blocklevel_file is completed...")

    def test_clusterlevel_map(self):
        self.tests.pop()
        self.logger.info("test_clusterlevel_map" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = cluster_level_map_check(self.driver)
        result = b.test_blockwise_data()
        self.assertNotEqual(0, result, msg="markers are not present on map ")
        print("clusterlevel map is loaded")
        self.logger.info("test_clusterlevel_map is completed...")

    def test_cluster_and_homebtn(self):
        self.tests.pop()
        self.logger.info("test_cluster_and_homebtn" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_cluster_and_home(self.driver)
        res = b.test_cluster()
        self.assertNotEqual(0,
                            res,
                            msg="cluster level markers not present on map ")
        print("cluster level home icon is working ")
        self.logger.info("test_cluster_and_homebtn is completed...")

    def test_clusterwise_download(self):
        self.tests.pop()
        self.logger.info("test_clusterwise_download" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = clusterwise_download(self.driver)
        result = b.test_download()
        self.assertNotEqual(0, result, msg="Records are not present on map ")
        print("cluster wise csv is downloading working")
        self.logger.info("test_clusterwise_download is completed...")

    def test_clusterbtn(self):
        self.tests.pop()
        self.logger.info("test_clusterbtn" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = cluster_button(self.driver)
        self.assertNotEqual(0, b, msg="Records are not present on map ")
        print("cluster button is working ")
        self.logger.info("test_clusterbtn is completed...")

    def test_dashboard(self):
        self.tests.pop()
        self.logger.info("test_dashboard" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_dashboard(self.driver)
        res = b.test_dashboard()
        self.assertEqual("cQube - Dashboard",
                         res,
                         msg="Dashboard is not exists!")
        print("checked with dashboard ")
        self.logger.info("test_dashboard is completed...")
        self.data.page_loading(self.driver)

    def test_click_home_in_districtwise(self):
        self.tests.pop()
        self.logger.info("test_click_home_in_districtwise" + " " + "Total :" +
                         " " + str(self.total_tests) + " " + "Remaining :" +
                         " " + str(len(self.tests) - 1))
        b = district_home(self.driver)
        res = b.test_district()
        if "school-infra-map" in self.driver.current_url:
            print("school infra map based report present")
        else:
            print("home icon is not working ")
        self.logger.info("test_click_home_in_districtwise is completed...")

    def test_district_options(self):
        self.tests.pop()
        self.logger.info("test_district_options" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = District_options(self.driver)
        res = b.test_options()
        self.assertNotEqual(0, res, msg="district list are present")
        print("checked with districtwise select box")
        self.logger.info("test_district_options is completed...")

    def test_hyperlink(self):
        self.tests.pop()
        self.logger.info("test_hyperlink" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_on_hyperlink(self.driver)
        res = b.test_link()
        if "school-infra-map" in self.driver.current_url:
            print("school infra map based report present")
        else:
            print("home icon is not working ")
        self.logger.info("test_hyperlink is completed...")

    def test_infrascores(self):
        self.tests.pop()
        self.logger.info("test_infrascores" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_on_infrascores(self.driver)
        res = b.test_infrascores()
        self.assertNotEqual(
            0, res, msg="infra score options not contains in drop down")
        print("checked with infrascores options")
        self.logger.info("test_infrascores is completed...")

    def test_report(self):
        self.tests.pop()
        self.logger.info("test_report" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_report(self.driver)
        self.data.page_loading(self.driver)
        res = b.test_infra()
        if "school-infrastructure" in self.driver.current_url:
            print("Shool infrastructure report page")
        else:
            print("School infrastructure report page is not exist")
        self.data.page_loading(self.driver)
        self.logger.info("test_report is completed...")

    def test_reportmap(self):
        self.tests.pop()
        self.logger.info("test_reportmap" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_on_reportmap(self.driver)
        self.data.page_loading(self.driver)
        res = b.test_reportmap()
        self.assertEqual("cQube - Dashboard",
                         res,
                         msg="Dashboard is not exists!")
        self.data.page_loading(self.driver)
        print("report map is present on dashboard")
        self.logger.info("test_reportmap is completed...")

    def test_schoolwise_download(self):
        self.tests.pop()
        self.logger.info("test_schoolwise_download" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = school_wise_download(self.driver)
        res = b.test_schoolwise()
        time.sleep(3)
        self.assertNotEqual(0, res, msg="Records are not present on map ")
        print("school wise csv is downloaded")
        self.logger.info("test_schoolwise_download is completed...")

    def test_click_on_school(self):
        self.tests.pop()
        self.logger.info("test_click_on_school" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_schoolinfra(self.driver)
        res = b.test_schoolinfra()
        if "school-infrastructure" in self.driver.current_url:
            print("School-infrastructure page")
        else:
            print("Not school-infrastructure page")
        self.logger.info("test_click_on_school is completed...")

    def test_click_schoolwise(self):
        self.tests.pop()
        self.logger.info("test_click_schoolwise" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = click_schoolwise(self.driver)
        self.assertNotEqual(0, b, msg="Records are not present on map ")
        print("school button is working ")
        self.logger.info("test_click_schoolwise is completed...")

    def test_dashboard_option(self):
        self.tests.pop()
        self.logger.info("test_dashboard_option" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = School_infra_test(self.driver)
        res = b.test_dashboard_option()
        if "school-infra-map" in self.driver.current_url:
            print("School infra map based report page exist")
        else:
            print("School infra map based report page not exist")
        self.data.page_loading(self.driver)
        self.logger.info("test_dashboard_option is completed...")

    def test_infrascore_click(self):
        self.tests.pop()
        self.logger.info("test_infrascore_click" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = select_infrascore_options(self.driver)
        res = b.test_infrascores()
        self.assertNotEqual(
            0, res, msg="infra score options not contains in drop down")
        print("infra scores options are working ")
        self.logger.info("test_infrascore_click is completed...")

    def test_clusterwise_csv(self):
        self.tests.pop()
        self.logger.info("test_clusterwise_csv" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = cluster_level_csv(self.driver)
        res = b.test_clusterwise()
        print("Clustwise csv file is downloaded...")
        self.logger.info("test_clusterwise_csv is completed...")

    def test_districtwise_csv(self):
        self.tests.pop()
        self.logger.info("test_districtwise_csv" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = districtwise_csv(self.driver)
        res = b.test_districtwise()
        print("Districtwise csv file is downloaded...")
        self.logger.info("test_districtwise_csv is completed...")

    def test_mouseover_on_dots(self):
        self.tests.pop()
        self.logger.info("test_mouseover_on_dots" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = mouseover(self.driver)
        res = b.test_mousehover()
        count = self.data.test_mouse_over()
        self.assertNotEqual(0, count, msg="markers not present in map ")
        print("markers present on map ")
        self.logger.info("test_mouseover_on_dots is completed...")

    def test_blockwise(self):
        self.tests.pop()
        self.logger.info("test_blockwise" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = select_blockwise(self.driver)
        res = b.test_dist_blocks()
        print("checked blockwise data ")
        self.logger.info("test_blockwise is completed...")

    def test_block_scores(self):
        self.tests.pop()
        self.logger.info("test_block_scores" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = block_btn_scores(self.driver)
        result = b.test_click_blocks()
        self.data.page_loading(self.driver)
        print("block button is worked and infra scores is working ")
        self.logger.info("test_block_scores is completed...")

    def test_clusters_scores(self):
        self.tests.pop()
        self.logger.info("test_clusters_scores" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = cluster_btn_scores(self.driver)
        result = b.test_click_clusters()
        self.data.page_loading(self.driver)
        print("cluster button is worked and infra scores is working ")
        self.logger.info("test_clusters_scores is completed...")

    def test_schools_scores(self):
        self.tests.pop()
        self.logger.info("test_schools_scores" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = schools_btn_scores(self.driver)
        res = b.test_click_schools()
        self.data.page_loading(self.driver)
        print("school button is worked and infra scores is working ")
        self.logger.info("test_schools_scores is completed...")

    def test_districtwise_school(self):
        self.tests.pop()
        self.logger.info("test_districtwise_school" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = districtlevel_school(self.driver)
        result = b.test_districtwise_schoolscount()
        self.assertNotEqual(0, result, msg="markers are not present on map ")
        self.data.page_loading(self.driver)
        print("District wise records validated")
        self.logger.info("test_districtwise_school is completed...")

    def test_sc_map_districtwise(self):
        self.tests.pop()
        self.logger.info("test_sc_map_districtwise" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))
        b = sc_map_districtwise(self.driver)
        result = b.test_schools()
        print("district wise map records checked")
        self.logger.info("test_sc_map_districtwise is completed...")

    # def test_sc_map_blockwise(self):
    #     self.tests.pop()
    #     self.logger.info("test_sc_map_blockwise" + " " + "Total :" + " " + str(
    #         self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
    #     b = school_map_blockwise(self.driver)
    #     result = b.test_schools()
    #     self.assertEqual(0,result,msg="No data found")
    #     print("blockwise wise map records checked")
    #     self.logger.info("test_sc_map_blockwise is completed...")
    #

    # def test_schools_per_cluster_csv_download1(self):
    #     self.driver = self.data.get_driver_SIMAP_Download1()
    #     self.data.open_cqube_appln(self.driver)
    #     self.data.login_cqube(self.driver)
    #     self.data.navigate_to_school_infrastructure_map()
    #     self.tests.pop()
    #     self.logger.info("test_schools_per_cluster_csv_download1 is running" + " " + "Total :" + " " + str(
    #         self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
    #     school = test_school_map_schoollevel_records(self.driver)
    #     result = school.check_download_csv1()
    #     if result == 0:
    #         print("Schools per cluster csv download report is working")
    #         print("on selection of each district,block and cluster")
    #         print("The footer value of no of schools and no of students are")
    #         print("equals to downloaded file")
    #     else:
    #         raise self.failureException("Schools per cluster csv report download1 is working")
    #
    #     self.logger.info("test_schools_per_cluster_csv_download1 is completed...")
    #
    # def test_schools_per_cluster_csv_download2(self):
    #     self.driver = self.data.get_driver_SIMAP_Download2()
    #     self.data.open_cqube_appln(self.driver)
    #     self.data.login_cqube(self.driver)
    #     self.data.navigate_to_school_infrastructure_map()
    #     self.tests.pop()
    #     self.logger.info("test_schools_per_cluster_csv_download2 is running" + " " + "Total :" + " " + str(
    #         self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
    #     school = test_school_map_schoollevel_records(self.driver)
    #     result = school.check_download_csv2()
    #     if result == 0:
    #         print("Schools per cluster csv download report is working")
    #         print("on selection of each district,block and cluster")
    #         print("The footer value of no of schools and no of students are")
    #         print("equals to downloaded file")
    #     else:
    #         raise self.failureException("Schools per cluster csv report download2 is working")
    #
    #     self.logger.info("test_schools_per_cluster_csv_download2 is completed...")
    #
    # def test_schools_per_cluster_csv_download3(self):
    #     self.driver = self.data.get_driver_SIMAP_Download3()
    #     self.data.open_cqube_appln(self.driver)
    #     self.data.login_cqube(self.driver)
    #     self.data.navigate_to_school_infrastructure_map()
    #     self.tests.pop()
    #     self.logger.info("test_schools_per_cluster_csv_download3 is running" + " " + "Total :" + " " + str(
    #         self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
    #     school = test_school_map_schoollevel_records(self.driver)
    #     result = school.check_download_csv3()
    #     if result == 0:
    #         print("Schools per cluster csv download report is working")
    #         print("on selection of each district,block and cluster")
    #         print("The footer value of no of schools and no of students are")
    #         print("equals to downloaded file")
    #     else:
    #         raise self.failureException("Schools per cluster csv report download3 is working")
    #
    #     self.logger.info("test_schools_per_cluster_csv_download3 is completed...")
    #
    # def test_schools_per_cluster_csv_download4(self):
    #     self.driver = self.data.get_driver_SIMAP_Download4()
    #     self.data.open_cqube_appln(self.driver)
    #     self.data.login_cqube(self.driver)
    #     self.data.navigate_to_school_infrastructure_map()
    #     self.tests.pop()
    #     self.logger.info("test_schools_per_cluster_csv_download4 is running" + " " + "Total :" + " " + str(
    #         self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
    #     school = test_school_map_schoollevel_records(self.driver)
    #     result = school.check_download_csv4()
    #     if result == 0:
    #         print("Schools per cluster csv download report is working")
    #         print("on selection of each district,block and cluster")
    #         print("The footer value of no of schools and no of students are")
    #         print("equals to downloaded file")
    #     else:
    #         raise self.failureException("Schools per cluster csv report download4 is working")
    #
    #     self.logger.info("test_schools_per_cluster_csv_download4 is completed...")
    #
    #

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
class Creating_users(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.p = pwd()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(30)
        self.data.open_cqube_appln(self.driver)
        self.data.page_loading(self.driver)

    def test_login_with_admin(self):
        count = 0
        self.data.page_loading(self.driver)
        self.driver.find_element_by_id('username').send_keys("qa1")
        self.driver.find_element_by_id('password').send_keys("Qateam@123")
        self.driver.find_element_by_id(Data.login).click()
        self.data.page_loading(self.driver)
        self.driver.find_element_by_tag_name('button').click()
        self.data.page_loading(self.driver)
        if "home" in self.driver.current_url:
            print("Logined to cqube with admin user")
        else:
            print("login failed with admin user")
        self.driver.find_element_by_id('menu').click()
        self.driver.find_element_by_xpath(
            "/html/body/app-root/app-home/mat-sidenav-container/mat-sidenav/div/mat-nav-list/div/mat-nav-list[2]/mat-list-item/div/mat-icon"
        ).click()
        time.sleep(2)
        self.driver.find_element_by_id('chPass').click()
        time.sleep(2)
        if "Change Password" in self.driver.page_source:
            print("Change password option is present ")
            count = count + 1
        else:
            print("Change password options  not present ")
        self.assertEqual(0,
                         count,
                         msg="Admin user also  have change password option!")
        self.driver.find_element_by_id(Data.logout).click()
        self.data.page_loading(self.driver)

    def test_login_with_reportviewer(self):
        self.data.page_loading(self.driver)
        count = 0
        self.driver.find_element_by_id('username').send_keys("qa2")
        self.driver.find_element_by_id('password').send_keys("Qateam@123")
        self.driver.find_element_by_id(Data.login).click()
        self.data.page_loading(self.driver)
        self.driver.find_element_by_tag_name('button').click()
        self.data.page_loading(self.driver)
        if "home" in self.driver.current_url:
            print("Logined to cqube with report viewer user")
        else:
            print("login failed with report viewer user")
        self.driver.find_element_by_id('menu').click()
        if " User " in self.driver.page_source:
            print("User option is present ")
        else:
            print("User options is not present")
            count = count + 1
        self.assertEqual(
            0, count, msg="Admin user also not have change password option!")
        self.driver.find_element_by_id(Data.logout).click()
        self.data.page_loading(self.driver)

    def test_login_with_emission(self):
        print("emission user does not have access to cqube application")
        self.driver.find_element_by_id('username').send_keys("qa3")
        self.driver.find_element_by_id('password').send_keys("Qateam@123")
        # self.driver.find_element_by_id(Data.login).click()
        # self.data.page_loading(self.driver)
        # if "home" in self.driver.current_url:
        #     print("Logined to cqube with admin user")
        # else:
        #     print("login failed with admin user")

    #     # self.data.page_loading(self.driver)
    #     alert_obj = self.driver.switch_to.alert
    #     alert_obj.accept()
    #     self.data.page_loading(self.driver)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#12
0
 def courserecords_of_last7days(self):
     self.data = GetData()
     self.p = pwd()
     self.msg = file_extention()
     count = 0
     self.driver.find_element_by_xpath(Data.hyper_link).click()
     self.data.page_loading(self.driver)
     timeperiod = Select(self.driver.find_element_by_name('timePeriod'))
     timeperiod.select_by_visible_text(' Last 7 Days ')
     self.data.page_loading(self.driver)
     if self.msg.no_data_available() in self.driver.page_source:
         print("Last 7 days dont have records")
     else:
         self.data.page_loading(self.driver)
         collnames = Select(
             self.driver.find_element_by_name('collectionName'))
         for i in range(1, len(collnames.options)):
             time.sleep(1)
             collnames.select_by_index(i)
             name = "collectionType_course_data_of" + collnames.options[
                 i].text
             fname = name.replace(' ', '_')
             time.sleep(2)
             self.driver.find_element_by_id(Data.Download).click()
             time.sleep(3)
             cname = fname.rstrip('_')
             self.filename = self.p.get_download_dir(
             ) + '/' + cname + '.csv'
             file = os.path.isfile(self.filename)
             if file == True:
                 with open(self.filename) as fin:
                     csv_reader = csv.reader(fin, delimiter=',')
                     header = next(csv_reader)
                     content = 0
                     for row in csv.reader(fin):
                         content += int(row[4])
                     usage = self.driver.find_element_by_id(
                         "totalCount").text
                     tsc = re.sub('\D', "", usage)
                     if int(tsc) != content:
                         print(collnames.options[i].text, ":", int(content),
                               int(tsc), "usage content  mismatch found")
                         count = count + 1
                 os.remove(self.filename)
             else:
                 alname = fname[:-1] + '.csv'
                 self.filename = self.p.get_download_dir() + '/' + alname
                 with open(self.filename) as fin:
                     csv_reader = csv.reader(fin, delimiter=',')
                     header = next(csv_reader)
                     content = 0
                     for row in csv.reader(fin):
                         content += int(row[4])
                     usage = self.driver.find_element_by_id(
                         "totalCount").text
                     tsc = re.sub('\D', "", usage)
                     if int(tsc) != content:
                         print(collnames.options[i].text, ":", int(content),
                               int(tsc), "usage content  mismatch found")
                         count = count + 1
                 os.remove(self.filename)
     return count
示例#13
0
class Test_semester_summary(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.p = pwd()
        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.page_loading(self.driver)
        self.data.login_to_adminconsole(self.driver)
        self.driver.find_element_by_xpath(Data.summary_icon).click()
        self.data.page_loading(self.driver)

    def test_semester_file_summary(self):
        self.records = summary_records()
        self.data.page_loading(self.driver)
        x = []
        rows = self.driver.find_elements_by_xpath(
            "//*[@id='table2']/tbody/tr[2]/td")
        for i in range(len(rows)):
            x.append(rows[i].text)
        count = 0
        self.data.page_loading(self.driver)
        y = []
        y.append(self.records.get_semester_file_name())
        y.append(self.records.get_sem_total_records())
        y.append(self.records.get_sem_blank_records())
        y.append(self.records.get_sem_duplicate_records())
        y.append(self.records.get_sem_dtypemismatch_records())
        y.append(self.records.get_sem_student_id_records())
        y.append(self.records.get_sem_school_id_records())
        y.append(self.records.get_sem_semester_records())
        y.append(self.records.get_sem_grade_records())
        y.append(self.records.get_sem_processed_records())
        z = x[:-2]
        print('Screen showing', z)
        print('In config file', y)
        if z == y:
            print('Semester attendance summary is fine')
        else:
            print("Some values are mismatching on table ")
            count = count + 1
        self.assertEqual(0, count, msg="Records mismatch found ")
        self.data.page_loading(self.driver)
class cQube_Semester_Report(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.navigate_to_semester_report()
        time.sleep(5)

    def test_sem_options(self):
        b = Semester_options(self.driver)
        res1, res2 = b.test_semester_option()
        self.assertEqual(0, res1, msg="Semester 1 is selected ")
        print('Semester 2 is working ')
        self.assertNotEqual(0,
                            res2,
                            msg="Markers are missing on semeter2 map ")
        self.data.page_loading(self.driver)

    def test_districtwise_csv_download(self):
        csv = DistrictwiseCsv(self.driver)
        result = csv.click_download_icon_of_district()
        if result == "File Not Downloaded":
            raise self.failureException(result)

    def test_blockwise_csv_download(self):
        csv = BlockwiseCsv(self.driver)
        result = csv.click_download_icon_of_blocks()
        if result == "File Not Downloaded":
            raise self.failureException(result)

    def test_clusterwise_csv_download(self):
        csv = ClusterwiseCsv(self.driver)
        result = csv.click_download_icon_of_clusters()
        if result == "File Not Downloaded":
            raise self.failureException(result)

    def test_schoolwise_cv_download(self):
        csv = SchoolwiseCsv(self.driver)
        result = csv.click_download_icon_of_schools()
        if result == "File Not Downloaded":
            raise self.failureException(result)

    def test_choose_district_block_cluster(self):
        dist = District(self.driver)
        result = dist.check_district()
        if result == 0:
            print("Block per district csv report download is working")
            print("on selection of each district")
            print("The footer value of no of schools and no of students are")
            print("equals to downloaded file")
        else:
            raise self.failureException(
                "Block per district csv report download is not working")
        block = DistrictsBlock(self.driver)
        result = block.check_districts_block()
        if result == 0:
            print("Cluster per block csv report download is working")
            print("on selection of each district and block")
            print("The footer value of no of schools and no of students are")
            print("equals to downloaded file")
        else:
            raise self.failureException(
                "Cluster per block csv report download not is working")
        schools = DistrictBlockCluster(self.driver)
        result = schools.check_district_block_cluster()
        if result == 0:
            print("Schools per cluster csv download report is working")
            print("on selection of each district,block and cluster")
            print("The footer value of no of schools and no of students are")
            print("equals to downloaded file")
        else:
            raise self.failureException(
                "Schools per cluster csv report download not is working")

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#15
0
class cQube_CRC_Report(unittest.TestCase):

    @classmethod
    def setUpClass(self):
            self.total_tests =25
            self.tests = [0] * 26
            self.data = GetData()
            self.logger = self.data.get_sanity_log()
            self.driver = self.data.get_driver()
            self.data.open_cqube_appln(self.driver)
            self.data.login_cqube(self.driver)
            self.data.navigate_to_crc_report()
            self.data.page_loading(self.driver)

    def test_blockwise_data(self):
        self.tests.pop()
        self.logger.info("test_blockwise_data" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = blockwise(self.driver)
        result = b.test_blocklevel()
        self.assertEqual(0,result,msg="some district files are not downloaded")
        print("blockwise csv files are downloaded")
        self.logger.info("test_blockwise_data is completed...")


    def test_table_data(self):
        self.tests.pop()
        self.logger.info("test_table_data" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b= schoolwise_tabledata(self.driver)
        result = b.test_table_data()
        self.assertNotEqual(0,result,"Data not found on table")
        print("Table contains records...")
        self.logger.info("test_table_data is completed...")


    def test_districtwise_tabledata(self):
        self.tests.pop()
        self.logger.info("test_districtwise_tabledata" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = districtwise_tabledata(self.driver)
        result = b.test_table_data()
        if result != 0:
            raise self.failureException('Data not found on table')
        print("Check with Districtwise table records")
        self.logger.info("test_districtwise_tabledata is completed...")

    def test_homeicon(self):
        self.tests.pop()
        self.logger.info("test_homeicon" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b=Homebutton(self.driver)
        result = b.test_homeicon()
        self.assertTrue(result,msg="Home button not working ")
        print("checking functionality of home button ")
        self.logger.info("test_homeicon is completed...")

    def test_peformance_blockwise(self):
        self.tests.pop()
        self.logger.info("test_peformance_blockwise" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = download_blockwise_csv(self.driver)
        result = b.test_blockwise()
        self.assertTrue(result, msg = "Blockwise csv is not downloaded")
        print("Block wise csv file is downloaded within 10 seconds")
        b.remove_file()
        self.logger.info("test_peformance_blockwise is completed...")

    def test_peformance_clusterwise(self):
        self.tests.pop()
        self.logger.info("test_peformance_clusterwise" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = download_clusterwise_csv(self.driver)
        result = b.test_clusterwise()
        self.assertTrue(result, msg = "File is not downloaded")
        print("cluster wise csv file is downloaded within 10 seconds")
        b.remove_file()
        self.logger.info("test_peformance_clusterwise is completed...")


    def test_peformance_districtwise(self):
        self.tests.pop()
        self.logger.info("test_peformance_districtwise" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = download_districtwise_csv(self.driver)
        result = b.test_districtwise_csv()
        self.assertTrue(result, msg = "Districtwise csv is not downloaded")
        print("district wise csv file is downloaded within 10 seconds")
        b.remove_file()
        self.logger.info("test_peformance_districtwise is completed...")




    def test_peformance_of_crc_report(self):
        self.tests.pop()
        self.logger.info("test_peformance_of_crc_report" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = CRC_report(self.driver)
        result = b.test_crc_report()
        if "crc-report" in self.driver.current_url:
            print("CRC report page is exists")
        else:
            print("CRC report page is not loaded ")
        self.logger.info("test_peformance_of_crc_report is completed...")

    def test_orderwise_tabledata(self):
        self.tests.pop()
        self.logger.info("test_orderwise_tabledata" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        print("checking order of table records")
        b = Check_order_of_tabledata(self.driver)
        result = b.test_order()
        self.assertEqual(result,"menu",msg="Menu is not exist")
        self.logger.info("test_orderwise_tabledata is completed...")


    def test_crc_graph(self):
        self.tests.pop()
        self.logger.info("test_crc_graph" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = plot_values(self.driver)
        result = b.test_plots()
        self.assertNotEqual(0,result,msg="Axis options are not contains in select box")
        self.data.page_loading(self.driver)
        print("checking with graph values ")
        self.logger.info("test_crc_graph is completed...")

    def test_clusterlevel_homeicon(self):
        self.tests.pop()
        self.logger.info("test_clusterlevel_homeicon" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = click_on_home(self.driver)
        result = b.test_homeicon()
        if "crc-report" in self.driver.current_url:
            print("crc home page is loaded")
        else:
            print("crc home page is not loaded")
        self.logger.info("test_clusterlevel_homeicon is completed...")


    def test_on_clusterlevel_to_hyperlinks(self):
        self.tests.pop()
        self.logger.info("test_on_clusterlevel_to_hyperlinks" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = click_on_hyperlinks(self.driver)
        result = b.test_hyperlink()
        print("checking hyper link is working or not ")
        self.logger.info("test_on_clusterlevel_to_hyperlinks is completed...")


    def test_download_blockwise_csv(self):
        self.tests.pop()
        self.logger.info("test_download_blockwise_csv" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = donwload_blockwise_csv(self.driver)
        result = b.test_blockwise()
        self.assertTrue(result, msg="File is not downloaded")
        b.remove_file()
        print("Districtwise csv files are downloaded")
        self.logger.info("test_download_blockwise_csv is completed...")

    def test_donwoad_clusterwise_csv(self):
        self.tests.pop()
        self.logger.info("test_donwoad_clusterwise_csv" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = load_clusterwise_csv(self.driver)
        result = b.test_clusterwise()
        self.assertTrue(result, msg = "File is not downloaded")
        b.remove_file()
        print("cluster level csv files are downloaded..")
        self.logger.info("test_donwoad_clusterwise_csv is completed...")

    def test_visited(self):
        self.tests.pop()
        self.logger.info("test_visited" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b =visited(self.driver)
        result1,result2 = b.test_schools()
        self.assertEqual(int(result1),result2, msg="total no of visited are mismatching in district level")
        b.remove_file()
        print("comparing visited footer values with downloaded csv files")
        self.logger.info("test_visited is completed...")

    def test_visits(self):
        self.tests.pop()
        self.logger.info("test_visits" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b =school_visits(self.driver)
        res1 ,res2  =b.test_visits()
        self.assertEqual(int(res1),res2, msg="total no of visits are mismatching in district level")
        b.remove_file()
        print("comparing visits footer values with downloaded csv files")
        self.logger.info("test_visits is completed...")

    def test_schoolcount(self):
        self.tests.pop()
        self.logger.info("test_schoolcount" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = school_count(self.driver)
        res1, res2 = b.test_schools()
        self.assertEqual(int(res1), res2, msg="total no of school are mismatching in district level")
        b.remove_csv()
        print("comparing school  footer values with downloaded csv files")
        self.logger.info("test_schoolcount is completed...")

    def test_download_districtwise(self):
        self.tests.pop()
        self.logger.info("test_download_districtwise" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = Districtwise_donwload(self.driver)
        result  = b.test_districtwise()
        self.assertTrue(result, msg="File is not downloaded")
        b.remove_csv()
        print("District csv file is downloaded..")
        self.logger.info("test_download_districtwise is completed...")

    def test_logout(self):
        self.tests.pop()
        self.logger.info("test_logout" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = Logout_function(self.driver)
        res = b.test_logout()
        if "crc-report" in self.driver.current_url:
            print("Navigated back to crc report")
        else:
            print("CRC report is not loaded ")
        time.sleep(2)
        self.logger.info("test_logout is completed...")


    def test_navigate_crc(self):
        self.tests.pop()
        self.logger.info("test_navigate_crc" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b =loading_crc(self.driver)
        res = b.test_crc()
        if "crc-report" in self.driver.current_url:
            print("Navigated back to crc report")
        else:
            print("CRC report is not loaded ")
        time.sleep(2)
        self.logger.info("test_navigate_crc is completed...")

    def test_dash_menu(self):
        self.tests.pop()
        self.logger.info("test_dash_menu" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b =Dashboard_menu(self.driver)
        res = b.test_dashboard()
        self.assertEqual(res,"menu",msg="Dashboard button is not working")
        print("checking dashboard is working or not..")
        self.logger.info("test_dash_menu is completed...")

    def test_blockwise_graph(self):
        self.tests.pop()
        self.logger.info("test_blockwise_graph" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = Blockwise_graph(self.driver)
        res = b.test_blockwise_graph()
        if "myChart" in self.driver.page_source:
            print("CRC Scattor plot is working fine")
        else:
            print("CRC plot is not exist..")
        self.data.page_loading(self.driver)
        self.logger.info("test_blockwise_graph is completed...")

    def test_clusterwise_graph(self):
        self.tests.pop()
        self.logger.info("test_clusterwise_graph" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = cluster_graph(self.driver)
        res = b.test_clusterwise_graph()
        if "myChart" in self.driver.page_source:
            print("CRC Scattor plot is working fine")
        else:
            print("CRC plot is not exist..")
        self.data.page_loading(self.driver)
        self.logger.info("test_clusterwise_graph is completed...")

    def test_districtwise_schoolsvisited(self):
        self.tests.pop()
        self.logger.info("test_districtwise_schoolsvisited" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = districtwise_visits(self.driver)
        result = b.test_districtwise_schoolvisited()
        self.data.page_loading(self.driver)
        print("checking districtwise school visited footer with downloaded csv files")
        self.logger.info("test_districtwise_schoolsvisited is completed...")

    def test_crc_blockwise(self):
        self.tests.pop()
        self.logger.info("test_crc_blockwise" + " " + "Total :" + " " + str(
            self.total_tests) + " " + "Remaining :" + " " + str(len(self.tests) - 1))
        b = crc_blockwise_records(self.driver)
        result = b.test_blockwise()
        print("checked with blockwise records")
        self.assertNotEqual(0, result, msg="Table data is not loaded ")
        print("checking blockwise school visited footer with downloaded csv files")
        self.logger.info("test_crc_blockwise is completed...")
    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#16
0
class cQube_pat_exception_functional_report(unittest.TestCase):

    @classmethod
    def setUpClass(self):
            self.data = GetData()
            self.driver = self.data.get_driver()
            self.data.open_cqube_appln(self.driver)
            self.data.login_cqube(self.driver)
            self.data.navigate_to_semester_exception()
            self.data.page_loading(self.driver)

    def test_ClusterPerBlockCsvDownload(self):
        b = pat_exception_report(self.driver)
        res = b.ClusterPerBlockCsvDownload()
        self.assertEqual(0,res , msg='Some cluster level files are not downloaded')

    def test_DistrictwiseDownload(self):
        b = pat_exception_report(self.driver)
        res = b.check_districts_csv_download()
        self.assertEqual(0,res,msg="Some district level csv file is not downloaded")

    def test_DotsOnDistrictwise_map(self):
        b = pat_exception_report(self.driver)
        res = b.check_dots_on_each_districts()
        self.assertEqual(0,res,msg='Markers are not present on districtwise map ')

    def test_Data_not_recieved(self):
        b = pat_exception_report(self.driver)
        res,r1,r2,r3 = b.test_total_not_recieved_data()
        self.assertEqual(res,r1,msg='Block level data not recieved count mismatch found')
        self.assertEqual(res,r2,msg='cluster level data not recieved count mismatch found')
        self.assertEqual(res,r3,msg='School level data not recieved count mismatch found')

    def test_Semester_Blocks(self):
        b = pat_exception_report(self.driver)
        res = b.check_markers_on_block_map()
        self.assertNotEqual(0,res,msg="markers are not present on block level map")

    def test_semester_clusters(self):
        b = pat_exception_report(self.driver)
        res = b.check_markers_on_clusters_map()
        self.assertNotEqual(0,res,msg="markers are not present on cluster level map")

    def test_semesterschool(self):
        b = pat_exception_report(self.driver)
        res = b.check_markers_on_school_map()
        self.assertNotEqual(0,res,msg="markers are not present on cluster level map")

    def test_sem_dashboard(self):
        b = pat_exception_report(self.driver)
        res = b.test_click_on_dashboard()
        self.assertEqual(0,res,msg='Dashboard button is not working ')

    def test_sem_exception_hyperlink(self):
        b = pat_exception_report(self.driver)
        result1, result2, choose_dist = b.click_on_hyperlinks()
        if result1 == False and result2 == False and choose_dist == "Choose a District":
            print("hyperlinks are working")
        else:
            raise self.failureException("hyperlinks are not working")

    def test_semester_exception_icon(self):
        b = pat_exception_report(self.driver)
        res = b.test_icon()
        self.assertEqual(0,res,msg='Semester exception report is not displayed')

    def test_sem_exception_Logout(self):
        b = pat_exception_report(self.driver)
        res = b.click_on_logout()
        self.assertEqual(res,'Log in to cQube',msg="logout button is not working")
        self.data.login_cqube(self.driver)
        self.data.navigate_to_semester_exception()
        self.data.page_loading(self.driver)


    def test_homepage(self):
        self.driver.find_element_by_id(Data.Dashboard).click()
        time.sleep(2)
        count =0
        self.driver.find_element_by_id('').click()
        self.data.page_loading(self.driver)
        if 'pat-exception' in self.driver.current_url:
            print("Home page of pat exception is present ")
        else:
            print('home page does not exist')
            count= count + 1
        self.assertEqual(0,count,msg='Home page not exists')



    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#17
0
class cQube_SI_Report(unittest.TestCase):

    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.navigate_to_school_infrastructure()
        self.data.page_loading(self.driver)

    def test_dashboard(self):
        b = check_dashboard(self.driver)
        res = b.test_menulist()
        print("check with dashboard options is working fine ")
        self.data.page_loading(self.driver)

    def test_graph(self):
        b = check_with_graph(self.driver)
        res = b.test_graph()
        print("Graph is present in School report")
        self.data.page_loading(self.driver)

    def test_donwload_blockwise(self):
        b = donwload_blockwise_csv(self.driver)
        res = b.test_block()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_csv()
        print("blockwise csv file downloaded")
        self.data.page_loading(self.driver)

    def test_download_districtwise(self):
        b = download_district_wise_csv(self.driver)
        res = b.test_districtwise()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_file()
        print("districtwise csv file is downloaded")
        self.data.page_loading(self.driver)


    def test_download_clusterwise(self):
        b=donwload_clusterwise_csv(self.driver)
        res = b.test_clusterwise()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_csv()
        print("clusterwise csv file is downloaded")
        self.data.page_loading(self.driver)

    def test_download_schoolwise(self):
        b = school_wise_donwload(self.driver)
        res = b.test_schoolwise()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_csv()
        print("schoolwise csv file is downloaded")
        self.data.page_loading(self.driver)

    def test_check_hyperlinks(self):
        hyperlinks = Hyperlink(self.driver)
        result1, result2, choose_dist = hyperlinks.click_on_hyperlinks()
        if result1 == False and result2 == False and choose_dist == "Choose a District ":
            print("hyperlinks are working")
        else:
            raise self.failureException("hyperlinks are not working")
        self.data.page_loading(self.driver)


    def test_home(self):
        b = home(self.driver)
        res = b.test_homeicon()
        print("homeicon is working..")
        self.data.page_loading(self.driver)


    def test_homebutton(self):
        b = home(self.driver)
        res = b.test_homebtn()
        print("homeicon is working..")
        self.assertEqual(res,0,msg='Home button is not working ')
        self.data.page_loading(self.driver)

    def test_check_orderwise(self):
        b = check_order_of_tabledata(self.driver)
        print("Table record order wise..")
        res = b.test_tablevalue()
        print("checked with orderwise of table data")
        self.data.page_loading(self.driver)

    def test_schools_per_cluster_csv_download1(self):
        school = Test_schoolwise(self.driver)
        result = school.check_csv_download1()
        if result == 0:
            print("Schools per cluster csv download report is working")
            print("on selection of each district,block and cluster")
            print("The footer value of no of schools and no of students are")
            print("equals to downloaded file")
        else:
            raise self.failureException("Schools per cluster csv report download1 is working")

    def test_tabledata_districtwise(self):
        b = districtwise_tabledata(self.driver)
        res = b.test_table_data()
        if res != 0:
            raise self.failureException('Data not found on table')
        print("Districtwise table data is present...")
        self.data.page_loading(self.driver)


    def test_logout(self):
        b = schoolinfra_logout(self.driver)
        res = b.test_logout()
        self.assertNotIn(" School Infrastructure report for: ", self.driver.page_source,
                         msg="School infrastructure report not exist ")
        self.assertEqual("Log in to cQube", self.driver.title, msg="logout is not working ")
        print("logout functionality is working...")
        self.data.login_cqube(self.driver)
        self.data.navigate_to_school_infrastructure()
        self.data.page_loading(self.driver)

    def test_plotxvalues(self):
        b = Graph_values(self.driver)
        res = b.test_xplots()
        print("Checked with xaxis values are working..")
        self.data.page_loading(self.driver)

    def test_plotyvalues(self):
        b = Graph_values(self.driver)
        res = b.test_yaxis()
        print("Checked with  y axis values are working..")
        self.data.page_loading(self.driver)


    def test_sc_scator_districtwise(self):
            b = test_districtwise(self.driver)
            result = b.test_districtwise()
            self.assertEqual(0,result,msg="No data found")
            print("Checked with each district wise records")
            self.data.page_loading(self.driver)


    def test_sc_scator_blockwise(self):
            b = school_blockwise(self.driver)
            result = b.test_blockwise()
            self.assertEqual(0,result,msg="No data found")
            print("Checked with each block wise records")
            self.data.page_loading(self.driver)


    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#18
0
 def test_options_times(self):
     data = GetData()
     data.page_loading(self.driver)
     times = Select(self.driver.find_element_by_id('period'))
     count = len(times.options)
     return count
示例#19
0
class cQube_SI_Report(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.navigate_to_school_infrastructure()
        self.data.page_loading(self.driver)

    def test_blockwise_from_selectbox(self):
        b = blocklevel_csv(self.driver)
        res = b.test_each_district()
        self.assertEqual(0, res, msg="some files are not downloaded")

    def test_clusterwise_from_selectbox(self):
        b = clusterlevel_csv(self.driver)
        res = b.test_search()
        self.assertEqual(0, res, msg="some blockwise are not downloaded")

    def test_graph(self):
        b = check_with_graph(self.driver)
        res = b.test_graph()
        self.assertIn("myChart", self.driver.page_source, msg="Does not exist")

    def test_home(self):
        b = home_button(self.driver)
        res = b.test_home()
        self.assertTrue(res, msg="Home button not working ")

    def test_shoolwise_csv(self):
        b = School_per_csv(self.driver)
        res = b.test_search()
        self.assertEqual(0, res, msg="Some schoolwise are not present ")

    def test_downloadreportwise(self):
        b = download_report(self.driver)
        path = b.test_schools()
        self.assertTrue(path, msg="File is not downloaded")
        b.remove_csv()

    def test_check_hyperlinks(self):
        hyperlinks = Hyperlink(self.driver)
        result1, result2, choose_dist = hyperlinks.click_on_hyperlinks()
        if result1 == False and result2 == False and choose_dist == "Choose a District ":
            print("hyperlinks are working")
        else:
            raise self.failureException("hyperlinks are not working")
        time.sleep(5)

    def test_tabledata(self):
        b = check_with_table(self.driver)
        res = b.test_graph_and_table_present_on_school_infra()
        try:
            tablehead = self.driver.find_element_by_tag_name("table")
            self.data.page_loading(self.driver)
            return tablehead.is_displayed()
        except exceptions.NoSuchElementException:
            print("Table is present ")
        self.assertTrue(res, msg="Table is not exist")
        self.data.page_loading(self.driver)

    # def test_tabledata_clusterwise(self):
    #     b = clusterwise_tabledata(self.driver)
    #     res = b.test_table_data()
    #     if res != 0:
    #         raise self.failureException('Data not found on table')

    def test_tabledata_blockwise(self):
        b = blockwise_tabledata(self.driver)
        res = b.test_table_data()
        if res != 0:
            raise self.failureException('Data not found on table')

    def test_tabledata_districtwise(self):
        b = districtwise_tabledata(self.driver)
        res = b.test_table_data()
        if res != 0:
            raise self.failureException('Data not found on table')

    def test_districtwise_csv(self):
        b = download_districtwise(self.driver)
        res = b.test_donwload()
        self.assertTrue(res, msg="districtwise file is not downloaded")
        b.remove_csv()
        self.data.page_loading(self.driver)

    def test_cluster_home(self):
        b = check_home(self.driver)
        self.data.page_loading(self.driver)
        res = b.test_home()
        if "school-infrastructure" in self.driver.current_url:
            print("School infra report page")
        else:
            print("school infra page not loaded")
        self.data.page_loading(self.driver)

    def test_donwload_options(self):
        b = Hyperlink(self.driver)
        res = b.click_on_hyperlinks()

    def test_school_report(self):
        b = check_schoolinfra_report(self.driver)
        res = b.test_report()
        self.assertEqual("menu", res, msg="Dashboard is not exists!")

    def test_check_orderwise(self):
        b = check_order_of_tabledata(self.driver)
        print("Table record order wise..")
        res = b.test_tablevalue()

    def test_plotvalue(self):
        b = Graph_values(self.driver)
        res = b.test_plots()

    def test_donwload_blockwise(self):
        b = donwload_blockwise_csv(self.driver)
        res = b.test_block()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_csv()
        self.data.page_loading(self.driver)

    # def test_donwload_clusterwise(self):
    #     b = donwload_clusterwise_csv(self.driver)
    #     res = b.test_clusterwise()
    #     self.assertTrue(res, msg="File is not downloaded")
    #     b.remove_csv()

    def test_schoolwise_donwload(self):
        b = school_wise_donwload(self.driver)
        res = b.test_schoolwise()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_csv()

    def test_download_districtwise(self):
        b = download_district_wise_csv(self.driver)
        res = b.test_districtwise()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_file()

    def test_schoolreport(self):
        b = si_report(self.driver)
        res = b.test_url()
        self.assertNotIn(" School infrastructure for: ",
                         self.driver.page_source,
                         msg="School infrastructure report not exist ")

    def test_dashboard(self):
        b = check_dashboard(self.driver)
        res = b.test_menulist()

    def test_logout(self):
        b = schoolinfra_logout(self.driver)
        res = b.test_logout()
        self.assertNotIn(" School Infrastructure report for: ",
                         self.driver.page_source,
                         msg="School infrastructure report not exist ")
        self.assertEqual("cQube",
                         self.driver.title,
                         msg="logout is not working ")
        self.data.login_cqube(self.driver)
        self.data.navigate_to_school_infrastructure()
        self.data.page_loading(self.driver)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
class Enrollment_time_periods():
    def __init__(self, driver):
        self.driver = driver

    def test_Enrollment_overall(self):
        self.data = GetData()
        self.p = pwd()
        self.msg = file_extention()
        count = 0
        self.driver.find_element_by_xpath(Data.hyper_link).click()
        self.data.page_loading(self.driver)
        course_type = Select(self.driver.find_element_by_id(Data.coursetype))
        course_type.select_by_visible_text(' Enrollment ')
        self.data.page_loading(self.driver)
        ctype = (self.driver.find_element_by_id(Data.coursetype).text).strip()
        timeseries = Select(self.driver.find_element_by_name(Data.timeperiods))
        timeseries.select_by_visible_text(' Overall ')
        self.data.page_loading(self.driver)
        times = (self.driver.find_element_by_name(
            Data.timeperiods).text).strip()
        if self.msg.no_data_available() in self.driver.page_source:
            print('No Data Available for overall')
        else:
            self.driver.find_element_by_id(Data.Download).click()
            time.sleep(3)
            self.filename = self.p.get_download_dir(
            ) + '/' + 'enrollment_completion_enrollment_all_district_overall_' + self.data.get_current_date(
            ) + '.csv'
            print(self.filename)
            self.data.page_loading(self.driver)
            collnames = Select(self.driver.find_element_by_id(Data.coll_names))
            counter = len(collnames.options) - 1
            for i in range(len(collnames.options), len(collnames.options) - 5):
                collnames.select_by_index(i)
                self.data.page_loading(self.driver)
            if os.path.isfile(self.filename) != True:
                print('Enrollment Over all csv file is not downloaded ')
                count = count + 1
            self.data.page_loading(self.driver)
            os.remove(self.filename)
            return counter, count

    def test_Enrollment_last_day(self):
        self.data = GetData()
        self.p = pwd()
        count = 0
        self.msg = file_extention()
        self.driver.find_element_by_xpath(Data.hyper_link).click()
        self.data.page_loading(self.driver)
        course_type = Select(self.driver.find_element_by_id(Data.coursetype))
        course_type.select_by_visible_text(' Enrollment ')
        self.data.page_loading(self.driver)
        timeseries = Select(self.driver.find_element_by_name(Data.timeperiods))
        timeseries.select_by_visible_text(' Last Day ')
        self.data.page_loading(self.driver)
        if self.msg.no_data_available() in self.driver.page_source:
            print('No Data Available for last day')
        else:
            self.driver.find_element_by_id(Data.Download).click()
            time.sleep(3)
            times = (self.driver.find_element_by_name(
                Data.timeperiods).text).strip()
            ctype = (self.driver.find_element_by_id(
                Data.coursetype).text).strip()
            self.filename = self.p.get_download_dir(
            ) + '/' + 'tpd_enrollment_all_district_last_day_' + self.data.get_current_date(
            ) + '.csv'
            self.data.page_loading(self.driver)
            collnames = Select(self.driver.find_element_by_id(Data.coll_names))
            counter = len(collnames.options) - 1
            for i in range(
                    len(collnames.options) - 5,
                    len(collnames.options) - 1):
                collnames.select_by_index(i)
                self.data.page_loading(self.driver)
            if os.path.isfile(self.filename) != True:
                print('Enrollment last day csv file is not downloaded ')
                count = count + 1
            self.data.page_loading(self.driver)
            os.remove(self.filename)
            # return counter,count

    def test_Enrollment_last7_days(self):
        self.data = GetData()
        self.p = pwd()
        count = 0
        self.msg = file_extention()
        self.driver.find_element_by_xpath(Data.hyper_link).click()
        self.data.page_loading(self.driver)
        course_type = Select(self.driver.find_element_by_id(Data.coursetype))
        course_type.select_by_visible_text(' Enrollment ')
        self.data.page_loading(self.driver)
        timeseries = Select(self.driver.find_element_by_name(Data.timeperiods))
        timeseries.select_by_visible_text(' Last 7 Days ')
        self.data.page_loading(self.driver)
        if self.msg.no_data_available() in self.driver.page_source:
            print('No Data Available for last 7 days')
        else:
            self.driver.find_element_by_id(Data.Download).click()
            time.sleep(3)
            times = (self.driver.find_element_by_name(
                Data.timeperiods).text).strip()
            ctype = (self.driver.find_element_by_id(
                Data.coursetype).text).strip()
            self.filename = self.p.get_download_dir(
            ) + '/' + 'tpd_enrollment_all_district_last_7_days_' + self.data.get_current_date(
            ) + '.csv'
            self.data.page_loading(self.driver)
            collnames = Select(self.driver.find_element_by_id(Data.coll_names))
            counter = len(collnames.options) - 1
            for i in range(
                    len(collnames.options) - 5,
                    len(collnames.options) - 1):
                collnames.select_by_index(i)
                self.data.page_loading(self.driver)
            if os.path.isfile(self.filename) != True:
                print('Enrollment last 7 days csv file is not downloaded ')
                count = count + 1
            self.data.page_loading(self.driver)
            os.remove(self.filename)
            # return counter, count

    def test_Enrollment_last30_days(self):
        self.data = GetData()
        self.p = pwd()
        self.msg = file_extention()
        count = 0
        self.driver.find_element_by_xpath(Data.hyper_link).click()
        self.data.page_loading(self.driver)
        course_type = Select(self.driver.find_element_by_id(Data.coursetype))
        course_type.select_by_visible_text(' Enrollment ')
        self.data.page_loading(self.driver)
        timeseries = Select(self.driver.find_element_by_name(Data.timeperiods))
        timeseries.select_by_visible_text(' Last 30 Days ')
        self.data.page_loading(self.driver)
        if self.msg.no_data_available() in self.driver.page_source:
            print('No Data Available for last 30 days')
        else:
            self.driver.find_element_by_id(Data.Download).click()
            time.sleep(3)
            times = (self.driver.find_element_by_name(
                Data.timeperiods).text).strip()
            ctype = (self.driver.find_element_by_id(
                Data.coursetype).text).strip()
            self.filename = self.p.get_download_dir(
            ) + '/' + 'tpd_enrollment_all_district_last_30_days_' + self.data.get_current_date(
            ) + '.csv'
            self.data.page_loading(self.driver)
            collnames = Select(self.driver.find_element_by_id(Data.coll_names))
            counter = len(collnames.options) - 1
            for i in range(1, len(collnames.options) - 1):
                collnames.select_by_index(i)
                self.data.page_loading(self.driver)
            if os.path.isfile(self.filename) != True:
                print('Enrollment last 30 days csv file is not downloaded ')
                count = count + 1
            self.data.page_loading(self.driver)
            os.remove(self.filename)
示例#21
0
class cQube_home_page(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.page_loading(self.driver)
        self.driver.implicitly_wait(30)

    def test_SAR(self):
        self.data.page_loading(self.driver)
        self.driver.find_element_by_id("sar").click()
        self.data.page_loading(self.driver)
        if "attendance-report" in self.driver.current_url:
            print("Navigated to Student attendance report")
        else:
            print("Student attendance report is not exist")
        self.driver.find_element_by_id("homeBtn").click()

    def test_CRC(self):
        self.driver.find_element_by_id("crcr").click()
        self.data.page_loading(self.driver)
        if "crc-report" in self.driver.current_url:
            print("Navigated to  CRC report")
        else:
            print("CRC report is not exist")
        self.driver.find_element_by_id("homeBtn").click()

    def test_Semester(self):
        self.driver.find_element_by_id("sr").click()
        self.data.page_loading(self.driver)
        if "semester-report" in self.driver.current_url:
            print("Navigated to  Semester report")
        else:
            print("Semester report is not exist")
        self.driver.find_element_by_id("homeBtn").click()

    def test_TAR(self):
        self.data.page_loading(self.driver)
        self.driver.find_element_by_id("tar").click()
        self.data.page_loading(self.driver)
        if "teacher-attendance" in self.driver.current_url:
            print("Navigated to  Teacher coming soon page ")
        else:
            print(" Teacher coming soon page is not exist")
        self.driver.find_element_by_id("homeBtn").click()

    def test_school_map(self):
        self.driver.find_element_by_id("imr").click()
        self.data.page_loading(self.driver)
        if "school-infra-map" in self.driver.current_url:
            print("Navigated to  School infrastructure map based report")
        else:
            print("School infra map based report is not exist")
        self.driver.find_element_by_id("homeBtn").click()

    def test_school_chart(self):
        self.driver.find_element_by_id("icr").click()
        self.data.page_loading(self.driver)
        if "school-infrastructure" in self.driver.current_url:
            print("Navigated to  School infrastructure chart based report")
        else:
            print("School infra chart based report is not exist")
        self.driver.find_element_by_id("homeBtn").click()

    @classmethod
    def tearDown(cls):
        cls.driver.close()
示例#22
0
class Test_summaryreport(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.p = pwd()
        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.page_loading(self.driver)
        self.data.login_to_adminconsole(self.driver)

    def test_summary_icon(self):
        count = 0
        self.data.page_loading(self.driver)
        self.driver.find_element_by_xpath(Data.summary_icon).click()
        self.data.page_loading(self.driver)
        if 'summary-statistics' in self.driver.current_url:
            print("Summmary statistics report page is present ")
        else:
            print('Summary report page is not displayed')
            count = count + 1
        self.assertEqual(0, count, msg='Summary report page is not working')
        self.driver.find_element_by_id('homeBtn').click()
        self.data.page_loading(self.driver)

    def test_dashboard_summary(self):
        count = 0
        self.driver.find_element_by_id(Data.Dashboard).click()
        time.sleep(2)
        self.driver.find_element_by_xpath(Data.summ).click()
        self.data.page_loading(self.driver)
        if 'summary-statistics' in self.driver.current_url:
            print("Summmary statistics report page is present ")
        else:
            print('Summary report page is not displayed')
            count = count + 1
        self.assertEqual(0, count, msg='Summary report page is not working')
        self.driver.find_element_by_id('homeBtn').click()
        self.data.page_loading(self.driver)

    def test_check_summary(self):
        self.data.page_loading(self.driver)
        self.driver.find_element_by_id(Data.Dashboard).click()
        time.sleep(3)
        self.driver.find_element_by_xpath(Data.summ).click()
        self.data.page_loading(self.driver)
        reports = self.driver.find_elements_by_tag_name('h2')
        count = len(reports)
        if "Diksha data Summary:" in self.driver.page_source:
            print('Diksha data Summary: statistics present')
        else:
            print('Diksha data Summary: is not present')

        if "Student Attendance Summary:" in self.driver.page_source:
            print('Student Attendance Summary: present')
        else:
            print('Student Attendance summmary is not present')

        if "CRC Infra_Table_Report Summary:" in self.driver.page_source:
            print('CRC Infra_Table_Report Summary: statistics present')
        else:
            print('CRC Infra_Table_Report Summary: is not present')

        if "Semester Infra_Table_Report Summary:" in self.driver.page_source:
            print(' Semester Infra_Table_Report Summary: statistics present')
        else:
            print(' Semester Infra_Table_Report Summary: is not present')

        if "Infra Infra_Table_Report Summary:" in self.driver.page_source:
            print(' Infra Infra_Table_Report Summary: statistics present')
        else:
            print(' Infra Infra_Table_Report Summary: is not present')

        if "Inspection Infra_Table_Report Summary:" in self.driver.page_source:
            print(' Inspection Infra_Table_Report Summary: statistics present')
        else:
            print(' Inspection Infra_Table_Report Summary: is not present')

        if "Static district file Summary:" in self.driver.page_source:
            print(' Static district file Summary: statistics present')
        else:
            print(' Static district file Summary: is not present')

        if "Static block file Summary:" in self.driver.page_source:
            print(' Static block file Summary: statistics present')
        else:
            print(' Static block file Summary: is not present')

        if "Static cluster file Summary:" in self.driver.page_source:
            print(' Static cluster file Summary: statistics present')
        else:
            print(' Static cluster file Summary: is not present')

        if "Static school file Summary:" in self.driver.page_source:
            print("Static school file Summary: is present ")
        else:
            print("Static school file Summary: is not present ")
        self.data.page_loading(self.driver)
        self.driver.find_element_by_id('homeBtn').click()
        self.data.page_loading(self.driver)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
class MyTestSuite_Exception(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(100)
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.page_loading(self.driver)

    def test_issue01(self):

        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                exception_smoke_testing.cQube_semester_exception_report)
        ])
        p = pwd()
        outfile = open(p.get_regression_map_reports(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='Semester Exception Smoke Test Infra_Table_Report',
            verbosity=1,
        )

        runner1.run(regression_test)
        outfile.close()

    def test_issue02(self):
        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                smoke_student_exception.cQube_smoke_Student_exception)
        ])
        p = pwd()
        outfile = open(p.get_regression_map_reports(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='Student Exception Smoke Test Infra_Table_Report',
            verbosity=1,
        )

        runner1.run(regression_test)
        outfile.close()

    def test_issue03(self):
        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                smoke_teacher_exception.cQube_teacher_exception_smoke_report)
        ])
        p = pwd()
        outfile = open(p.get_regression_map_reports(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='Teacher Exception Smoke Test Infra_Table_Report',
            verbosity=1,
        )

        runner1.run(regression_test)
        outfile.close()

    def test_issue04(self):
        regression_test = unittest.TestSuite()
        regression_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                smoke_pat_exception.cQube_pat_exception_smoke_report)
        ])
        p = pwd()
        outfile = open(p.get_regression_map_reports(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='PAT Exception Smoke Test Report',
            verbosity=1,
        )

        runner1.run(regression_test)
        outfile.close()
示例#24
0
class test_Graph():
    def __init__(self, driver):
        self.driver = driver

    def test_xaxis(self):
        self.p = GetData()
        self.driver.find_element_by_xpath(Data.hyper).click()
        self.p.page_loading(self.driver)
        xaxis_lists = Select(self.driver.find_element_by_id('x_axis'))
        self.p.page_loading(self.driver)
        count = len(xaxis_lists.options) - 1
        return count

    def test_yaxis(self):
        self.p = GetData()
        self.driver.find_element_by_xpath(Data.hyper).click()
        self.p.page_loading(self.driver)
        xaxis_lists = Select(self.driver.find_element_by_id('y_axis'))
        self.p.page_loading(self.driver)
        count = len(xaxis_lists.options) - 1
        return count

    def test_xplots(self):
        self.driver.implicitly_wait(30)
        self.p = GetData()
        self.driver.find_element_by_xpath(Data.hyper).click()
        self.p.page_loading(self.driver)
        dist = Select(self.driver.find_element_by_id("choose_dist"))
        dist.select_by_index(5)
        self.p.page_loading(self.driver)
        xaxis_lists = Select(self.driver.find_element_by_id('x_axis'))
        for i in range(len(xaxis_lists.options)):
            time.sleep(2)
            xaxis_lists.select_by_index(i)
            self.p.page_loading(self.driver)
        self.p.page_loading(self.driver)

    def test_yplots(self):
        self.driver.implicitly_wait(30)
        self.p = GetData()
        self.driver.find_element_by_xpath(Data.hyper).click()
        self.p.page_loading(self.driver)
        dist = Select(self.driver.find_element_by_id("choose_dist"))
        dist.select_by_index(5)
        self.p.page_loading(self.driver)
        yaxis_lists = Select(self.driver.find_element_by_id('y_axis'))
        for i in range(len(yaxis_lists.options)):
            time.sleep(2)
            yaxis_lists.select_by_index(i)
            self.p.page_loading(self.driver)
        self.p.page_loading(self.driver)
class cQube_Student_Attendance_regression(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.navigate_to_student_report()
        year = Select(self.driver.find_element_by_id(Data.sar_year))
        month = Select(self.driver.find_element_by_id(Data.sar_month))
        self.year = year.first_selected_option.text
        self.month = month.first_selected_option.text

    def test_click_on_student_attendence_report(self):
        sar = DahboardSar(self.driver)
        result = sar.click_on_sar()
        if "Student Attendance Report" in self.driver.page_source:
            print("Navigating to Student Attendance Report is working")
        else:
            print("Student_Attendance page does not exist!...")

    def test_click_on_blocks(self):
        block = Blocks(self.driver)
        result = block.check_markers_on_block_map()
        self.assertNotEqual(0,
                            len(result) - 1,
                            msg="Dots are not present on map")
        print("Blocks button is working")
        print("Markers are present on the map")

        cluster = Clusters(self.driver)
        result = cluster.check_markers_on_clusters_map()
        self.assertNotEqual(0,
                            len(result) - 1,
                            msg="Dots are not present on map")
        print("Clusters button is working")
        print("Markers are present on the map")

        school = Schools(self.driver)
        result = school.check_markers_on_schools_map()
        self.assertNotEqual(0,
                            int(len(result) - 1),
                            msg="Dots are not present on map")
        print("Schools button is working")
        print("Markers are present on the map")

    def test_districtwise_csv_download(self):
        csv = DistrictwiseCsv(self.driver, self.year, self.month)
        result = csv.click_download_icon_of_district()
        self.assertEqual(0,
                         result,
                         msg='Mis match found at footer information')
        print('Districtwise csv file is downloaded')
        self.data.page_loading(self.driver)

    def test_blockwise_csv_download(self):
        csv = BlockwiseCsv(self.driver, self.year, self.month)
        result = csv.click_download_icon_of_blocks()
        if result:
            print("Block wise csv report download is working")
            csv.remove_csv()
        else:
            raise self.failureException(
                "Block wise csv report download is not working")
        time.sleep(2)

    def test_clusterwise_csv_download(self):
        csv = ClusterwiseCsv(self.driver, self.year, self.month)
        result = csv.click_download_icon_of_clusters()
        if result:
            print("Cluster wise csv report download is working")
            csv.remove_csv()
        else:
            raise self.failureException(
                "Cluster wise csv report download is not working")

    def test_schoolwise_csv_download(self):
        csv = SchoolwiseCsv(self.driver, self.year, self.month)
        result = csv.click_download_icon_of_schools()
        if result:
            print("School wise csv report download is working")
            csv.remove_csv()
        else:
            raise self.failureException(
                "School wise csv report download is not working")

    def test_choose_district_block_cluster(self):
        dist = DistrictCsvDownload(self.driver, self.year, self.month)
        result = dist.check_districts_csv_download()
        if result == 0:
            print("Block per district csv report download is working")
            print("on selection of each district")
            print("The footer value of no of schools and no of students are")
            print("equals to downloaded file")
        else:
            raise self.failureException(
                "Block per district csv report download is working")
        block = ClusterPerBlockCsvDownload(self.driver, self.year, self.month)
        result = block.check_csv_download()
        if result == 0:
            print("Cluster per block csv report download is working")
            print("on selection of each district and block")
            print("The footer value of no of schools and no of students are")
            print("equals to downloaded file")
        else:
            raise self.failureException(
                "Cluster per block csv report download is working")
        schools = DistrictBlockCluster(self.driver, self.year, self.month)
        result = schools.check_district_block_cluster()
        if result == 0:
            print("Schools per cluster csv download report is working")
            print("on selection of each district,block and cluster")
            print("The footer value of no of schools and no of students are")
            print("equals to downloaded file")
        else:
            raise self.failureException(
                "Schools per cluster csv report download is working")

    def test_check_hyperlinks(self):
        hyperlinks = Hyperlink(self.driver)
        result1, result2, choose_dist = hyperlinks.click_on_hyperlinks()
        if result1 == False and result2 == False and choose_dist == "Choose a District ":
            print("hyperlinks are working")
        else:
            raise self.failureException("hyperlinks are not working")

    def test_home_icon(self):
        home = Home(self.driver)
        home.click_on_blocks_click_on_home_icon()
        result = home.click_HomeButton()
        if "student-attendance" in result:
            print("Home Icon is working")
        else:
            raise self.failureException('Home Icon is not working')
        self.data.page_loading(self.driver)

    def test_total_no_of_students_and_total_no_of_schools_is_equals_at_districts_blocks_clusters_schools(
            self):
        tc = TotalStudentsSchools(self.driver)
        student_count, Bstudents, school_count, Bschools = tc.block_total_no_of_students(
        )
        self.assertEqual(int(student_count),
                         int(Bstudents),
                         msg="Block level no of students are not equal")
        self.assertEqual(
            int(school_count),
            int(Bschools),
            msg="Block level no of schools are not equal to no of schools ")
        student_count, Cstudents, school_count, Cschool = tc.cluster_total_no_of_students(
        )
        self.assertEqual(int(student_count),
                         int(Cstudents),
                         msg="Cluster level no of students are not equal")
        self.assertEqual(
            int(school_count),
            int(Cschool),
            msg="Cluster level no of schools are not equal to no of schools ")
        student_count, Sstudents, school_count, Sschool = tc.schools_total_no_of_students(
        )
        self.assertEqual(int(student_count),
                         int(Sstudents),
                         msg="Cluster level no of students are not equal")
        self.assertEqual(
            int(school_count),
            int(Sschool),
            msg="Cluster level no of schools are not equal to no of schools ")
        print(
            "Total number of students equals on clicking of blocks,clusters,schools"
        )
        print(
            "Total number of schools equals on clicking of blocks,clusters,schools"
        )

    # def test_date_range(self):
    #     daterange = DateRange(self.driver)
    #     result = daterange.check_date_range()
    #     self.driver.find_element_by_id('homeBtn').click()
    #     time.sleep(2)
    #     self.data.navigate_to_student_report()
    #     self.data.page_loading(self.driver)
    # if result != 0:
    #  raise self.failureException('Data Range in correct')

    def test_logout(self):
        logout = Logout(self.driver)
        result = logout.click_on_logout()
        self.assertEqual("Log in to cQube",
                         result,
                         msg="login page is not exist!..")
        print("Logout Functionality is working")
        self.data.login_cqube(self.driver)
        self.data.navigate_to_student_report()
        self.data.page_loading(self.driver)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
class cQube_SI_Report(unittest.TestCase):

    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.navigate_to_school_infrastructure()
        self.data.page_loading(self.driver)

    def test_school_report(self):
        b = check_schoolinfra_report(self.driver)
        res = b.test_report()
        self.assertEqual("menu", res, msg="Dashboard is not exists!")
        print("Menu list is displayed")
        self.data.page_loading(self.driver)

    # def test_graph(self):
    #     b = check_with_graph(self.driver)
    #     res = b.test_graph()
    #     print("Graph is present in School report")
    #     self.data.page_loading(self.driver)

    def test_download_district_wise(self):
        b = download_report(self.driver)
        path = b.test_schools()
        self.assertTrue(path, msg="File is not downloaded")
        b.remove_csv()
        print("districtwise csv file is downloaded")
        self.data.page_loading(self.driver)


    def test_download_blockwise(self):
        b = donwload_blockwise_csv(self.driver)
        res = b.test_block()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_csv()
        print("blockwise csv file downloaded")
        self.data.page_loading(self.driver)

    def test_schoolwise_download(self):
        b = school_wise_donwload(self.driver)
        res = b.test_schoolwise()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_csv()
        print("school wise csv file is downloaded")
        self.data.page_loading(self.driver)

    def test_clusterwise_download(self):
        b = donwload_clusterwise_csv(self.driver)
        res = b.test_clusterwise()
        self.assertTrue(res, msg="File is not downloaded")
        b.remove_csv()
        print("cluster wise csv file is downloaded")
        self.data.page_loading(self.driver)

    # def test_home_icon(self):
    #     b = home(self.driver)
    #     res = b.test_homeicon()
    #     print("homeicon is working..")
    #     self.data.page_loading(self.driver)
    #
    # def test_home_btn(self):
    #     b = home(self.driver)
    #     res = b.test_homebtn()
    #     print("home button is working..")
    #     self.data.page_loading(self.driver)

    def test_check_orderwise(self):
        b = check_order_of_tabledata(self.driver)
        print("Table record order wise..")
        res = b.test_tablevalue()
        print("checked with orderwise of table data")
        self.data.page_loading(self.driver)

    # def test_sc_scator_districtwise(self):
    #     b = test_districtwise(self.driver)
    #     result = b.test_districtwise()
    #     self.assertEqual(0, result, msg="No data found")
    #     print("Checked with each district wise records")
    #     self.data.page_loading(self.driver)
    #
    # def test_sc_scator_blockwise(self):
    #     b = school_blockwise(self.driver)
    #     result = b.test_blockwise()
    #     self.assertEqual(0, result, msg="No data found")
    #     print("Checked with each block wise records")
    #     self.data.page_loading(self.driver)

    def test_schools_per_cluster_csv_download1(self):
        school = Test_schoolwise(self.driver)
        result = school.check_csv_download1()
        if result == 0:
            print("Schools per cluster csv download report is working")
            print("on selection of each district,block and cluster")
            print("The footer value of no of schools and no of students are")
            print("equals to downloaded file")
        else:
            raise self.failureException("Schools per cluster csv report download1 is working")

    # def test_tabledata_districtwise(self):
    #     b = districtwise_tabledata(self.driver)
    #     res = b.test_table_data()
    #     if res != 0:
    #         raise self.failureException('Data not found on table')
    #     print("Districtwise table data is present...")
    #     self.data.page_loading(self.driver)
    #
    # def test_xplotvalue(self):
    #     b = Graph_values(self.driver)
    #     res = b.test_xplots()
    #     print("Checked with xvalues are working..")
    #     self.data.page_loading(self.driver)
    #
    # def test_yplotvalue(self):
    #     b = Graph_values(self.driver)
    #     res = b.test_yaxis()
    #     print("Checked with y values are working..")
    #     self.data.page_loading(self.driver)


    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
class cQube_enrollment_regression(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(100)
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.page_loading(self.driver)
        self.data.navigate_to_tpd_enrollment_report()
        self.data.page_loading(self.driver)

    def test_tpd_enrollment_icon(self):
        b = enrollment_icon(self.driver)
        res = b.test_enrollment_icon()
        self.assertEqual(0, res, msg="Completion icon is not working ")
        self.data.page_loading(self.driver)

    def test_tpd_enrollment_from_hamburger(self):
        b = enrollment_icon(self.driver)
        res = b.test_dashboard_enrollment_report()
        self.assertEqual(0, res, msg="Navigation from hamburger is failed")
        self.data.page_loading(self.driver)

    def test_Enrollment_time_periods_overall(self):
        b = Enrollment_time_periods(self.driver)
        res1 = b.test_Enrollment_overall()
        # self.assertNotEqual(0,res,msg='Collection names are empty')
        self.assertEqual(res1,
                         0,
                         msg="Enrollment Overall csv file is not downloaded ")
        self.data.page_loading(self.driver)

    def test_completion_time_periods_overall(self):
        b = completion_time_periods(self.driver)
        res, res1 = b.test_completion_overall()
        self.assertNotEqual(0, res, msg='Collection names are empty')
        self.assertEqual(res1,
                         0,
                         msg="Enrollment Overall csv file is not downloaded ")
        self.data.page_loading(self.driver)

    def test_Home_functionalities(self):
        b = Home_functionalities(self.driver)
        res = b.test_homeicon_functionality()
        # self.assertFalse(res,msg="Time period is not selected")
        self.data.page_loading(self.driver)

    def test_Homebtn_functionalities(self):
        b = Home_functionalities(self.driver)
        res = b.test_homebtn_funtion()
        self.assertEqual(res, 0, msg="Homebtn is not worked")
        self.data.page_loading(self.driver)

    def test_hyperlink_function(self):
        b = Home_functionalities(self.driver)
        res = b.test_hyperlink_function()
        print("Hyper link is working ")
        self.data.page_loading(self.driver)

    def test_Click_download_icon(self):
        b = Click_download_icon(self.driver)
        res = b.test_check_download_icon()
        self.assertEqual(res, 0, msg='Districtwise csv file is not downloaded')
        print('Enrollment count is correctly displaying')
        self.data.page_loading(self.driver)

    def test_districtwise_records(self):
        b = Check_Districtwise(self.driver)
        res = b.test_coursetype_with_all_districts()
        self.assertEqual(0,
                         res,
                         msg='Some district csv file is not downloaded')
        print("Districtwise csv file is downloading")
        self.data.page_loading(self.driver)

    def test_blockwise_records(self):
        b = Check_Block_wise(self.driver)
        res = b.test_coursetype_with_all_blockwise()
        self.assertEqual(0, res, msg='Some Blocks csv file is not downloaded')
        print('Blockwise csv file is downloading')
        self.data.page_loading(self.driver)

    def test_clusterwise_records(self):
        b = Check_Cluster_wise(self.driver)
        res = b.test_coursetype_with_all_clusterwise()
        self.assertEqual(0, res, msg='Some Cluster csv file is not downloaded')
        print('Clusterwise csv file is downloaded')
        self.data.page_loading(self.driver)

    def test_logout_button(self):
        b = logout_button(self.driver)
        res = b.click_on_logout_btn()
        self.assertEqual(0, res, msg='Logout btn is not working ')
        self.data.page_loading(self.driver)

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
class cQube_Student_Attendance(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.total_tests = 20
        self.tests = [0] * 21
        self.data = GetData()
        self.logger = self.data.get_functional_log("sar")

        self.driver = self.data.get_driver()
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.x = arg()
        self.year = self.x.list[0]
        self.month = self.x.list[1]
        self.data.select_month_year(self.year, self.month)

    def test_click_on_dashboard(self):
        self.tests.pop()
        self.logger.info("test_click_on_dashboard is running" + " " +
                         "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        dashboard = Dashboard(self.driver)
        dashboard.click_on_dashboard()

        self.logger.info("test_click_on_dashboard is completed...")

    def test_click_on_student_attendence_report(self):
        self.tests.pop()
        self.logger.info("test_click_on_student_attendence_report is running" +
                         " " + "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        sar = DahboardSar(self.driver)
        result = sar.click_on_sar()
        if "Student Attendance Report" in result:
            print("This is Student Attendance Report page")
        else:
            print("SAR page does not exist!...")

        self.logger.info(
            "test_click_on_student_attendence_report is completed...")

    def test_click_on_blocks(self):
        self.tests.pop()
        self.logger.info("test_click_on_blocks is running" + " " + "Total :" +
                         " " + str(self.total_tests) + " " + "Remaining :" +
                         " " + str(len(self.tests) - 1))

        block = Blocks(self.driver)
        result = block.check_markers_on_block_map()
        self.assertNotEqual(0,
                            len(result) - 1,
                            msg="Dots are not present on map")

        self.logger.info("test_click_on_blocks is completed...")

    def test_click_on_clusters(self):
        self.tests.pop()
        self.logger.info("test_click_on_clusters is running" + " " +
                         "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        cluster = Clusters(self.driver)
        result = cluster.check_markers_on_clusters_map()
        self.assertNotEqual(0,
                            len(result) - 1,
                            msg="Dots are not present on map")

        self.logger.info("test_click_on_clusters is completed...")

    def test_click_on_schools(self):
        self.tests.pop()
        self.logger.info("test_click_on_schools is running" + " " + "Total :" +
                         " " + str(self.total_tests) + " " + "Remaining :" +
                         " " + str(len(self.tests) - 1))

        school = Schools(self.driver)
        result = school.check_markers_on_clusters_map()
        self.assertNotEqual(0,
                            int(len(result) - 1),
                            msg="Dots are not present on map")

        self.logger.info("test_click_on_schools is completed...")

    def test_logout(self):
        self.tests.pop()
        self.logger.info("test_logout is running" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))

        logout = Logout(self.driver)
        result = logout.click_on_logout()
        self.assertEqual("cQube", result, msg="login page is not exist!..")
        self.data.login_cqube(self.driver)
        self.data.select_month_year(self.year, self.month)

        self.logger.info("test_logout is completed...")

    def test_check_hyperlinks(self):
        self.tests.pop()
        self.logger.info("test_check_hyperlinks is running" + " " + "Total :" +
                         " " + str(self.total_tests) + " " + "Remaining :" +
                         " " + str(len(self.tests) - 1))

        hyperlinks = Hyperlink(self.driver)
        result1, result2, choose_dist = hyperlinks.click_on_hyperlinks()
        if result1 == False and result2 == False and choose_dist == "Choose a District ":
            print("hyperlinks are working")
        else:
            raise self.failureException("hyperlinks are not working")

        self.logger.info("test_check_hyperlinks is completed...")

    def test_districtwise_csv_download(self):
        self.tests.pop()
        self.logger.info("test_districtwise_csv_download is running" + " " +
                         "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        csv = DistrictwiseCsv(self.driver, self.year, self.month)
        result = csv.click_download_icon_of_district()
        if result:
            print("District wise csv report download is working")
            csv.remove_csv()
        else:
            raise self.failureException(
                "District wise csv report download is not working")

        self.logger.info("test_districtwise_csv_download is completed...")

    def test_blockwise_csv_download(self):
        self.tests.pop()
        self.logger.info("test_blockwise_csv_download is running" + " " +
                         "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        csv = BlockwiseCsv(self.driver, self.year, self.month)
        result = csv.click_download_icon_of_blocks()
        if result:
            print("Block wise csv report download is working")
            csv.remove_csv()
        else:
            raise self.failureException(
                "Block wise csv report download is not working")

        self.logger.info("test_blockwise_csv_download is completed...")

    def test_clusterwise_csv_download(self):
        self.tests.pop()
        self.logger.info("test_clusterwise_csv_download is running" + " " +
                         "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        csv = ClusterwiseCsv(self.driver, self.year, self.month)
        result = csv.click_download_icon_of_clusters()
        if result:
            print("Cluster wise csv report download is working")
            csv.remove_csv()
        else:
            raise self.failureException(
                "Cluster wise csv report download is not working")

        self.logger.info("test_clusterwise_csv_download is completed...")

    def test_schoolwise_cv_download(self):
        self.tests.pop()
        self.logger.info("test_schoolwise_cv_download is running" + " " +
                         "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        csv = SchoolwiseCsv(self.driver, self.year, self.month)
        result = csv.click_download_icon_of_schools()
        if result:
            print("School wise csv report download is working")
            csv.remove_csv()
        else:
            raise self.failureException(
                "School wise csv report download is not working")

        self.logger.info("test_schoolwise_cv_download is completed...")

    def test_no_of_schools_is_equals_at_districts_blocks_clusters_schools(
            self):
        self.tests.pop()
        self.logger.info(
            "test_no_of_schools_is_equals_at_districts_blocks_clusters_schools is running"
            + " " + "Total :" + " " + str(self.total_tests) + " " +
            "Remaining :" + " " + str(len(self.tests) - 1))

        tc = TotalSchools(self.driver)
        schools, Bschools = tc.block_no_of_schools()
        self.assertEqual(
            int(schools),
            int(Bschools),
            msg="Block level no of schools are not equal to no of schools ")
        schools, Cschools = tc.cluster_no_of_schools()
        self.assertEqual(
            int(schools),
            int(Cschools),
            msg="Cluster level no of schools are not equal to no of schools ")
        schools, Sschools = tc.schools_no_of_schools()
        self.assertEqual(
            int(schools),
            int(Sschools),
            msg="Cluster level no of schools are not equal to no of schools ")

        self.logger.info(
            "test_no_of_schools_is_equals_at_districts_blocks_clusters_schools is completed..."
        )

    def test_total_no_of_students_is_equals_at_districts_blocks_clusters_schools(
            self):
        self.tests.pop()
        self.logger.info(
            "test_total_no_of_students_is_equals_at_districts_blocks_clusters_schools is running"
            + " " + "Total :" + " " + str(self.total_tests) + " " +
            "Remaining :" + " " + str(len(self.tests) - 1))

        tc = TotalStudents(self.driver)
        student_count, Bstudents = tc.block_total_no_of_students()
        self.assertEqual(int(student_count),
                         int(Bstudents),
                         msg="Block level no of students are not equal")
        student_count, Cstudents = tc.cluster_total_no_of_students()
        self.assertEqual(int(student_count),
                         int(Cstudents),
                         msg="Cluster level no of students are not equal")
        student_count, Sstudents = tc.schools_total_no_of_students()
        self.assertEqual(int(student_count),
                         int(Sstudents),
                         msg="Cluster level no of students are not equal")

        self.logger.info(
            "test_total_no_of_students_is_equals_at_districts_blocks_clusters_schools is completed..."
        )

    def test_no_of_schools_and_no_of_dots_are_equal_at_each_cluster_level(
            self):
        self.tests.pop()
        self.logger.info(
            "test_no_of_schools_and_no_of_dots_are_equal_at_each_cluster_level is running"
            + " " + "Total :" + " " + str(self.total_tests) + " " +
            "Remaining :" + " " + str(len(self.tests) - 1))

        cluster = ClusterDotsWithNoOfSchools(self.driver)
        result = cluster.comapre_cluster()
        if result != 0:
            raise self.failureException('data not matched')

        self.logger.info(
            "test_no_of_schools_and_no_of_dots_are_equal_at_each_cluster_level is completed..."
        )

    def test_home_icon(self):
        self.tests.pop()
        self.logger.info("test_home_icon is running" + " " + "Total :" + " " +
                         str(self.total_tests) + " " + "Remaining :" + " " +
                         str(len(self.tests) - 1))

        home = Home(self.driver)
        home.click_on_blocks_click_on_home_icon()
        result = home.click_HomeButton()
        if "Student Attendance Report" in result:
            print("This is Student Attendance Report page")
        else:
            raise self.failureException('Home Icon is not working')

        self.logger.info("test_home_icon is completed...")

    def test_block_per_district_csv_download(self):
        self.tests.pop()
        self.logger.info("test_block_per_district_csv_download is running" +
                         " " + "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        dist = DistrictCsvDownload(self.driver, self.year, self.month)
        result = dist.check_districts_csv_download()
        if result == 0:
            print("Block per district csv report download is working")
        else:
            raise self.failureException(
                "Block per district csv report download is working")

        self.logger.info(
            "test_block_per_district_csv_download is completed...")

    def test_cluster_per_block_csv_download(self):
        self.tests.pop()
        self.logger.info("test_cluster_per_block_csv_download is running" +
                         " " + "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        block = ClusterPerBlockCsvDownload(self.driver, self.year, self.month)
        result = block.check_csv_download()
        if result == 0:
            print("Cluster per block csv report download is working")
        else:
            raise self.failureException(
                "Cluster per block csv report download is working")

        self.logger.info("test_cluster_per_block_csv_download is completed...")

    def test_schools_per_cluster_csv_download(self):
        self.tests.pop()
        self.logger.info("test_schools_per_cluster_csv_download is running" +
                         " " + "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        schools = SchoolsPerClusterCsvDownload(self.driver, self.year,
                                               self.month)
        result = schools.check_csv_download()
        if result == 0:
            print("Schools per cluster csv report download is working")
        else:
            raise self.failureException(
                "Schools per cluster csv report download is working")

        self.logger.info(
            "test_schools_per_cluster_csv_download is completed...")

    def test_dots_on_each_districts(self):
        self.tests.pop()
        self.logger.info("test_dots_on_each_districts is running" + " " +
                         "Total :" + " " + str(self.total_tests) + " " +
                         "Remaining :" + " " + str(len(self.tests) - 1))

        dist = DotsOnDistricts(self.driver)
        result = dist.check_dots_on_each_districts()
        if result != 0:
            raise self.failureException('data not found')

        self.logger.info("test_dots_on_each_districts is completed...")

    def test_dots_on_each_districts_and_each_block(self):
        self.tests.pop()
        self.logger.info(
            "test_dots_on_each_districts_and_each_block is running" + " " +
            "Total :" + " " + str(self.total_tests) + " " + "Remaining :" +
            " " + str(len(self.tests) - 1))

        dist_block = DotsOnDistrictsBlock(self.driver)
        result = dist_block.check_dots_on_each_districts_block()
        if result != 0:
            raise self.failureException('data not found')

        self.logger.info(
            "test_dots_on_each_districts_and_each_block is completed...")

    @classmethod
    def tearDownClass(cls):
        cls.driver.close()
示例#29
0
class MyTestSuite(unittest.TestCase):

    @classmethod
    def setUpClass(self):
        self.data = GetData()
        self.driver = self.data.get_driver()
        self.driver.implicitly_wait(100)
        self.data.open_cqube_appln(self.driver)
        self.data.login_cqube(self.driver)
        self.data.page_loading(self.driver)


    def test_issue01(self):
        smoke_test = unittest.TestSuite()
        smoke_test.addTests([
            # file name .class name
            unittest.defaultTestLoader.loadTestsFromTestCase(login_page.login),
        ])
        p = pwd()
        outfile = open(p.get_smoke_report_path(), "w")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='Smoke Test Report',
            verbosity=1,

        )
        runner1.run(smoke_test)
        outfile.close()

    def test_issue02(self):
        smoke_test = unittest.TestSuite()
        smoke_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(cQube_landing_page.cQube_Home),
        ])
        p = pwd()
        outfile = open(p.get_smoke_report_path(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='cQube landing page Report',
            verbosity=1,

        )
        runner1.run(smoke_test)
        outfile.close()


    def test_issue03(self):
        self.data.navigate_to_student_report()
        time.sleep(3)
        self.errMsg = self.data.get_data_status()
        if self.errMsg.text == 'No data found':
            print("No data in the student attendance report page")
        else:
            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                # file name .class name
                unittest.defaultTestLoader.loadTestsFromTestCase(student_attendance_smoke_testing.cQube_Student_Attendance),
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='Student Attendance Test Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue04(self):
        self.data.navigate_to_crc_report()
        time.sleep(3)
        self.errMsg = self.data.get_data_status()
        if self.errMsg.text == 'No data found':
            print("No data in the crc report page")
        else:
            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                # file name .class name
                unittest.defaultTestLoader.loadTestsFromTestCase(crc_report_smoke_testing.cQube_CRC_Report),
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='Crc Test Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue05(self):
        self.data.navigate_to_semester_report()
        time.sleep(3)
        self.errMsg = self.data.get_data_status()
        if self.errMsg.text == 'No data found':
            print("No data in the semester report page")
        else:
            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                unittest.defaultTestLoader.loadTestsFromTestCase(semester_report_smoke_testing.cQube_Semester_Report),
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='Semester Test Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue06(self):
        # self.data.navigate_to_school_infrastructure_map()
        # time.sleep(3)
        # self.errMsg = self.data.get_data_status()
        # if self.errMsg.text == 'No data found':
        #     print("No data in the school infra map report page")
        # else:
            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                # file name .class name
                unittest.defaultTestLoader.loadTestsFromTestCase(School_Map_smoke_testing.cQube_SI_Map_Report),

            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='School Infra Map Test Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue07(self):
        self.data.navigate_to_school_infrastructure()
        time.sleep(3)
        self.errMsg = self.data.get_data_status()
        if self.errMsg.text == 'No data found':
            print("No data in the school infra report page")
        else:
            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                unittest.defaultTestLoader.loadTestsFromTestCase(School_report_smoke_testing.cQube_SI_Report)
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='School Infra Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue08(self):

            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                unittest.defaultTestLoader.loadTestsFromTestCase(diksha_chart_smoke_testing.cQube_diskha_chart)
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='Diksha chart Test Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue12(self):

        smoke_test = unittest.TestSuite()
        smoke_test.addTests([
            unittest.defaultTestLoader.loadTestsFromTestCase(
                column_smoke_testing.cQube_diskha_column_report)
        ])
        p = pwd()
        outfile = open(p.get_smoke_report_path(), "a")

        runner1 = HTMLTestRunner.HTMLTestRunner(
            stream=outfile,
            title='Diksha column smoke Test Report',
            verbosity=1,

        )

        runner1.run(smoke_test)
        outfile.close()

    def test_issue09(self):

            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                unittest.defaultTestLoader.loadTestsFromTestCase(diksha_table_smoke_testing.cQube_diskha_report)
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='Diksha Table Test Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue10(self):

            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                unittest.defaultTestLoader.loadTestsFromTestCase(exception_smoke_testing.cQube_semester_exception_report)
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='Semester Exception Test Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue11(self):

            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                unittest.defaultTestLoader.loadTestsFromTestCase(
                    telemetry_smoke_testing.Test_Telemetry)
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='Telemetry smoke Test Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue13(self):

            smoke_test = unittest.TestSuite()
            smoke_test.addTests([
                unittest.defaultTestLoader.loadTestsFromTestCase(
                    udise_smoke_testing.cQube_udise_Report)
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='UDISE Report smoke Test Report',
                verbosity=1,

            )

            runner1.run(smoke_test)
            outfile.close()

    def test_issue14(self):
        self.data.navigate_to_composite_report()
        time.sleep(3)
        self.errMsg = self.data.get_data_status()
        if self.errMsg.text == 'No data found':
            print("No data in composite the report page")
        else:
            regression_test = unittest.TestSuite()
            regression_test.addTests([
                unittest.defaultTestLoader.loadTestsFromTestCase(
                    composite_smoke_testing.composite_smoke_testing)
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='Composite Report smoke Test Report',
                verbosity=1,

            )

            runner1.run(regression_test)
            outfile.close()

    def test_issue15(self):
        self.data.navigate_to_periodic_report()
        time.sleep(3)
        self.errMsg = self.data.get_data_status()
        if self.errMsg.text == 'No data found':
            print("No data in Periodic the report page")
        else:
            regression_test = unittest.TestSuite()
            regression_test.addTests([
                unittest.defaultTestLoader.loadTestsFromTestCase(
                    periodic_smoke_testing.periodic_smoke)
            ])
            p = pwd()
            outfile = open(p.get_smoke_report_path(), "a")

            runner1 = HTMLTestRunner.HTMLTestRunner(
                stream=outfile,
                title='Periodic Report Smoke Test Report',
                verbosity=1,

            )

            runner1.run(regression_test)
            outfile.close()

    @classmethod
    def tearDownClass(self):
        self.driver.close()
class udiseindices_scores():
    def __init__(self,driver):
        self.driver = driver

    def infrastructure_score(self):
        self.cal = GetData()
        self.fname = file_extention()
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        self.driver.find_element_by_css_selector('p >span').click()
        self.cal.page_loading(self.driver)
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(1)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Infrastructure_Score_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        print(self.filename)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("infrastructure_score  is selected and csv file is downloaded")
            return row_count-1


    def administation(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(2)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Administration_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("Administration is selected and csv file is downloaded")
            return row_count - 1

    def artslab(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(3)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Arts_Lab_Index_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("artslab  is selected and csv file is downloaded")
            return row_count - 1

    def community(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(4)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Community_Participation_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("Community  is selected and csv file is downloaded")
            return row_count - 1

    def Enrollment(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(5)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Enrollment_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("Enrollment  is selected and csv file is downloaded")
            return row_count - 1

    def grant_expenditure(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(6)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Grant_Expenditure_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("Grant expenditure is selected and csv file is downloaded")
            return row_count - 1

    def ictlab(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(7)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_ICT_Lab_Index_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("ICTlab  is selected and csv file is downloaded")
            return row_count - 1

    def Medical(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(8)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Medical_Index_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("Medical is selected and csv file is downloaded")
            return row_count - 1

    def nsqf(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(9)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_NSQF_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("nsqf is selected and csv file is downloaded")
            return row_count - 1
    def policy(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(10)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Policy_Implementation_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("Policy is selected and csv file is downloaded")
            return row_count - 1

    def Safety(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(11)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Safety_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("Safety  is selected and csv file is downloaded")
            return row_count - 1

    def School_infrastructure(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(12)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_School_Infrastructure_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("School infrastructure is selected and csv file is downloaded")
            return row_count - 1

    def School_inspection(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(13)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_School_Inspection_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("school inspection  is selected and csv file is downloaded")
            return row_count - 1

    def School_perfomance(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(14)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_School_Performance_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("School performance is selected and csv file is downloaded")
            return row_count - 1

    def Science_lab(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(15)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Science_Lab_Index_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("Science lab is selected and csv file is downloaded")
            return row_count - 1

    def Teacher_profile(self):
        management = self.driver.find_element_by_id('nm').text
        management = management[16:].lower().strip()
        chooseinfra = Select(self.driver.find_element_by_id('choose_infra'))
        chooseinfra.select_by_index(16)
        self.cal.page_loading(self.driver)
        self.driver.find_element_by_id('download').click()
        time.sleep(2)
        p = pwd()
        self.filename = p.get_download_dir() + "/"+'UDISE_report_'+management+'_Teacher_Profile_allDistricts_'+self.cal.get_current_date()+'.csv'
        time.sleep(2)
        file = os.path.isfile(self.filename)
        if True != file:
            print('csv file not downloaded')
        else:
            row_count = 0
            with open(self.filename, 'rt')as f:
                reader = csv.reader(f)
                data = list(reader)
                row = len(data)
                row_count = row
            print("Teachers profile is selected and csv file is downloaded")
        chooseinfra.select_by_index(1)
        time.sleep(2)
        return row_count - 1

    def remove_csv(self):
        os.remove(self.filename)