Exemplo n.º 1
0
class xrayLogin(unittest.TestCase):
    def setUp(self):
        #set variables, load the browser
        logging.debug("Function Setup()")
        self.xray_url = 'https://sandbox.xpand-it.com/secure/Dashboard.jspa'
        self.xray_url = "https://sandbox.xpand-it.com/projects/TOOL1?selectedItem=com.xpandit.plugins.xray:test-panel"
        self.user = '******'
        self.password = "******"
        self.browser = "ff"
        #self.browser="chrome"
        logging.info("Launching browser -> %s" % self.browser)

    def tearDown(self):
        #close the browser
        logging.debug("Function tearDown()")

    # self.driver.close()

    def test_login(self):
        for z in range(1, 50):
            if self.browser == "ff":
                self.driver = webdriver.Firefox()
            else:
                self.driver = webdriver.Chrome()

            # classes used in this file
            self.loader = Page(self.driver)
            self.loginPage = LoginPage1(self.driver)
            self.logoutPage = LogoutPage(self.driver)
            logging.info("Test logging into Xray")
            logging.info("loading url %s" % self.xray_url)
            self.loader.open(self.xray_url)  #or this
            self.loginPage.login_with_valid_user(self.user, self.password)
            time.sleep(1)
            self.driver.close()
Exemplo n.º 2
0
class testLabLogin(unittest.TestCase):

    def setUp(self):
        # set variables, load the browser
        logging.info("Function Setup()")
        # the defaults
        self.url = "https://rhtoolnext.melioratestlab.com/testlab/"
        self.user = '******'
        self.password = "******"
        self.browser = "ff"
        self.myLoops = 5
        self.config_file = 'tests/toolnext.ini'

        # read file ini test params file from this folder to get parameters
        if os.path.isfile(self.config_file):
            config = ConfigParser.ConfigParser()
            config.read(self.config_file)
            sectionlist = config.sections()
            section = 'TESTLAB_TEST_PARAMS'
            self.testdatadict = {}
            if section in sectionlist:
                self.testdatadict = dict(config.items(section))
            logging.error(self.testdatadict)
            if 'loops' in self.testdatadict:
                self.myLoops = int(self.testdatadict['loops'])
            if 'user' in self.testdatadict:
                self.user = self.testdatadict['user']
            if 'password' in self.testdatadict:
                self.password = self.testdatadict['password']
            if 'url' in self.testdatadict:
                self.url = self.testdatadict['url']
            if 'browser' in self.testdatadict:
                self.browser = self.testdatadict['browser']

        logging.info("Launching browser -> %s" % self.browser)
        logging.info("Loading url %s" % self.url)
        logging.info("Looping %s times using id=%s and password=%s" % (str(self.myLoops), self.user, self.password))

    def tearDown(self):
        logging.debug("Function tearDown()")

    def test_login(self):
        for z in range(1, self.myLoops+1):
            if self.browser == "ff":
                self.driver = webdriver.Firefox()
            else:
                self.driver = webdriver.Chrome()

            # classes used in this file
            self.loader = Page(self.driver)
            self.loginPage = LoginPage1(self.driver)
            self.logoutPage = LogoutPage(self.driver)
            logging.info("Test logging into Testlab")
            logging.info("Loading url %s" % self.url)
            self.loader.open(self.url)
            self.loginPage.login_with_valid_userTL(self.user, self.password)
            time.sleep(1)
            logging.info("Closing browser")
            self.driver.close()
Exemplo n.º 3
0
class AuthTestCase(unittest.TestCase):
    def setUp(self):
        self.page = Page()
        self.page.open()

    def tearDown(self):
        self.page.close()

    def test_authentication(self):
        self.assertEqual(self.page.login(), conf.USERNAME)
Exemplo n.º 4
0
class codeBeamerLogin(unittest.TestCase):

    def setUp(self):
        #set variables, load the browser
        logging.info("Function Setup()")
        self.url = 'https://sandbox.xpand-it.com/secure/Dashboard.jspa'
        self.url = "https://codebeamer-devel.hosts.prod.upshift.rdu2.redhat.com:8443/cb/user"
        #the defaults
        self.user = '******'
        self.password = "******"
        self.browser="ff"
        self.myLoops = 5

        # read file ini test params file from this folder to get parameters
        if (os.path.isfile('toolnext.ini')):
            config = ConfigParser.ConfigParser()
            config.read('toolnext.ini')
            sectionlist = config.sections()
            section = 'CODEBEAMER_TEST_PARAMS'
            self.testdatadict = {}
            if section in sectionlist:
                self.testdatadict = dict(config.items(section))
            if ('loops' in self.testdatadict):
                self.myLoops = int(self.testdatadict['loops'])
            if ('user' in self.testdatadict):
                self.user = self.testdatadict['user']
            if ('password' in self.testdatadict):
                self.password = self.testdatadict['password']
            if ('url' in self.testdatadict):
                self.url = self.testdatadict['url']

        logging.info("Launching browser -> %s" % self.browser)
        logging.info("loading url %s" %self.url)
        logging.info("looping %s times using id=%s and password=%s" % (str(self.myLoops), self.user, self.password))
         
    def tearDown(self):
        #close the browser
        logging.debug("Function tearDown()")
       # self.driver.close()
        

    def test_login(self):
        homedir = os.path.expanduser('~')
        homedir = homedir + '//.mozilla//firefox//gu4j04of.default'

        for z in range(1,self.myLoops+1):
            profile = webdriver.FirefoxProfile(homedir)
            if self.browser == "ff":
                #self.driver = webdriver.Firefox()
                self.driver = webdriver.Firefox(firefox_profile=profile)
            else:
                self.driver = webdriver.Chrome()

            # classes used in this file
            self.loader = Page(self.driver)
            self.loginPage = LoginPage1(self.driver)
            self.logoutPage = LogoutPage(self.driver)
            logging.info("Test logging into Xray")
            logging.info("loading url %s" % self.url)
            self.timer1 = time.time()
            self.loader.open(self.url) #or this
            self.loginPage.login_with_valid_userCB(self.user, self.password, self.timer1)
            time.sleep(1)
            logging.info("Closing browser")
            self.driver.quit()
