39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
# hobo-manage tenant_command runscript shot_them_all.py -d hobo.fred.local.0d.be
|
|
#
|
|
# Take desktop/mobile shots of all themes from publik-base-theme, tailored for
|
|
# my local installation.
|
|
|
|
import os
|
|
import json
|
|
import time
|
|
from selenium import webdriver
|
|
from hobo.theme.utils import set_theme
|
|
from hobo.deploy.signals import notify_agents
|
|
import sys
|
|
|
|
if not os.path.exists('shots'):
|
|
os.mkdir('shots')
|
|
|
|
options = webdriver.ChromeOptions()
|
|
options.add_argument('headless')
|
|
browser = webdriver.Chrome(chrome_options=options)
|
|
|
|
themes_data = json.load(open('/home/fred/src/eo/publik-base-theme/themes.json'))
|
|
for theme in themes_data['themes']:
|
|
theme_id = theme['id']
|
|
sys.stderr.write("%-25s" % theme_id)
|
|
set_theme(theme_id)
|
|
notify_agents(None)
|
|
for i in range(20): # 20 seconds
|
|
sys.stderr.write('.')
|
|
time.sleep(1)
|
|
os.system('sudo service memcached restart')
|
|
browser.get('https://auquo.fred.local.0d.be/contactez-nous/inscription-sur-les-listes/')
|
|
browser.set_window_size(1200, 1000)
|
|
browser.save_screenshot('shots/%s-desktop.png' % theme_id)
|
|
browser.set_window_size(480, 1000)
|
|
browser.save_screenshot('shots/%s-mobile.png' % theme_id)
|
|
sys.stderr.write(u' 📸 \n')
|