Skip to content

Commit

Permalink
👷 remake ci test (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaixinol authored Nov 20, 2023
1 parent 7e00e86 commit d99212f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install Chrome
run: |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
wget -O chrome-linux64.zip `curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq -r '.channels.Stable.downloads.chromedriver[0].url'`
wget -O chromedriver-linux64.zip `curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json | jq -r '.channels.Stable.downloads.chromedriver[0].url'`
sudo rm -rf /usr/bin/chromedriver
sudo mkdir /usr/bin/chromedriver
sudo unzip chromedriver-linux64.zip -d /usr/bin/chromedriver
Expand Down
25 changes: 11 additions & 14 deletions tests/CI.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,25 @@
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.common.by import By

from twitter_user_tweet_crawler.tweet import Tweet
from twitter_user_tweet_crawler.browser import get_browser
from twitter_user_tweet_crawler.util.config import config


def get_browser() -> WebDriver:
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--blink-settings=imagesEnabled=false')
chrome_options.add_argument('--disable-remote-fonts')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
driver = webdriver.Chrome(options=chrome_options)
return driver
config.load({"proxy": None, "max_threads": 2,
"header": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, "
"like Gecko) "}
, "inject_js": "script.js",
}
)


class TestCase(unittest.TestCase):
def test_spider(self):
browser = get_browser()
browser = get_browser(headless=True)
browser.get('https://twitter.com/_CASTSTATION/status/1697029186777706544')
sleep(20)
element = browser.find_element(By.XPATH,"//*[contains(text(), '{}')]".format('miku miku oo ee oo'))
element = browser.find_element(By.XPATH, "//*[contains(text(), '{}')]".format('miku miku oo ee oo'))
browser.save_screenshot('debug.png')
self.assertIn('miku miku oo ee oo',element.get_attribute('innerHTML'))
self.assertIn('miku miku oo ee oo', element.get_attribute('innerHTML'))


if __name__ == '__main__':
Expand Down

0 comments on commit d99212f

Please sign in to comment.