Exemplo n.º 5
0
class practiCreateTC(unittest.TestCase):

    def setUp(self):
        #set variables, load the browser
        logging.info("Function Setup()")
        self.url = 'https://prod.practitest.com/'
        self.url = "https://prod.practitest.com/"
        #the defaults
        self.user = '******'
        self.password = "******"
        self.browser="ff"
        self.myLoops = 5

        # read file ini test params file from this folder to get parameters
        if (os.path.isfile('toolnext.ini')):
            config = ConfigParser.ConfigParser()
            config.read('toolnext.ini')
            sectionlist = config.sections()
            section = 'PRACTITEST_TEST_PARAMS'
            self.testdatadict = {}
            if section in sectionlist:
                self.testdatadict = dict(config.items(section))
            if ('loops' in self.testdatadict):
                self.myLoops = int(self.testdatadict['loops'])
            if ('user' in self.testdatadict):
                self.user = self.testdatadict['user']
            if ('password' in self.testdatadict):
                self.password = self.testdatadict['password']
            if ('url' in self.testdatadict):
                self.url = self.testdatadict['url']

        logging.info("Launching browser -> %s" % self.browser)
        logging.info("loading url %s" %self.url)
        logging.info("looping %s times using id=%s and password=%s" % (str(self.myLoops), self.user, self.password))
         
    def tearDown(self):
        #close the browser
        logging.debug("Function tearDown()")
       # self.driver.close()
        

    def test_login(self):
        homedir = os.path.expanduser('~')
        for z in range(1,self.myLoops+1):
            if self.browser == "ff":
                self.driver = webdriver.Firefox()
            else:
                self.driver = webdriver.Chrome()


            #set title of test
            myTitle = datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y")
            myTitle = "test automagically created at %s" % myTitle
            # classes used in this file
            self.loader = Page(self.driver)
            self.loginPage = LoginPage1(self.driver)
            self.logoutPage = LogoutPage(self.driver)
            logging.info("Test logging into PractiTest")
            logging.info("loading url %s" % self.url)
            self.loader.open(self.url) #or this
            try:
                startloading = time.time()
                self.loginPage.login_with_valid_userPT(self.user, self.password)
                #time.sleep(1)
                self.loginPage.createTCPT(myTitle)
                #wait 10 seconds for success message
                while not ('success' in self.driver.page_source):
                    time.sleep(1)
                if ('success' in self.driver.page_source):
                    logging.info("%s created successfully" % myTitle)
                    ltime = str((time.time() - startloading))
                    logging.info("time to load PractiTest and Create a Test Case -> %s" % ltime)
                    with open("%s/LoginCreateTCtime.csv" % homedir, "a") as myfile:
                        myfile.write(time.ctime() + "," + ltime + "\n")
                else:
                    logging.info("test failed to create")

            except:
                logging.info("failed to login or create test case")

            logging.info("Closing browser")
            self.driver.quit()
Exemplo n.º 6
0
class practiTestLogin(unittest.TestCase):
    def setUp(self):
        #set variables, load the browser
        logging.info("Function Setup()")
        self.url = 'https://prod.practitest.com/'
        self.url = "https://prod.practitest.com/"
        #the defaults
        self.user = '******'
        self.password = "******"
        self.browser = "ff"
        self.myLoops = 5

        # read file ini test params file from this folder to get parameters
        if (os.path.isfile('toolnext.ini')):
            config = ConfigParser.ConfigParser()
            config.read('toolnext.ini')
            sectionlist = config.sections()
            section = 'PRACTITEST_TEST_PARAMS'
            self.testdatadict = {}
            if section in sectionlist:
                self.testdatadict = dict(config.items(section))
            if ('loops' in self.testdatadict):
                self.myLoops = int(self.testdatadict['loops'])
            if ('user' in self.testdatadict):
                self.user = self.testdatadict['user']
            if ('password' in self.testdatadict):
                self.password = self.testdatadict['password']
            if ('url' in self.testdatadict):
                self.url = self.testdatadict['url']

        logging.info("Launching browser -> %s" % self.browser)
        logging.info("loading url %s" % self.url)
        logging.info("looping %s times using id=%s and password=%s" %
                     (str(self.myLoops), self.user, self.password))

    def tearDown(self):
        #close the browser
        logging.debug("Function tearDown()")

    # self.driver.close()

    def test_login(self):
        for z in range(1, self.myLoops + 1):
            if self.browser == "ff":
                self.driver = webdriver.Firefox()
            else:
                self.driver = webdriver.Chrome()

            # classes used in this file
            self.loader = Page(self.driver)
            self.loginPage = LoginPage1(self.driver)
            self.logoutPage = LogoutPage(self.driver)
            logging.info("Test logging into PractiTest")
            logging.info("loading url %s" % self.url)
            self.loader.open(self.url)  #or this
            try:
                self.loginPage.login_with_valid_userPT(self.user,
                                                       self.password)
                #time.sleep(1)
            except:
                logging.info("failed to login")

            logging.info("Closing browser")
            self.driver.quit()