def test_8_buy_cavalry(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
     points = evo.get_evo_points()
     cost = club.get_cavalry_cost()
     owned = club.get_cavalry_owned()
     crit = time.time()
     start = time.time()
     while owned < 20:
         ml.click_egg()
         if(time.time() - crit) > 5:
             ml.click_critical()
             start = time.time()
         if(time.time() - start) > 30:
             while points > cost:
                 club.buy_cavalry()
                 points -= cost
                 owned += 1
                 cost = club.get_cavalry_cost()
         points = evo.get_evo_points()
     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()