def test_1_buy_clubbers(self):
     driver = self.driver
     driver.get(self.base_url)
     ml = DamagePageSection(driver)
     club = ClubberPageSection(driver)
     evo = EvoPointPageSection(driver)
     header = StatsPage(driver)
     max_allowed = 0
     points = 0
     m_cost = club.get_clubber_cost()
     # testing still
     try:
         header.import_save()
         driver.refresh()
         max_allowed = club.get_clubber_owned()
         print str(max_allowed) + " close-range fighters owned."
         points = evo.get_evo_points()
     except IOError:
         print "There is no data to import yet."
     club.waiting()
     start_time = time.time()
     while max_allowed < 10:
         ml.click_egg()
         while points > m_cost:
             club.buy_clubber()
             points -= m_cost
             m_cost = club.get_clubber_cost()
             print str(m_cost) + " evo to buy new unit."
             max_allowed += 1
             print str(max_allowed) + " total units owned"
         if (time.time() - start_time) > 30:
             points = evo.get_evo_points()
             print str(points) + " are available to spend."
             start_time = time.time()
     header.export_save()
 def test_6_more_units(self):
     driver = self.driver
     driver.get(self.base_url)
     ml = DamagePageSection(driver)
     evo = EvoPointPageSection(driver)
     header = StatsPage(driver)
     club = ClubberPageSection(driver)
     try:
         header.import_save()
     except IOError:
         pass
     m_cost = club.get_clubber_cost()
     r_cost = club.get_ranged_cost()
     s_cost = evo.get_scholar_cost()
     m_count = club.get_clubber_owned()
     r_count = club.get_ranged_owned()
     s_count = evo.get_scholar_owned()
     max_unit = 30
     start = time.time()
     upgrade = 0
     horse = 0
     crit = time.time()
     while horse < 1:
         ml.click_egg()
         if (time.time() - crit) > 5:
             ml.click_critical()
             crit = time.time()
         while m_count < 30 or r_count < 30 or s_count < 30 or upgrade < 2:
             ml.click_egg()
             if (time.time() - crit) > 5:
                 ml.click_critical()
                 crit = time.time()
             if (time.time() - start) > 60:
                 points = evo.get_evo_points()
                 if points > 2500 and upgrade == 0:
                     club.upgrade_sword("03", "a")
                     points -= 2500
                     upgrade += 1
                 if points > 10000 and upgrade == 1:
                     club.upgrade_sword("03", "b")
                     points -= 10000
                     upgrade += 1
                 while points > m_cost and m_count < max_unit:
                     club.buy_clubber()
                     m_count += 1
                     points -= m_cost
                     m_cost = club.get_clubber_cost()
                 while points > r_cost and r_count < max_unit:
                     club.buy_ranged_unit()
                     r_count += 1
                     points -= r_cost
                     print points
                     r_cost = club.get_ranged_cost()
                 while points > s_cost and s_count < max_unit:
                     evo.buy_scholar()
                     s_count += 1
                     points -= s_cost
                     print points
                     s_cost = evo.get_scholar_cost()
                 start = time.time()
         if (time.time() - start) > 30:
             points = evo.get_evo_points()
             if points > 10000:
                 evo.purchase_upgrades("03", "b")
                 horse += 1
     header.export_save()