Import - Improved Wachete Excel XLS import support for "dynamic wachet" (sets correct state of using chrome browser or not) column (#1934)

pull/1942/head
Jai Gupta 1 year ago committed by GitHub
parent 47103d7f3d
commit d3c8386874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -171,10 +171,12 @@ class import_xlsx_wachete(Importer):
data[column_title] = cell.value data[column_title] = cell.value
# Forced switch to webdriver/playwright/etc # Forced switch to webdriver/playwright/etc
dynamic_wachet = str(data.get('dynamic wachet')).strip().lower() # Convert bool to str to cover all cases dynamic_wachet = str(data.get('dynamic wachet', '')).strip().lower() # Convert bool to str to cover all cases
# libreoffice and others can have it as =FALSE() =TRUE(), or bool(true) # libreoffice and others can have it as =FALSE() =TRUE(), or bool(true)
if 'true' in dynamic_wachet or dynamic_wachet == '1': if 'true' in dynamic_wachet or dynamic_wachet == '1':
extras['fetch_backend'] = 'html_webdriver' extras['fetch_backend'] = 'html_webdriver'
elif 'false' in dynamic_wachet or dynamic_wachet == '0':
extras['fetch_backend'] = 'html_requests'
if data.get('xpath'): if data.get('xpath'):
# @todo split by || ? # @todo split by || ?

@ -151,7 +151,7 @@ def test_import_custom_xlsx(client, live_server):
follow_redirects=True, follow_redirects=True,
) )
assert b'3 imported from custom .xlsx' in res.data assert b'4 imported from custom .xlsx' in res.data
# Because this row was actually just a header with no usable URL, we should get an error # Because this row was actually just a header with no usable URL, we should get an error
assert b'Error processing row number 1' in res.data assert b'Error processing row number 1' in res.data
@ -191,7 +191,7 @@ def test_import_watchete_xlsx(client, live_server):
follow_redirects=True, follow_redirects=True,
) )
assert b'3 imported from Wachete .xlsx' in res.data assert b'4 imported from Wachete .xlsx' in res.data
res = client.get( res = client.get(
url_for("index") url_for("index")
@ -206,10 +206,13 @@ def test_import_watchete_xlsx(client, live_server):
filters = watch.get('include_filters') filters = watch.get('include_filters')
assert filters[0] == '/html[1]/body[1]/div[4]/div[1]/div[1]/div[1]||//*[@id=\'content\']/div[3]/div[1]/div[1]||//*[@id=\'content\']/div[1]' assert filters[0] == '/html[1]/body[1]/div[4]/div[1]/div[1]/div[1]||//*[@id=\'content\']/div[3]/div[1]/div[1]||//*[@id=\'content\']/div[1]'
assert watch.get('time_between_check') == {'weeks': 0, 'days': 1, 'hours': 6, 'minutes': 24, 'seconds': 0} assert watch.get('time_between_check') == {'weeks': 0, 'days': 1, 'hours': 6, 'minutes': 24, 'seconds': 0}
assert watch.get('fetch_backend') == 'system' # always uses default assert watch.get('fetch_backend') == 'html_requests' # Has inactive 'dynamic wachet'
if watch.get('title') == 'JS website': if watch.get('title') == 'JS website':
assert watch.get('fetch_backend') == 'html_webdriver' # Has active 'dynamic wachet' assert watch.get('fetch_backend') == 'html_webdriver' # Has active 'dynamic wachet'
if watch.get('title') == 'system default website':
assert watch.get('fetch_backend') == 'system' # uses default if blank
res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True) res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True)
assert b'Deleted' in res.data assert b'Deleted' in res.data

Loading…
Cancel
Save