import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class TestUntitled():
  def setup_method(self, method):
    self.driver = webdriver.Firefox()
    self.vars = {}
  
  def teardown_method(self, method):
    self.driver.quit()
  
  def test_untitled(self):
    self.driver.get("http://dev-videostudio.bilibili.com/studio/before-effects")
    self.driver.set_window_size(1920, 1080)
    self.driver.find_element(By.CSS_SELECTOR, ".add_plus > img").click()
    self.driver.find_element(By.CSS_SELECTOR, ".alertbtn:nth-child(2)").click()
    self.driver.find_element(By.CSS_SELECTOR, ".body_works:nth-child(2) .image").click()
    element = self.driver.find_element(By.CSS_SELECTOR, ".video-item:nth-child(11) .resource-item-cover-img")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).click_and_hold().perform()
    element = self.driver.find_element(By.CSS_SELECTOR, ".video-item:nth-child(11) .resource-item-cover-img")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).perform()
    element = self.driver.find_element(By.CSS_SELECTOR, ".video-item:nth-child(11) .resource-item-cover-img")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).release().perform()
    self.driver.find_element(By.CSS_SELECTOR, ".video-item:nth-child(11) .resource-item-cover-img").click()
    element = self.driver.find_element(By.CSS_SELECTOR, ".empty-track-block")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).click_and_hold().perform()
    element = self.driver.find_element(By.CSS_SELECTOR, ".empty-track-block")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).perform()
    element = self.driver.find_element(By.CSS_SELECTOR, ".empty-track-block")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).release().perform()
    self.driver.find_element(By.CSS_SELECTOR, ".main-container").click()
    element = self.driver.find_element(By.ID, "track-item-body-2")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).click_and_hold().perform()
    element = self.driver.find_element(By.ID, "track-item-body-2")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).perform()
    element = self.driver.find_element(By.ID, "track-item-body-2")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).release().perform()
    self.driver.find_element(By.ID, "track-item-body-2").click()
    element = self.driver.find_element(By.ID, "track-item-body-2")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).click_and_hold().perform()
    element = self.driver.find_element(By.ID, "track-item-body-2")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).perform()
    element = self.driver.find_element(By.ID, "track-item-body-2")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).release().perform()
    self.driver.find_element(By.ID, "track-item-body-2").click()
    element = self.driver.find_element(By.ID, "track-item-body-2")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).click_and_hold().perform()
    element = self.driver.find_element(By.ID, "track-item-body-2")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).perform()
    element = self.driver.find_element(By.ID, "track-item-body-2")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).release().perform()
    self.driver.find_element(By.ID, "track-item-body-2").click()
    element = self.driver.find_element(By.CSS_SELECTOR, ".wrap")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).click_and_hold().perform()
    element = self.driver.find_element(By.CSS_SELECTOR, ".wrap")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).perform()
    element = self.driver.find_element(By.CSS_SELECTOR, ".wrap")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).release().perform()
    self.driver.find_element(By.CSS_SELECTOR, ".right > .cut-control-btn:nth-child(3) > img").click()
    self.driver.find_element(By.CSS_SELECTOR, ".right > .cut-control-btn:nth-child(4) > img").click()
    self.driver.find_element(By.CSS_SELECTOR, ".control-progress > .cut-control-btn > img").click()
    self.driver.find_element(By.CSS_SELECTOR, ".control-progress > .cut-control-btn > img").click()
    self.driver.find_element(By.CSS_SELECTOR, ".upper-canvas").click()
    self.driver.find_element(By.CSS_SELECTOR, ".selector-wrapper:nth-child(3) .icon-drop-down").click()
    self.driver.find_element(By.CSS_SELECTOR, ".selector-wrapper:nth-child(3) li:nth-child(2)").click()
    element = self.driver.find_element(By.CSS_SELECTOR, ".editor-bar:nth-child(2) .font-size-slider")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).click_and_hold().perform()
    element = self.driver.find_element(By.CSS_SELECTOR, ".editor-bar:nth-child(2) .font-size-slider")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).perform()
    element = self.driver.find_element(By.CSS_SELECTOR, ".editor-bar:nth-child(2) .font-size-slider")
    actions = ActionChains(self.driver)
    actions.move_to_element(element).release().perform()
    self.driver.find_element(By.CSS_SELECTOR, ".editor-bar:nth-child(2) .font-size-slider").click()
    self.driver.find_element(By.CSS_SELECTOR, ".editor-bar:nth-child(2) .input-num").click()
    self.driver.find_element(By.CSS_SELECTOR, ".editor-bar:nth-child(2) .input-num").send_keys("10")
    self.driver.find_element(By.CSS_SELECTOR, ".editor-bar:nth-child(2) .input-num").send_keys(Keys.ENTER)
  
