Esempio n. 1
0
    def test_manager_login_with_invalid_username_and_valid_password(
            self, setup):
        self.logger.info(
            "********************Test manager Login With inValid Username And valid Password Started********************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)
        self.manager_login = ManagerLogin(self.driver)

        self.manager_login.setUserName(ReadConfig.getinvalidmanger_name())
        self.manager_login.setPassword(ReadConfig.getmanager_password())
        self.manager_login.clickLogin()
        if self.manager_login.getloginerror(
        ) == 'Incorrect Username/ Password. Please try again.':
            assert True
            self.logger.info(
                "********************Test manager Login With inValid Username And valid Password successfully getting error successfull********************************"
            )
            self.driver.close()
        else:
            self.driver.save_screenshot(
                "../Screenshots/" +
                "test_admin_login_with_valid_username_and_valid_password.png")
            self.logger.info(
                "******************** manager Login With inValid Username And valid Password logged ********************************"
            )
            self.driver.close()
Esempio n. 2
0
    def test_manager_login_with_valid_username_and_valid_password(self, setup):
        self.logger.info(
            "********************Test Admin Login With Valid Username And Password Started********************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)
        self.manager_login = ManagerLogin(self.driver)

        self.manager_login.setUserName(ReadConfig.getmanager_username())
        self.manager_login.setPassword(ReadConfig.getmanager_password())
        self.manager_login.clickLogin()

        # print(self.admin_login.title())
        if self.manager_login.getuserdisplay() == "Gvpalli Wind Farm":
            assert True
            self.logger.info(
                "********************Test manager Login With Valid Username And Password successfully login********************************"
            )

        else:
            self.driver.save_screenshot(
                "../Screenshots/" +
                "test_admin_login_with_valid_username_and_valid_password.png")
            self.logger.info(
                "******************** manager Login With Valid Username And Password Failed********************************"
            )
            self.driver.close()
Esempio n. 3
0
    def test_manager_dashboard(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.manager_dashboard = ManagerLogin(self.driver)
        self.manager_dashboard.setUserName(ReadConfig.getmanager_username())
        self.manager_dashboard.setPassword(ReadConfig.getmanager_password())
        self.manager_dashboard.clickLogin()

        if self.manager_dashboard.getuserdisplay() == "Gvpalli Wind Farm":
            assert True
            self.logger.info(
                "********************Test manager Login With Valid Username And Password successfully login********************************")

        else:
            self.driver.save_screenshot(
                "../Screenshots/" + "test_admin_login_with_valid_username_and_valid_password.png")
            self.logger.info(
                "******************** manager Login With Valid Username And Password Failed********************************")
            self.driver.close()
            assert False
        self.file = DirectoryPath()

        sample=self.manager_dashboard.getturbine_list()
        self.logger.info(sample)
        for i in sample:
            self.manager_dashboard.getTurbines(i)
            time.sleep(5)

            self.manager_dashboard.forecast_date(ReadConfig.get_forecast_date())
            self.manager_dashboard.windvariance_chart_submit()
            self.filename = self.file.get_download_dir() + '/' + self.manager_dashboard.list_turbine[i]+'_variance.csv'
            if os.path.isfile(self.filename):


                os.remove(self.filename)
            else:
                print('no file')
            self.manager_dashboard.windvariance_download()
            if os.path.isfile(self.filename):
                assert True
                self.logger.info(
                "**********************In manager {} dashboard Actual v/s Forecasted chart file downloaded succesfully*******************************".format(i))
            else:
                self.driver.save_screenshot(
                "../Screenshots/" + "{}_actual_forecast_downloaded.png".format(i))
                self.logger.info(
                "*************************In manager {} dashboard Actual v/s Forecasted chart file downloaded is failed*************************************".format(i))
                assert False

            df = pd.read_csv(self.filename)
            df_actual = df['Actual Power (KWh)'].sum()
            df_actual = int(df_actual)
            df_actual = str(df_actual)
            print(df_actual)
            df_forecast = df['Forecasted Power (KWh)'].sum()
            df_forecast = int(df_forecast)
            df_forecast = str(df_forecast)
            print(df_forecast)
            actual_power = self.manager_dashboard.total_actual_power_find()
            actual_power = actual_power.split(".")
            print(actual_power)
            forecast_power = self.manager_dashboard.total_forecast_list_power_find()
            forecast_power = forecast_power.split(".")
            print(forecast_power)
            if df_actual == actual_power[0]:
                assert True
                self.logger.info(
                "*************************downloaded {} actual and UI actual power generation are matched successfully****************".format(i))
            else:
                self.driver.save_screenshot(
                "../Screenshots/" + "{}_actualvsuiactual_downloaded.png".format(i))
                self.logger.info(
                "****************************downloaded  {} actual and UI actual power generation are not  matched ********************************".format(i))
                assert False
            self.filename = self.file.get_download_dir() + '/' + self.manager_dashboard.list_turbine[i]+'_forecasted.csv'
            if df_forecast == forecast_power[0]:
                assert True
                self.logger.info(
                "*************************downloaded {} forecast and UI forcast power generation are matched successfully****************".format(i))
            else:
                self.driver.save_screenshot(
                "../Screenshots/" + "{}_forecast_vs_uiforecast_downloaded.png".format(i))
                self.logger.info(
                "****************************downloaded  {} forecast and UI forecast power generation are not  matched ********************************".format(i))
                assert False
            if os.path.isfile(self.filename):

                os.remove((self.filename))
            else:
                print('no file')

            self.manager_dashboard.windform_forecast_button()
            self.manager_dashboard.wind_forecst_download()
            self.file = DirectoryPath()
            if os.path.isfile(self.filename):
                assert True
                self.logger.info(
                "**********************In manager {} dashboard 45 forecast file downloaded succesfully*******************************".format(i))
            else:
                self.driver.save_screenshot(
                "../Screenshots/" + "{}_forecast_45_downloaded.png".format(i))
                self.logger.info(
                "*************************In manager {} dashboard 45 forecast chart file downloaded is failed*************************************".format(i))
                assert False

            self.manager_dashboard.getbackbtn()
            if self.manager_dashboard.getuserdisplay() == "Gvpalli Wind Farm":
                assert True
                self.logger.info(
                "********************back to windform Page successfully********************************")
                self.logger.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")


            else:
                self.driver.save_screenshot(
                "../Screenshots/" + "windform_page.png")
                self.logger.info(
                "******************** back to windform Page failed********************************")
                self.logger.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")

                assert False
class Test_Manager_dashboard:
    baseURL = ReadConfig.getApplicationURL()
    manager_username = ReadConfig.getmanager_username()
    manager_password = ReadConfig.getmanager_password()
    logger = managerLogGen.logen()

    def test_manager_dashboard(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.manager_dashboard = ManagerLogin(self.driver)
        self.manager_dashboard.setUserName(ReadConfig.getmanager_username())
        self.manager_dashboard.setPassword(ReadConfig.getmanager_password())
        self.manager_dashboard.clickLogin()
        self.files = DirectoryPath()
        if self.manager_dashboard.getuserdisplay() == "Gvpalli Wind Farm":
            assert True
            self.logger.info(
                "********************Test manager Login With Valid Username And Password successfully login********************************"
            )

            self.manager_dashboard.forecast_date(
                ReadConfig.get_forecast_date())
            # self.manager_dashboard.start_date(ReadConfig.get_start_date())
            # self.manager_dashboard.end_date(ReadConfig.get_end_date())
            self.manager_dashboard.windvariance_chart_submit()
            self.filename = self.files.get_download_dir(
            ) + '/' + self.manager_dashboard.gpalli_variance_csv
            if os.path.isfile(self.filename):

                os.remove((self.filename))
            else:
                print('no file')
            self.manager_dashboard.windvariance_download()

            if os.path.isfile(self.filename):
                assert True
                self.logger.info(
                    "**********************In manager dashboard Actual v/s Forecasted chart file downloaded succesfully*******************************"
                )
            else:
                self.driver.save_screenshot("../Screenshots/" +
                                            "actual_forecast_downloaded.png")
                self.logger.info(
                    "*************************In manager dashboard Actual v/s Forecasted chart file downloaded is failed*************************************"
                )
                assert False
            df = pd.read_csv(
                r'C:\Users\sanjeev\PycharmProjects\AtriaTesting-2.0\Downloads\gvpalli_variance.csv'
            )
            df_actual = df['Actual Power (MWh)'].sum()
            df_actual = str(df_actual)
            df_forecast = df['Forecasted Power (MWh)'].sum()
            df_forecast = str(df_forecast)
            actual_power = self.manager_dashboard.total_actual_power_find()
            actual_power = actual_power.split(" ")
            forecast_power = self.manager_dashboard.total_forecast_power_find()
            forecast_power = forecast_power.split(" ")

            if df_actual == actual_power[0]:
                assert True
                self.logger.info(
                    "*************************downloaded actual and UI actual power generation are matched successfully****************"
                )
            else:
                self.driver.save_screenshot("../Screenshots/" +
                                            "actualvsuiactual_downloaded.png")
                self.logger.info(
                    "****************************downloaded actual and UI actual power generation are not  matched ********************************"
                )
                assert False

            if df_forecast == forecast_power[0]:
                assert True
                self.logger.info(
                    "*************************downloaded forecast and UI forcast power generation are matched successfully****************"
                )
            else:
                self.driver.save_screenshot(
                    "../Screenshots/" +
                    "forecast_vs_uiforecast_downloaded.png")
                self.logger.info(
                    "****************************downloaded forecast and UI forecast power generation are not  matched ********************************"
                )
                assert False

            if os.path.isfile('gvpalli_forecasted.csv'):

                os.remove((
                    r'C:\Users\sanjeev\PycharmProjects\AtriaTesting-2.0\Downloads\gvpalli_forecasted.csv'
                ))
            else:
                print('no file')

            self.manager_dashboard.windform_forecast_button()
            self.manager_dashboard.wind_forecst_download()
            self.file = DirectoryPath()
            self.filename = self.file.get_download_dir(
            ) + '/' + self.manager_dashboard.gvpalli_forecasted_csv
            df = pd.read_csv(self.filename)
            df_forecast_45 = df['Forecasted Power (MWh)'].sum()
            df_forecast_45 = str(df_forecast_45)
            forecast_45_power = self.manager_dashboard.windform_future_45_forecast(
            )
            forecast_45_power = forecast_45_power.split(" ")
            if df_forecast_45 == forecast_45_power[0]:
                assert True
                self.logger.info(
                    "*************************downloaded 45_forecast and UI 45_forcast power generation are matched successfully****************"
                )
            else:
                self.driver.save_screenshot(
                    "../Screenshots/" +
                    "45forecast_vs_ui_45forecast_downloaded.png")
                self.logger.info(
                    "****************************downloaded 45_forecast and UI 45_forecast power generation are not  matched ********************************"
                )
                assert False
            if os.path.isfile(
                    r'C:\Users\sanjeev\PycharmProjects\AtriaTesting-2.0\Downloads\gvpalli_forecasted.csv'
            ):

                os.remove(self.filename)
            else:
                print('no file')

            self.manager_dashboard.windform_forecast_date(
                ReadConfig.get_future_forecast_date())
            self.manager_dashboard.windform_forecast_button()

            self.manager_dashboard.wind_forecst_download()
            self.file = DirectoryPath()
            self.filename = self.file.get_download_dir(
            ) + '/' + self.manager_dashboard.gvpalli_forecasted_csv
            if os.path.isfile(self.filename):
                assert True
                self.logger.info(
                    "**********************In manager dashboard 45 forecast file downloaded succesfully*******************************"
                )
            else:
                self.driver.save_screenshot("../Screenshots/" +
                                            "forecast_45_downloaded.png")
                self.logger.info(
                    "*************************In manager dashboard 45 forecast chart file downloaded is failed*************************************"
                )
                assert False

        else:
            self.driver.save_screenshot(
                "../Screenshots/" +
                "test_admin_login_with_valid_username_and_valid_password.png")
            self.logger.info(
                "******************** manager Login With Valid Username And Password Failed********************************"
            )
            self.driver.close()
            assert False
Esempio n. 5
0
class Test_Manager_comment_section:
    baseURL = ReadConfig.getApplicationURL()
    manager_username = ReadConfig.getmanager_username()
    manager_password = ReadConfig.getmanager_password()
    logger = managerLogGen.logen()

    def test_manager_dashboard(self, setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.manager_dashboard = ManagerLogin(self.driver)
        self.manager_dashboard.setUserName(ReadConfig.getmanager_username())
        self.manager_dashboard.setPassword(ReadConfig.getmanager_password())
        self.manager_dashboard.clickLogin()
        if self.manager_dashboard.getuserdisplay() == "Gvpalli Wind Farm":
            assert True
            self.logger.info(
                "********************Test manager Login With Valid Username And Password successfully login********************************"
            )
            self.manager_dashboard.commentclick()

            print(self.manager_dashboard.comment_window_check())
            if self.manager_dashboard.comment_window_check(
            ) == 'Comments History':
                assert True
                self.logger.info(
                    "********comment window opened successfully********************"
                )
            else:
                self.driver.save_screenshot("../Screenshots/" +
                                            "comment_window_open.png")
                self.logger.info(
                    "*********************comment_window_opened_failed")

            self.manager_dashboard.comment_add(ReadConfig.getcomment_add())
            self.manager_dashboard.submit_button()
            if self.manager_dashboard.comment_message() == 'Message : sample':
                assert True
                self.logger.info(
                    "********************commented succesfully********************************"
                )
            else:
                self.driver.save_screenshot("../Screenshots/" +
                                            "comment_window.png")
                self.logger.info(
                    "*********************commenting is failed************")
            self.manager_dashboard.comment_edit_button()
            self.manager_dashboard.comment_edit_input(
                ReadConfig.getedit_input())
            self.manager_dashboard.update_comment()
            if self.manager_dashboard.updated_check(
            ) == 'Message : sample updated':
                self.logger.info(
                    "********************comment updated succesfully********************************"
                )
            else:
                self.driver.save_screenshot("../Screenshots/" +
                                            "updated_comment.png")
                self.logger.info(
                    "********************* updated commenting is failed************"
                )
            self.manager_dashboard.delete_comment_cancel()
            if self.manager_dashboard.updated_check(
            ) == 'Message : sample updated':
                self.logger.info(
                    "******************** deletion cancellation the comment is succesfully********************************"
                )
            else:
                self.driver.save_screenshot("../Screenshots/" +
                                            "delete_comment.png")
                self.logger.info(
                    "*********************deletion cancellation the comment is  failed************"
                )

            self.manager_dashboard.delete_comment_ok()
            if self.manager_dashboard.updated_check(
            ) != 'Message : sample updated':
                self.logger.info(
                    "******************** deleted the comment is succesfully********************************"
                )
            else:
                self.driver.save_screenshot("../Screenshots/" +
                                            "delete_comment.png")
                self.logger.info(
                    "********************* deleted the comment  is failed************"
                )

        else:
            self.driver.save_screenshot(
                "../Screenshots/" +
                "test_admin_login_with_valid_username_and_valid_password.png")
            self.logger.info(
                "******************** manager Login With Valid Username And Password Failed********************************"
            )
            self.driver.close()
Esempio n. 6
0
class Test_Manager_Login:
    baseURL = ReadConfig.getApplicationURL()
    manager_username = ReadConfig.getmanager_username()
    manager_password = ReadConfig.getmanager_password()
    logger = managerLogGen.logen()

    ## case1: go to the url
    def test_manager_login_page(self, setup):
        self.logger.info(
            "********************Test Manager Login Started********************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)
        actual_title = self.driver.title
        if actual_title == "Atria WindPower":
            assert True
            self.driver.close()
            self.logger.info(
                "********************Test Manager Login Ended********************************"
            )
        else:
            self.driver.save_screenshot("../Screenshots/" +
                                        "manager_test_login_title.png")
            self.driver.close()
            self.logger.info(
                "********************manager Admin Login Ended Due to difference in the title********************************"
            )
            assert False

## login with valid username and password

    def test_manager_login_with_valid_username_and_valid_password(self, setup):
        self.logger.info(
            "********************Test Admin Login With Valid Username And Password Started********************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)
        self.manager_login = ManagerLogin(self.driver)

        self.manager_login.setUserName(ReadConfig.getmanager_username())
        self.manager_login.setPassword(ReadConfig.getmanager_password())
        self.manager_login.clickLogin()

        # print(self.admin_login.title())
        if self.manager_login.getuserdisplay() == "Gvpalli Wind Farm":
            assert True
            self.logger.info(
                "********************Test manager Login With Valid Username And Password successfully login********************************"
            )

        else:
            self.driver.save_screenshot(
                "../Screenshots/" +
                "test_admin_login_with_valid_username_and_valid_password.png")
            self.logger.info(
                "******************** manager Login With Valid Username And Password Failed********************************"
            )
            self.driver.close()
##login with valid username and invalid password

    def test_manager_login_with_valid_username_and_invalid_password(
            self, setup):
        self.logger.info(
            "********************Test manager Login With Valid Username And invalid Password Started********************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)
        self.manager_login = ManagerLogin(self.driver)

        self.manager_login.setUserName(ReadConfig.getmanager_username())
        self.manager_login.setPassword(ReadConfig.getinvalidmanager_password())
        self.manager_login.clickLogin()
        if self.manager_login.getloginerror(
        ) == 'Incorrect Username/ Password. Please try again.':
            assert True
            self.logger.info(
                "********************Test manager Login With Valid Username And invalid Password successfully getting error successfull********************************"
            )
            self.driver.close()
        else:
            self.driver.save_screenshot(
                "../Screenshots/" +
                "test_admin_login_with_valid_username_and_valid_password.png")
            self.logger.info(
                "******************** manager Login With Valid Username And invalid Password Failed********************************"
            )
            self.driver.close()
##login with invalid username and valid password

    def test_manager_login_with_invalid_username_and_valid_password(
            self, setup):
        self.logger.info(
            "********************Test manager Login With inValid Username And valid Password Started********************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)
        self.manager_login = ManagerLogin(self.driver)

        self.manager_login.setUserName(ReadConfig.getinvalidmanger_name())
        self.manager_login.setPassword(ReadConfig.getmanager_password())
        self.manager_login.clickLogin()
        if self.manager_login.getloginerror(
        ) == 'Incorrect Username/ Password. Please try again.':
            assert True
            self.logger.info(
                "********************Test manager Login With inValid Username And valid Password successfully getting error successfull********************************"
            )
            self.driver.close()
        else:
            self.driver.save_screenshot(
                "../Screenshots/" +
                "test_admin_login_with_valid_username_and_valid_password.png")
            self.logger.info(
                "******************** manager Login With inValid Username And valid Password logged ********************************"
            )
            self.driver.close()
##login with invalid username and invalid password

    def test_manager_login_with_invalid_username_and_invalid_password(
            self, setup):
        self.logger.info(
            "********************Test manager Login With inValid Username And invalid Password Started********************************"
        )
        self.driver = setup
        self.driver.get(self.baseURL)
        self.manager_login = ManagerLogin(self.driver)

        self.manager_login.setUserName(ReadConfig.getinvalidmanger_name())
        self.manager_login.setPassword(ReadConfig.getmanager_password())
        self.manager_login.clickLogin()
        if self.manager_login.getloginerror(
        ) == 'Incorrect Username/ Password. Please try again.':
            assert True
            self.logger.info(
                "********************Test manager Login With inValid Username And invalid Password successfully getting error successfull********************************"
            )
            self.driver.close()
        else:
            self.driver.save_screenshot(
                "../Screenshots/" +
                "test_manager_login_with_invalid_username_and_invalid_password.png"
            )
            self.logger.info(
                "******************** manager Login With inValid Username And invalid Password logged ********************************"
            )
            self.driver.close()