def test_2_first_upgrades(self):
     driver = self.driver
     driver.get(self.base_url)
     ml = DamagePageSection(driver)
     club = ClubberPageSection(driver)
     evo = EvoPointPageSection(driver)
     header = StatsPage(driver)
     value = "01"
     upgrade = 0
     points = 0
     try:
         header.import_save()
         points = evo.get_evo_points()
         print "Number of available points: " + str(points)
     except IOError:
         pass
     age = str(evo.get_age()).lower()
     start_time = time.time()
     print "Current Age is " + age
     while age == "stone age":
         ml.click_egg()
         if (time.time() - start_time) > 30:
             points = evo.get_evo_points()
             print "Update! Number of available points: " + str(points)
             start_time = time.time()
         if points > 25:
             club.upgrade_sword(value, "a")
             points -= 25
         if points > 100 and upgrade == 0:
             evo.purchase_upgrades(value, "c")
             points -= 100
             upgrade += 1
         if points > 200 and upgrade == 1:
             evo.purchase_upgrades(value, "a")
             points -= 200
             upgrade += 1
         if points > 200 and upgrade == 2:
             evo.purchase_upgrades(value, "b")
             points -= 200
             upgrade += 1
         if points > 500 and upgrade == 3:
             evo.purchase_upgrades(value, "d")
             points -= 500
             upgrade += 1
         if upgrade == 4:
             age = str(evo.get_age()).lower()
     header.export_save()
 def test_5_upgrade_again(self):
     driver = self.driver
     driver.get(self.base_url)
     ml = DamagePageSection(driver)
     evo = EvoPointPageSection(driver)
     header = StatsPage(driver)
     club = ClubberPageSection(driver)
     value = "02"
     upgrade = 0
     try:
         header.import_save()
     except IOError:
         pass
     age = evo.get_age().lower()
     points = evo.get_evo_points()
     while age == "neolithic age":
         ml.click_egg()
         if points > 500 and upgrade == 0:
             club.upgrade_sword(value, "b")
             points -= 500
             upgrade += 1
             print upgrade
         if points > 1000 and upgrade == 3:
             evo.purchase_upgrades(value, "b")
             upgrade += 1
             points -= 1000
             print upgrade
         if points > 200 and upgrade == 1:
             evo.upgrade_barracks(value, "a")
             upgrade += 1
             points -= 200
             print upgrade
         if points > 400 and upgrade == 2:
             evo.upgrade_barracks(value, "b")
             upgrade += 1
             points -= 400
             print upgrade
         if points > 2500 and upgrade == 4:
             evo.purchase_upgrades(value, "c")
             upgrade += 1
             points -= 2500
         points = evo.get_evo_points()
         if upgrade == 5:
             age = evo.get_age().lower()
             print age
     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()