* Cropped images for win, unblocked drop_pdf_file

* Unblocked drop_jpeg_image

* Changed 'drop_here' images, added private window logo

* drop_image_data, drop_image_data_in_private_window

* drop_jpeg_image

* drop_jpeg_image_in_private_window

* drop_pdf_file

* drop_pdf_file_in_private_window

* drop_png_image

* drop_png_image_in_private_window

* drop_txt_file

* drop_txt_file_in_private_window

* paste_image_data

* paste_jpeg_file

* paste... tests
This commit is contained in:
yeyartsev 2019-06-07 16:18:19 +03:00 коммит произвёл mwobensmith
Родитель e61ef5ac78
Коммит 659219d279
29 изменённых файлов: 450 добавлений и 113 удалений

Просмотреть файл

@ -1 +0,0 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Iris Control Center</title><link href="/static/css/1.5d846ed1.chunk.css" rel="stylesheet"><link href="/static/css/main.e962bb01.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={2:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="/static/js/1.ec131266.chunk.js"></script><script src="/static/js/main.a1895072.chunk.js"></script></body></html>

Просмотреть файл

@ -14,6 +14,7 @@ class Test(BaseTest):
test_case_id='165086', test_case_id='165086',
test_suite_id='102', test_suite_id='102',
preferences={'devtools.chrome.enabled': True}, preferences={'devtools.chrome.enabled': True},
blocked_by={'id': '1288773', 'platform': OSPlatform.ALL}
) )
def run(self, firefox): def run(self, firefox):
drop_image_data_radiobutton_selected_pattern = Pattern('drop_image_data_selected.png') drop_image_data_radiobutton_selected_pattern = Pattern('drop_image_data_selected.png')

Просмотреть файл

@ -13,14 +13,14 @@ class Test(BaseTest):
locale=['en-US'], locale=['en-US'],
test_case_id='165087', test_case_id='165087',
test_suite_id='102', test_suite_id='102',
set_profile_pref={'devtools.chrome.enabled': True}, preferences={'devtools.chrome.enabled': True},
blocked_by='change_preference, drag_drop, 1328964' blocked_by={'id': '1288773', 'platform': OSPlatform.ALL}
) )
def run(self, firefox): def run(self, firefox):
drop_image_data_radiobutton_selected_pattern = Pattern('drop_image_data_selected.png') drop_image_data_radiobutton_selected_pattern = Pattern('drop_image_data_selected.png')
drop_image_data_radiobutton_pattern = Pattern('drop_image_data.png') drop_image_data_radiobutton_pattern = Pattern('drop_image_data.png')
browser_console_title_pattern = Pattern('browser_console_title.png') browser_console_title_pattern = Pattern('browser_console_title.png')
iris_tab_favicon_pattern = Pattern('iris_tab.png') private_tab_logo_pattern = Pattern('private_window_logo.png')
drop_here_pattern = Pattern('drop_here.png') drop_here_pattern = Pattern('drop_here.png')
image_from_page_pattern = Pattern('image_from_wiki.png') image_from_page_pattern = Pattern('image_from_wiki.png')
link_from_page_pattern = Pattern('link.png') link_from_page_pattern = Pattern('link.png')
@ -28,30 +28,20 @@ class Test(BaseTest):
new_private_window() new_private_window()
if not Settings.is_mac(): private_window_opened = exists(PrivateWindow.private_window_pattern)
minimize_window() assert private_window_opened, 'Private window is opened'
iris_tab_location = find(iris_tab_favicon_pattern)
start_position = Location(Screen.SCREEN_WIDTH // 25, Screen.SCREEN_HEIGHT // 25)
drag_drop(iris_tab_location, start_position)
open_browser_console() private_tab_opened = exists(private_tab_logo_pattern)
console_opened = exists(browser_console_title_pattern) assert private_tab_opened, 'Private window is opened'
assert console_opened, 'Browser console opened'
click(browser_console_title_pattern)
paste('window.resizeTo({0}, {1})'.format(Screen.SCREEN_WIDTH * 0.45, Screen.SCREEN_HEIGHT * 0.9))
type(Key.ENTER)
close_tab()
navigate('https://mystor.github.io/dragndrop/') navigate('https://mystor.github.io/dragndrop/')
test_page_opened = exists(drop_image_data_radiobutton_pattern, Settings.DEFAULT_SITE_LOAD_TIMEOUT) test_page_opened = exists(drop_image_data_radiobutton_pattern, Settings.site_load_timeout)
assert test_page_opened, 'Firefox started and test page loaded successfully.' assert test_page_opened, 'Firefox started and test page loaded successfully.'
click(drop_image_data_radiobutton_pattern) click(drop_image_data_radiobutton_pattern)
drop_image_data_selected = exists(drop_image_data_radiobutton_selected_pattern) drop_image_data_selected = exists(drop_image_data_radiobutton_selected_pattern)
assert drop_image_data_selected, \ assert drop_image_data_selected, \
'The \'drop-image-data\' changed color to red which indicates that it has been selected.' 'The "drop-image-data" changed color to red which indicates that it has been selected.'
drop_result_message_displayed = scroll_until_pattern_found(not_matching_message_pattern, type, (Key.DOWN,)) drop_result_message_displayed = scroll_until_pattern_found(not_matching_message_pattern, type, (Key.DOWN,))
assert drop_result_message_displayed, \ assert drop_result_message_displayed, \
@ -59,7 +49,24 @@ class Test(BaseTest):
'to be displayed is present on the page after the scrolling' 'to be displayed is present on the page after the scrolling'
new_window() new_window()
opened_tab_location = find(Tabs.NEW_TAB_HIGHLIGHTED)
if not OSHelper.is_mac():
minimize_window()
open_browser_console()
console_opened = exists(browser_console_title_pattern)
assert console_opened, 'Browser console opened'
click(browser_console_title_pattern)
paste('window.resizeTo({0}, {1})'.format(Screen.SCREEN_WIDTH * 9 // 20, Screen.SCREEN_HEIGHT * 9 // 10))
type(Key.ENTER)
close_tab()
new_window_opened = exists(Tabs.NEW_TAB_HIGHLIGHTED)
assert new_window_opened, 'New window is opened'
opened_tab_location = find(Tabs.NEW_TAB_HIGHLIGHTED).right(Screen.SCREEN_WIDTH // 4)
new_window_drop_location = Location(Screen.SCREEN_WIDTH * 11 // 20, Screen.SCREEN_HEIGHT // 20) new_window_drop_location = Location(Screen.SCREEN_WIDTH * 11 // 20, Screen.SCREEN_HEIGHT // 20)
drag_drop(opened_tab_location, new_window_drop_location) drag_drop(opened_tab_location, new_window_drop_location)
@ -70,19 +77,19 @@ class Test(BaseTest):
navigate(LocalWeb.SOAP_WIKI_TEST_SITE) navigate(LocalWeb.SOAP_WIKI_TEST_SITE)
page_loaded = exists(image_from_page_pattern, Settings.DEFAULT_SITE_LOAD_TIMEOUT) page_loaded = exists(image_from_page_pattern, Settings.DEFAULT_SITE_LOAD_TIMEOUT)
assert page_loaded, \ assert page_loaded, \
'Wiki page loaded and contains an image that will be dropped into \'Drop stuff here\' area' 'Wiki page loaded and contains an image that will be dropped into "Drop stuff here" area'
drag_drop(image_from_page_pattern, drop_here_pattern) drag_drop(image_from_page_pattern, drop_here_pattern)
not_matching_message_appears = exists(not_matching_message_pattern) not_matching_message_appears = exists(not_matching_message_pattern)
assert not_matching_message_appears is False, \ assert not_matching_message_appears is False, \
'\'Matching\' appears under the \'Drop Stuff Here\' area, the expected result is ' \ '"Matching" appears under the "Drop Stuff Here" area, the expected result is ' \
'identical to result and the image is displayed lower in the page.' 'identical to result and the image is displayed lower in the page.'
link_displayed = exists(link_from_page_pattern) link_displayed = exists(link_from_page_pattern)
assert link_displayed, 'Wiki page contains link that will be dropped into \'Drop stuff here\' area' assert link_displayed, 'Wiki page contains link that will be dropped into "Drop stuff here" area'
drag_drop(link_from_page_pattern, drop_here_pattern) drag_drop(link_from_page_pattern, drop_here_pattern)
not_matching_message_appears = exists(not_matching_message_pattern) not_matching_message_appears = exists(not_matching_message_pattern)
assert not_matching_message_appears, '\'Not Matching\' appears under the Drop Stuff Here ' \ assert not_matching_message_appears, '"Not Matching" appears under the Drop Stuff Here ' \
'area, the expected result is different to result.' 'area, the expected result is different to result.'

Просмотреть файл

@ -6,7 +6,33 @@
from targets.firefox.fx_testcase import * from targets.firefox.fx_testcase import *
class Test(BaseTest): class Test(FirefoxTest):
def setup(self):
jpg_file_name = 'jpgimage.jpg'
png_file_name = 'pngimage.png'
jpg_copy_name = 'jpgimage_bak.jpg'
png_copy_name = 'pngimage_bak.png'
copies_directory_name = 'copies'
copied_jpg_file = os.path.join(copies_directory_name, jpg_copy_name)
copied_png_file = os.path.join(copies_directory_name, png_copy_name)
asset_dir = self.get_asset_path('')
copies_directory_path = os.path.join(asset_dir, copies_directory_name)
os.mkdir(copies_directory_path)
original_jpgfile_path = self.get_asset_path(jpg_file_name)
backup_jpgfile_path = self.get_asset_path(copied_jpg_file)
original_pngfile_path = self.get_asset_path(png_file_name)
backup_pngfile_path = self.get_asset_path(copied_png_file)
copy_file(original_jpgfile_path, backup_jpgfile_path)
copy_file(original_pngfile_path, backup_pngfile_path)
@pytest.mark.details( @pytest.mark.details(
description='Drop .jpeg image File in demopage', description='Drop .jpeg image File in demopage',
@ -14,8 +40,6 @@ class Test(BaseTest):
test_case_id='165084', test_case_id='165084',
test_suite_id='102', test_suite_id='102',
set_profile_pref={'devtools.chrome.enabled': True}, set_profile_pref={'devtools.chrome.enabled': True},
blocked_by='change_preference, drag_drop, 1328964'
) )
def run(self, firefox): def run(self, firefox):
library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON
@ -35,9 +59,9 @@ class Test(BaseTest):
file_type_all_files_pattern = Pattern('file_type_all_files.png') file_type_all_files_pattern = Pattern('file_type_all_files.png')
file_type_json_pattern = Pattern('file_type_json.png') file_type_json_pattern = Pattern('file_type_json.png')
DRAG_AND_DROP_DURATION = 3 drag_and_drop_duration = 3
PASTE_DELAY = 0.5 paste_delay = 0.5
folderpath = self.get_asset_path('') folderpath = self.get_asset_path('copies')
navigate('https://mystor.github.io/dragndrop/') navigate('https://mystor.github.io/dragndrop/')
@ -75,7 +99,7 @@ class Test(BaseTest):
width=library_title_width * 2, height=library_title_height * 3) width=library_title_width * 2, height=library_title_height * 3)
library_popup_tab_after = Location(Screen.SCREEN_WIDTH // 2, library_popup_tab_before.y) library_popup_tab_after = Location(Screen.SCREEN_WIDTH // 2, library_popup_tab_before.y)
drag_drop(library_popup_tab_before, library_popup_tab_after, duration=DRAG_AND_DROP_DURATION) drag_drop(library_popup_tab_before, library_popup_tab_after, duration=drag_and_drop_duration)
library_popup_dropped = exists(library_popup_pattern, region=library_tab_region_after) library_popup_dropped = exists(library_popup_pattern, region=library_tab_region_after)
assert library_popup_dropped, 'Library popup dropped to right half of screen successfully' assert library_popup_dropped, 'Library popup dropped to right half of screen successfully'
@ -104,7 +128,7 @@ class Test(BaseTest):
type('2', KeyModifier.CMD) # change view of finder type('2', KeyModifier.CMD) # change view of finder
else: else:
paste(folderpath) paste(folderpath)
type(Key.ENTER, interval=PASTE_DELAY) type(Key.ENTER, interval=paste_delay)
if OSHelper.is_linux(): if OSHelper.is_linux():
json_option_available = exists(file_type_json_pattern) json_option_available = exists(file_type_json_pattern)
@ -119,9 +143,9 @@ class Test(BaseTest):
else: else:
type('*') # Show all files in Windows Explorer type('*') # Show all files in Windows Explorer
type(Key.ENTER, interval=PASTE_DELAY) type(Key.ENTER, interval=paste_delay)
select_bookmark_popup_location_final = Location(Settings.SCREEN_WIDTH / 2, library_popup_tab_before.y) select_bookmark_popup_location_final = Location(Screen.SCREEN_WIDTH // 2, library_popup_tab_before.y)
# drag-n-drop right to prevent fails on osx # drag-n-drop right to prevent fails on osx
drag_drop(select_bookmark_popup_before.right(library_title_width), select_bookmark_popup_location_final) drag_drop(select_bookmark_popup_before.right(library_title_width), select_bookmark_popup_location_final)
@ -131,7 +155,7 @@ class Test(BaseTest):
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern is available' assert drop_here_available, '"Drop here" pattern is available'
drag_drop(jpg_bak_file_pattern, drop_here_pattern, duration=DRAG_AND_DROP_DURATION) drag_drop(jpg_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
matching_message_displayed = exists(matching_message_pattern, region=matching_region) matching_message_displayed = exists(matching_message_pattern, region=matching_region)
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected ' \ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected ' \
@ -143,7 +167,7 @@ class Test(BaseTest):
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern is available' assert drop_here_available, '"Drop here" pattern is available'
drag_drop(png_bak_file_pattern, drop_here_pattern, duration=DRAG_AND_DROP_DURATION) drag_drop(png_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region) not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region)
assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and ' \ assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and ' \
@ -152,3 +176,19 @@ class Test(BaseTest):
type(Key.ESC) type(Key.ESC)
close_tab() close_tab()
def teardown(self):
jpg_file_name = 'jpgimage_bak.jpg'
png_file_name = 'pngimage_bak.png'
copies_directory_name = 'copies'
jpg_backup_file = os.path.join(copies_directory_name, jpg_file_name)
png_backup_file = os.path.join(copies_directory_name, png_file_name)
jpg_backup_path = self.get_asset_path(jpg_backup_file)
png_backup_path = self.get_asset_path(png_backup_file)
copies_directory = self.get_asset_path(copies_directory_name)
delete_file(jpg_backup_path)
delete_file(png_backup_path)
os.rmdir(copies_directory)

Просмотреть файл

@ -6,7 +6,33 @@
from targets.firefox.fx_testcase import * from targets.firefox.fx_testcase import *
class Test(BaseTest): class Test(FirefoxTest):
def setup(self):
jpg_file_name = 'jpgimage.jpg'
png_file_name = 'pngimage.png'
jpg_copy_name = 'jpgimage_bak.jpg'
png_copy_name = 'pngimage_bak.png'
copies_directory_name = 'copies'
copied_pdf_file = os.path.join(copies_directory_name, jpg_copy_name)
copied_txt_file = os.path.join(copies_directory_name, png_copy_name)
asset_dir = self.get_asset_path('')
copies_directory_path = os.path.join(asset_dir, copies_directory_name)
os.mkdir(copies_directory_path)
original_pdffile_path = self.get_asset_path(jpg_file_name)
backup_pdffile_path = self.get_asset_path(copied_pdf_file)
original_txtfile_path = self.get_asset_path(png_file_name)
backup_txtfile_path = self.get_asset_path(copied_txt_file)
copy_file(original_pdffile_path, backup_pdffile_path)
copy_file(original_txtfile_path, backup_txtfile_path)
@pytest.mark.details( @pytest.mark.details(
description='Drop single and multiple .jpeg images in demopage opened in Private Window', description='Drop single and multiple .jpeg images in demopage opened in Private Window',
@ -14,8 +40,6 @@ class Test(BaseTest):
test_case_id='165085', test_case_id='165085',
test_suite_id='102', test_suite_id='102',
set_profile_pref={'devtools.chrome.enabled': True}, set_profile_pref={'devtools.chrome.enabled': True},
blocked_by='get_asset_path, drag_drop, 1328964'
) )
def run(self, firefox): def run(self, firefox):
library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON
@ -39,7 +63,7 @@ class Test(BaseTest):
drag_and_drop_duration = 3 drag_and_drop_duration = 3
paste_delay = 0.5 paste_delay = 0.5
folderpath = self.get_asset_path('') folderpath = self.get_asset_path('copies')
new_private_window() new_private_window()
@ -160,3 +184,20 @@ class Test(BaseTest):
type(Key.ESC) type(Key.ESC)
close_tab() close_tab()
close_tab() close_tab()
def teardown(self):
jpg_file_name = 'jpgimage_bak.jpg'
png_file_name = 'pngimage_bak.png'
copies_directory_name = 'copies'
jpg_backup_file = os.path.join(copies_directory_name, jpg_file_name)
png_backup_file = os.path.join(copies_directory_name, png_file_name)
jpg_backup_path = self.get_asset_path(jpg_backup_file)
png_backup_path = self.get_asset_path(png_backup_file)
copies_directory = self.get_asset_path(copies_directory_name)
delete_file(jpg_backup_path)
delete_file(png_backup_path)
os.rmdir(copies_directory)

Просмотреть файл

@ -8,13 +8,38 @@ from targets.firefox.fx_testcase import *
class Test(FirefoxTest): class Test(FirefoxTest):
def setup(self):
pdf_file_name = 'pdffile.pdf'
txt_file_name = 'testfile.txt'
pdf_copy_name = 'pdffile_bak.pdf'
txt_copy_name = 'testfile_bak.txt'
copies_directory_name = 'copies'
copied_pdf_file = os.path.join(copies_directory_name, pdf_copy_name)
copied_txt_file = os.path.join(copies_directory_name, txt_copy_name)
asset_dir = self.get_asset_path('')
copies_directory_path = os.path.join(asset_dir, copies_directory_name)
os.mkdir(copies_directory_path)
original_pdffile_path = self.get_asset_path(pdf_file_name)
backup_pdffile_path = self.get_asset_path(copied_pdf_file)
original_txtfile_path = self.get_asset_path(txt_file_name)
backup_txtfile_path = self.get_asset_path(copied_txt_file)
copy_file(original_pdffile_path, backup_pdffile_path)
copy_file(original_txtfile_path, backup_txtfile_path)
@pytest.mark.details( @pytest.mark.details(
description='Drop .pdf File in demopage', description='Drop .pdf File in demopage',
locale=['en-US'], locale=['en-US'],
test_case_id='165080', test_case_id='165080',
test_suite_id='102', test_suite_id='102',
set_profile_pref={'devtools.chrome.enabled': True}, set_profile_pref={'devtools.chrome.enabled': True},
blocked_by='change_preference, drag_drop, 270'
) )
def run(self, firefox): def run(self, firefox):
library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON
@ -29,14 +54,16 @@ class Test(FirefoxTest):
matching_message_pattern = Pattern('matching_message_precise.png') matching_message_pattern = Pattern('matching_message_precise.png')
pdf_bak_file_pattern = Pattern('pdf_bak_file.png') pdf_bak_file_pattern = Pattern('pdf_bak_file.png')
txt_bak_file_pattern = Pattern('txt_bak_file.png') txt_bak_file_pattern = Pattern('txt_bak_file.png')
file_type_json_pattern = None
file_type_all_files_pattern = None
if Settings.is_linux(): if OSHelper.is_linux():
file_type_all_files_pattern = Pattern('file_type_all_files.png') file_type_all_files_pattern = Pattern('file_type_all_files.png')
file_type_json_pattern = Pattern('file_type_json.png') file_type_json_pattern = Pattern('file_type_json.png')
DRAG_AND_DROP_DURATION = 3 drag_and_drop_duration = 2
PASTE_DELAY = 0.5 paste_delay = 0.5
folderpath = self.get_asset_path('') folderpath = self.get_asset_path('copies')
navigate('https://mystor.github.io/dragndrop/') navigate('https://mystor.github.io/dragndrop/')
@ -74,7 +101,7 @@ class Test(FirefoxTest):
width=library_title_width * 2, height=library_title_height * 3) width=library_title_width * 2, height=library_title_height * 3)
library_popup_tab_after = Location(Screen.SCREEN_WIDTH // 2, library_popup_tab_before.y) library_popup_tab_after = Location(Screen.SCREEN_WIDTH // 2, library_popup_tab_before.y)
drag_drop(library_popup_tab_before, library_popup_tab_after, duration=DRAG_AND_DROP_DURATION) drag_drop(library_popup_tab_before, library_popup_tab_after, duration=drag_and_drop_duration)
library_popup_dropped = exists(library_popup_pattern, region=library_tab_region_after) library_popup_dropped = exists(library_popup_pattern, region=library_tab_region_after)
assert library_popup_dropped, 'Library popup dropped to right half of screen successfully' assert library_popup_dropped, 'Library popup dropped to right half of screen successfully'
@ -97,16 +124,16 @@ class Test(FirefoxTest):
select_bookmark_popup_before = find(select_bookmark_popup_pattern) select_bookmark_popup_before = find(select_bookmark_popup_pattern)
if Settings.is_mac(): if OSHelper.is_mac():
type('g', modifier=KeyModifier.CMD + KeyModifier.SHIFT) # open folder in Finder type('g', modifier=KeyModifier.CMD + KeyModifier.SHIFT) # open folder in Finder
paste(folderpath) paste(folderpath)
type(Key.ENTER) type(Key.ENTER)
type('2', KeyModifier.CMD) # change view of finder type('2', KeyModifier.CMD) # change view of finder
else: else:
paste(folderpath) paste(folderpath)
type(Key.ENTER, interval=PASTE_DELAY) type(Key.ENTER, interval=paste_delay)
if Settings.is_linux(): if OSHelper.is_linux():
json_option_available = exists(file_type_json_pattern) json_option_available = exists(file_type_json_pattern)
assert json_option_available, '"File type JSON" option in file picker window is available' assert json_option_available, '"File type JSON" option in file picker window is available'
@ -119,7 +146,7 @@ class Test(FirefoxTest):
else: else:
type('*') # Show all files in Windows Explorer type('*') # Show all files in Windows Explorer
type(Key.ENTER, interval=PASTE_DELAY) type(Key.ENTER, interval=paste_delay)
select_bookmark_popup_location_final = Location(Screen.SCREEN_WIDTH // 2, library_popup_tab_before.y) select_bookmark_popup_location_final = Location(Screen.SCREEN_WIDTH // 2, library_popup_tab_before.y)
# drag-n-drop right to prevent fails on osx # drag-n-drop right to prevent fails on osx
@ -131,7 +158,7 @@ class Test(FirefoxTest):
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern is available' assert drop_here_available, '"Drop here" pattern is available'
drag_drop(pdf_bak_file_pattern, drop_here_pattern, DRAG_AND_DROP_DURATION) drag_drop(pdf_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
matching_message_displayed = exists(matching_message_pattern, region=matching_region) matching_message_displayed = exists(matching_message_pattern, region=matching_region)
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected ' \ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected ' \
@ -142,8 +169,8 @@ class Test(FirefoxTest):
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern is available' assert drop_here_available, '"Drop here" pattern is available'
open_browser_console()
drag_drop(txt_bak_file_pattern, drop_here_pattern, duration=DRAG_AND_DROP_DURATION) drag_drop(txt_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region) not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region)
assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and ' \ assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and ' \
@ -151,3 +178,19 @@ class Test(FirefoxTest):
type(Key.ESC) type(Key.ESC)
close_tab() close_tab()
def teardown(self):
pdf_file_name = 'pdffile_bak.pdf'
txt_file_name = 'testfile_bak.txt'
copies_directory_name = 'copies'
pdf_backup_file = os.path.join(copies_directory_name, pdf_file_name)
txt_backup_file = os.path.join(copies_directory_name, txt_file_name)
pdf_backup_path = self.get_asset_path(pdf_backup_file)
txt_backup_path = self.get_asset_path(txt_backup_file)
copies_directory = self.get_asset_path(copies_directory_name)
delete_file(pdf_backup_path)
delete_file(txt_backup_path)
os.rmdir(copies_directory)

Просмотреть файл

@ -8,13 +8,37 @@ from targets.firefox.fx_testcase import *
class Test(FirefoxTest): class Test(FirefoxTest):
def setup(self):
pdf_file_name = 'pdffile.pdf'
txt_file_name = 'testfile.txt'
pdf_copy_name = 'pdffile_bak.pdf'
txt_copy_name = 'testfile_bak.txt'
copies_directory_name = 'copies'
copied_pdf_file = os.path.join(copies_directory_name, pdf_copy_name)
copied_txt_file = os.path.join(copies_directory_name, txt_copy_name)
asset_dir = self.get_asset_path('')
copies_directory_path = os.path.join(asset_dir, copies_directory_name)
os.mkdir(copies_directory_path)
original_pdffile_path = self.get_asset_path(pdf_file_name)
backup_pdffile_path = self.get_asset_path(copied_pdf_file)
original_txtfile_path = self.get_asset_path(txt_file_name)
backup_txtfile_path = self.get_asset_path(copied_txt_file)
copy_file(original_pdffile_path, backup_pdffile_path)
copy_file(original_txtfile_path, backup_txtfile_path)
@pytest.mark.details( @pytest.mark.details(
description='Drop .pdf File in demopage', description='Drop .pdf File in demopage',
locale=['en-US'], locale=['en-US'],
test_case_id='165080', test_case_id='165080',
test_suite_id='102', test_suite_id='102',
set_profile_pref={'devtools.chrome.enabled': True},
blocked_by='shutil, os, 270'
) )
def run(self, firefox): def run(self, firefox):
library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON
@ -32,13 +56,14 @@ class Test(FirefoxTest):
file_type_all_files_pattern = None file_type_all_files_pattern = None
file_type_json_pattern = None file_type_json_pattern = None
PASTE_DELAY = 0.5
if OSHelper.is_linux(): if OSHelper.is_linux():
file_type_all_files_pattern = Pattern('file_type_all_files.png') file_type_all_files_pattern = Pattern('file_type_all_files.png')
file_type_json_pattern = Pattern('file_type_json.png') file_type_json_pattern = Pattern('file_type_json.png')
folderpath = self.get_asset_path('') paste_delay = 0.5
drag_and_drop_duration = 2
folderpath = self.get_asset_path('copies')
new_private_window() new_private_window()
@ -47,7 +72,7 @@ class Test(FirefoxTest):
navigate('https://mystor.github.io/dragndrop/') navigate('https://mystor.github.io/dragndrop/')
drop_pdf_file_button_displayed = exists(drop_pdf_file_button_pattern, Settings.DEFAULT_SITE_LOAD_TIMEOUT) drop_pdf_file_button_displayed = exists(drop_pdf_file_button_pattern, Settings.site_load_timeout)
assert drop_pdf_file_button_displayed, 'The demo website loaded successfully' assert drop_pdf_file_button_displayed, 'The demo website loaded successfully'
click(drop_pdf_file_button_pattern) click(drop_pdf_file_button_pattern)
@ -81,7 +106,7 @@ class Test(FirefoxTest):
width=library_title_width * 2, height=library_title_height * 3) width=library_title_width * 2, height=library_title_height * 3)
library_popup_tab_after = Location(Screen.SCREEN_WIDTH / 2, library_popup_tab_before.y) library_popup_tab_after = Location(Screen.SCREEN_WIDTH / 2, library_popup_tab_before.y)
drag_drop(library_popup_tab_before, library_popup_tab_after, Settings.DRAG_AND_DROP_DURATION) drag_drop(library_popup_tab_before, library_popup_tab_after, duration=drag_and_drop_duration)
library_popup_dropped = exists(library_popup_pattern, region=library_tab_region_after) library_popup_dropped = exists(library_popup_pattern, region=library_tab_region_after)
assert library_popup_dropped, 'Library popup dropped to right half of screen successfully' assert library_popup_dropped, 'Library popup dropped to right half of screen successfully'
@ -111,7 +136,7 @@ class Test(FirefoxTest):
type('2', KeyModifier.CMD) # change view of finder type('2', KeyModifier.CMD) # change view of finder
else: else:
paste(folderpath) paste(folderpath)
type(Key.ENTER, interval=PASTE_DELAY) type(Key.ENTER, interval=paste_delay)
if OSHelper.is_linux(): if OSHelper.is_linux():
json_option_available = exists(file_type_json_pattern) json_option_available = exists(file_type_json_pattern)
@ -126,7 +151,7 @@ class Test(FirefoxTest):
else: else:
type('*') # Show all files in Windows Explorer type('*') # Show all files in Windows Explorer
type(Key.ENTER, interval=PASTE_DELAY) type(Key.ENTER, interval=paste_delay)
select_bookmark_popup_location_final = Location(Screen.SCREEN_WIDTH / 2, library_popup_tab_before.y) select_bookmark_popup_location_final = Location(Screen.SCREEN_WIDTH / 2, library_popup_tab_before.y)
# drag-n-drop right to prevent fails on osx # drag-n-drop right to prevent fails on osx
@ -138,7 +163,7 @@ class Test(FirefoxTest):
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern is available' assert drop_here_available, '"Drop here" pattern is available'
drag_drop(pdf_bak_file_pattern, drop_here_pattern, Settings.DRAG_AND_DROP_DURATION) drag_drop(pdf_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
matching_message_displayed = exists(matching_message_pattern, region=matching_region) matching_message_displayed = exists(matching_message_pattern, region=matching_region)
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected ' \ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected ' \
@ -150,7 +175,7 @@ class Test(FirefoxTest):
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern is available' assert drop_here_available, '"Drop here" pattern is available'
drag_drop(txt_bak_file_pattern, drop_here_pattern, Settings.DRAG_AND_DROP_DURATION) drag_drop(txt_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region) not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region)
assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and ' \ assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and ' \
@ -159,3 +184,19 @@ class Test(FirefoxTest):
type(Key.ESC) type(Key.ESC)
close_tab() close_tab()
close_tab() close_tab()
def teardown(self):
pdf_file_name = 'pdffile_bak.pdf'
txt_file_name = 'testfile_bak.txt'
copies_directory_name = 'copies'
pdf_backup_file = os.path.join(copies_directory_name, pdf_file_name)
txt_backup_file = os.path.join(copies_directory_name, txt_file_name)
pdf_backup_path = self.get_asset_path(pdf_backup_file)
txt_backup_path = self.get_asset_path(txt_backup_file)
copies_directory = self.get_asset_path(copies_directory_name)
delete_file(pdf_backup_path)
delete_file(txt_backup_path)
os.rmdir(copies_directory)

Просмотреть файл

@ -8,12 +8,37 @@ from targets.firefox.fx_testcase import *
class Test(FirefoxTest): class Test(FirefoxTest):
def setup(self):
jpg_file_name = 'jpgimage.jpg'
png_file_name = 'pngimage.png'
jpg_copy_name = 'jpgimage_bak.jpg'
png_copy_name = 'pngimage_bak.png'
copies_directory_name = 'copies'
copied_jpg_file = os.path.join(copies_directory_name, jpg_copy_name)
copied_png_file = os.path.join(copies_directory_name, png_copy_name)
asset_dir = self.get_asset_path('')
copies_directory_path = os.path.join(asset_dir, copies_directory_name)
os.mkdir(copies_directory_path)
original_jpgfile_path = self.get_asset_path(jpg_file_name)
backup_jpgfile_path = self.get_asset_path(copied_jpg_file)
original_png_file_path = self.get_asset_path(png_file_name)
backup_png_file_path = self.get_asset_path(copied_png_file)
copy_file(original_jpgfile_path, backup_jpgfile_path)
copy_file(original_png_file_path, backup_png_file_path)
@pytest.mark.details( @pytest.mark.details(
description='Drop html data in demopage opened in Private Window', description='Drop html data in demopage opened in Private Window',
locale=['en-US'], locale=['en-US'],
test_case_id='165089', test_case_id='165089',
test_suite_id='102', test_suite_id='102',
blocked_by='270, drag_drop'
) )
def run(self, firefox): def run(self, firefox):
library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON library_import_backup_pattern = Library.IMPORT_AND_BACKUP_BUTTON
@ -37,7 +62,7 @@ class Test(FirefoxTest):
drag_and_drop_duration = 3 drag_and_drop_duration = 3
paste_delay = 0.5 paste_delay = 0.5
folderpath = self.get_asset_path('') folderpath = self.get_asset_path('copies')
navigate('https://mystor.github.io/dragndrop/') navigate('https://mystor.github.io/dragndrop/')
@ -152,3 +177,19 @@ class Test(FirefoxTest):
type(Key.ESC) type(Key.ESC)
close_tab() close_tab()
def teardown(self):
jpg_file_name = 'jpgimage_bak.jpg'
png_file_name = 'pngimage_bak.png'
copies_directory_name = 'copies'
jpg_backup_file = os.path.join(copies_directory_name, jpg_file_name)
png_backup_file = os.path.join(copies_directory_name, png_file_name)
jpg_backup_path = self.get_asset_path(jpg_backup_file)
png_backup_path = self.get_asset_path(png_backup_file)
copies_directory = self.get_asset_path(copies_directory_name)
delete_file(jpg_backup_path)
delete_file(png_backup_path)
os.rmdir(copies_directory)

Просмотреть файл

@ -8,6 +8,32 @@ from targets.firefox.fx_testcase import *
class Test(FirefoxTest): class Test(FirefoxTest):
def setup(self):
jpg_file_name = 'jpgimage.jpg'
png_file_name = 'pngimage.png'
jpg_copy_name = 'jpgimage_bak.jpg'
png_copy_name = 'pngimage_bak.png'
copies_directory_name = 'copies'
copied_jpg_file = os.path.join(copies_directory_name, jpg_copy_name)
copied_png_file = os.path.join(copies_directory_name, png_copy_name)
asset_dir = self.get_asset_path('')
copies_directory_path = os.path.join(asset_dir, copies_directory_name)
os.mkdir(copies_directory_path)
original_jpgfile_path = self.get_asset_path(jpg_file_name)
backup_jpgfile_path = self.get_asset_path(copied_jpg_file)
original_png_file_path = self.get_asset_path(png_file_name)
backup_png_file_path = self.get_asset_path(copied_png_file)
copy_file(original_jpgfile_path, backup_jpgfile_path)
copy_file(original_png_file_path, backup_png_file_path)
@pytest.mark.details( @pytest.mark.details(
description='Drop single and multiple .png images in demopage opened in Private Window', description='Drop single and multiple .png images in demopage opened in Private Window',
locale=['en-US'], locale=['en-US'],
@ -32,9 +58,9 @@ class Test(FirefoxTest):
file_type_all_files_pattern = Pattern('file_type_all_files.png') file_type_all_files_pattern = Pattern('file_type_all_files.png')
file_type_json_pattern = Pattern('file_type_json.png') file_type_json_pattern = Pattern('file_type_json.png')
drag_and_drop_duration = 3 drag_and_drop_duration = 2
paste_delay = 0.5 paste_delay = 0.5
folderpath = self.get_asset_path('') folderpath = self.get_asset_path('copies')
new_private_window() new_private_window()
@ -49,7 +75,7 @@ class Test(FirefoxTest):
click(drop_png_file_button_pattern) click(drop_png_file_button_pattern)
drop_png_option_selected = exists(drop_png_file_selected_button_pattern) drop_png_option_selected = exists(drop_png_file_selected_button_pattern)
assert drop_png_option_selected, 'The drop-png-file changed color to red which indicates that it '\ assert drop_png_option_selected, 'The drop-png-file changed color to red which indicates that it ' \
'has been selected.' 'has been selected.'
matching_block_available = scroll_until_pattern_found(not_matching_message_pattern, scroll_down, (5,), 30, matching_block_available = scroll_until_pattern_found(not_matching_message_pattern, scroll_down, (5,), 30,
@ -86,7 +112,7 @@ class Test(FirefoxTest):
click(library_import_backup_pattern) click(library_import_backup_pattern)
restore_context_available = exists(library_import_restore_submenu_pattern) restore_context_available = exists(library_import_restore_submenu_pattern)
assert restore_context_available, '\'Restore\' option from \'Import and Backup\'context menu is '\ assert restore_context_available, '\'Restore\' option from \'Import and Backup\'context menu is ' \
'available' 'available'
click(library_import_restore_submenu_pattern) click(library_import_restore_submenu_pattern)
@ -138,7 +164,7 @@ class Test(FirefoxTest):
drag_drop(png_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration) drag_drop(png_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
matching_message_displayed = exists(matching_message_pattern, region=matching_region) matching_message_displayed = exists(matching_message_pattern, region=matching_region)
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected '\ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected ' \
'result is identical to result.' 'result is identical to result.'
test_file_jpg_located = exists(jpg_bak_file_pattern) test_file_jpg_located = exists(jpg_bak_file_pattern)
@ -150,9 +176,25 @@ class Test(FirefoxTest):
drag_drop(jpg_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration) drag_drop(jpg_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region) not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region)
assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and '\ assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and ' \
'expected result is different from result.' 'expected result is different from result.'
type(Key.ESC) type(Key.ESC)
close_tab() close_tab()
close_tab() close_tab()
def teardown(self):
jpg_file_name = 'jpgimage_bak.jpg'
png_file_name = 'pngimage_bak.png'
copies_directory_name = 'copies'
jpg_backup_file = os.path.join(copies_directory_name, jpg_file_name)
png_backup_file = os.path.join(copies_directory_name, png_file_name)
jpg_backup_path = self.get_asset_path(jpg_backup_file)
png_backup_path = self.get_asset_path(png_backup_file)
copies_directory = self.get_asset_path(copies_directory_name)
delete_file(jpg_backup_path)
delete_file(png_backup_path)
os.rmdir(copies_directory)

Просмотреть файл

@ -6,7 +6,32 @@
from targets.firefox.fx_testcase import * from targets.firefox.fx_testcase import *
class Test(BaseTest): class Test(FirefoxTest):
def setup(self):
copies_directory_name = 'copies'
asset_dir = self.get_asset_path('')
copies_directory_path = os.path.join(asset_dir, copies_directory_name)
os.mkdir(copies_directory_path)
jpg_file_name = 'jpgimage.jpg'
jpg_copy_name = 'jpgimage_bak.jpg'
copied_jpg_file = os.path.join(copies_directory_name, jpg_copy_name)
original_jpgfile_path = self.get_asset_path(jpg_file_name)
backup_jpgfile_path = self.get_asset_path(copied_jpg_file)
copy_file(original_jpgfile_path, backup_jpgfile_path)
txt_file_name = 'testfile.txt'
txt_copy_name = 'testfile_bak.txt'
copied_txt_file = os.path.join(copies_directory_name, txt_copy_name)
original_txtfile_path = self.get_asset_path(txt_file_name)
backup_txtfile_path = self.get_asset_path(copied_txt_file)
copy_file(original_txtfile_path, backup_txtfile_path)
@pytest.mark.details( @pytest.mark.details(
description='Drop .txt File in demopage', description='Drop .txt File in demopage',
@ -30,10 +55,10 @@ class Test(BaseTest):
file_type_all_files_pattern = Pattern('file_type_all_files.png') file_type_all_files_pattern = Pattern('file_type_all_files.png')
file_type_json_pattern = Pattern('file_type_json.png') file_type_json_pattern = Pattern('file_type_json.png')
folderpath = self.get_asset_path('') folderpath = self.get_asset_path('copies')
DRAG_AND_DROP_DURATION = 3 drag_and_drop_duration = 2
PASTE_DELAY = 0.5 paste_delay = 0.5
navigate('https://mystor.github.io/dragndrop/') navigate('https://mystor.github.io/dragndrop/')
drop_html_data_button_displayed = exists(drop_txt_file_button_pattern,) drop_html_data_button_displayed = exists(drop_txt_file_button_pattern,)
@ -70,7 +95,7 @@ class Test(BaseTest):
width=library_title_width * 2, height=library_title_height * 3) width=library_title_width * 2, height=library_title_height * 3)
library_popup_tab_after = Location(Screen.SCREEN_WIDTH / 2, library_popup_tab_before.y) library_popup_tab_after = Location(Screen.SCREEN_WIDTH / 2, library_popup_tab_before.y)
drag_drop(library_popup_tab_before, library_popup_tab_after, duration=DRAG_AND_DROP_DURATION) drag_drop(library_popup_tab_before, library_popup_tab_after, duration=drag_and_drop_duration)
library_popup_dropped = exists(library_popup_pattern, region=library_tab_region_after) library_popup_dropped = exists(library_popup_pattern, region=library_tab_region_after)
assert library_popup_dropped, 'Library popup dropped to right half of screen successfully' assert library_popup_dropped, 'Library popup dropped to right half of screen successfully'
@ -99,7 +124,7 @@ class Test(BaseTest):
type('1', KeyModifier.CMD) type('1', KeyModifier.CMD)
else: else:
paste(folderpath) paste(folderpath)
type(Key.ENTER, interval=PASTE_DELAY) type(Key.ENTER, interval=paste_delay)
if OSHelper.is_linux(): if OSHelper.is_linux():
json_option = exists(file_type_json_pattern) json_option = exists(file_type_json_pattern)
@ -114,7 +139,7 @@ class Test(BaseTest):
else: else:
type('*') type('*')
type(Key.ENTER, interval=PASTE_DELAY) type(Key.ENTER, interval=paste_delay)
select_bookmark_popup_location_final = Location(Screen.SCREEN_WIDTH / 2, library_popup_tab_before.y) select_bookmark_popup_location_final = Location(Screen.SCREEN_WIDTH / 2, library_popup_tab_before.y)
# drag-n-drop right to prevent fails on osx # drag-n-drop right to prevent fails on osx
@ -126,7 +151,7 @@ class Test(BaseTest):
drop_here = exists(drop_here_pattern) drop_here = exists(drop_here_pattern)
assert drop_here, '"Drop here" pattern available' assert drop_here, '"Drop here" pattern available'
drag_drop(txt_bak_file_pattern, drop_here_pattern, duration=DRAG_AND_DROP_DURATION) drag_drop(txt_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
matching_message_displayed = exists(matching_message_pattern, region=matching_region) matching_message_displayed = exists(matching_message_pattern, region=matching_region)
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected '\ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected '\
@ -135,7 +160,7 @@ class Test(BaseTest):
test_file_jpg = exists(jpg_bak_file_pattern) test_file_jpg = exists(jpg_bak_file_pattern)
assert test_file_jpg, 'JPG test file is available' assert test_file_jpg, 'JPG test file is available'
drag_drop(jpg_bak_file_pattern, drop_here_pattern, DRAG_AND_DROP_DURATION) drag_drop(jpg_bak_file_pattern, drop_here_pattern, duration=drag_and_drop_duration)
not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region) not_matching_message_displayed = exists(not_matching_message_pattern, region=not_matching_region)
assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and '\ assert not_matching_message_displayed, 'Not Matching appears under the "Drop Stuff Here" area and '\
@ -143,3 +168,19 @@ class Test(BaseTest):
type(Key.ESC) type(Key.ESC)
close_tab() close_tab()
def teardown(self):
jpg_file_name = 'jpgimage_bak.jpg'
txt_file_name = 'testfile_bak.txt'
copies_directory_name = 'copies'
jpg_backup_file = os.path.join(copies_directory_name, jpg_file_name)
txt_backup_file = os.path.join(copies_directory_name, txt_file_name)
jpg_backup_path = self.get_asset_path(jpg_backup_file)
txt_backup_path = self.get_asset_path(txt_backup_file)
copies_directory = self.get_asset_path(copies_directory_name)
delete_file(jpg_backup_path)
delete_file(txt_backup_path)
os.rmdir(copies_directory)

Просмотреть файл

@ -8,6 +8,31 @@ from targets.firefox.fx_testcase import *
class Test(FirefoxTest): class Test(FirefoxTest):
def setup(self):
copies_directory_name = 'copies'
asset_dir = self.get_asset_path('')
copies_directory_path = os.path.join(asset_dir, copies_directory_name)
os.mkdir(copies_directory_path)
jpg_file_name = 'jpgimage.jpg'
jpg_copy_name = 'jpgimage_bak.jpg'
copied_jpg_file = os.path.join(copies_directory_name, jpg_copy_name)
original_jpgfile_path = self.get_asset_path(jpg_file_name)
backup_jpgfile_path = self.get_asset_path(copied_jpg_file)
copy_file(original_jpgfile_path, backup_jpgfile_path)
txt_file_name = 'testfile.txt'
txt_copy_name = 'testfile_bak.txt'
copied_txt_file = os.path.join(copies_directory_name, txt_copy_name)
original_txtfile_path = self.get_asset_path(txt_file_name)
backup_txtfile_path = self.get_asset_path(copied_txt_file)
copy_file(original_txtfile_path, backup_txtfile_path)
@pytest.mark.details( @pytest.mark.details(
description='Drop single and multiple .txt files in demopage opened in Private Window.', description='Drop single and multiple .txt files in demopage opened in Private Window.',
locale=['en-US'], locale=['en-US'],
@ -32,9 +57,9 @@ class Test(FirefoxTest):
file_type_all_files_pattern = Pattern('file_type_all_files.png') file_type_all_files_pattern = Pattern('file_type_all_files.png')
file_type_json_pattern = Pattern('file_type_json.png') file_type_json_pattern = Pattern('file_type_json.png')
folderpath = self.get_asset_path('') folderpath = self.get_asset_path('copies')
drag_and_drop_duration = 3 drag_and_drop_duration = 2
paste_delay = 0.5 paste_delay = 0.5
new_private_window() new_private_window()
@ -150,3 +175,19 @@ class Test(FirefoxTest):
type(Key.ESC) type(Key.ESC)
close_tab() close_tab()
def teardown(self):
jpg_file_name = 'jpgimage_bak.jpg'
txt_file_name = 'testfile_bak.txt'
copies_directory_name = 'copies'
jpg_backup_file = os.path.join(copies_directory_name, jpg_file_name)
txt_backup_file = os.path.join(copies_directory_name, txt_file_name)
jpg_backup_path = self.get_asset_path(jpg_backup_file)
txt_backup_path = self.get_asset_path(txt_backup_file)
copies_directory = self.get_asset_path(copies_directory_name)
delete_file(jpg_backup_path)
delete_file(txt_backup_path)
os.rmdir(copies_directory)

Двоичные данные
tests/firefox/drag_and_drop/images/linux/private_window_logo.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 499 B

Двоичные данные
tests/firefox/drag_and_drop/images/osx/private_window_logo.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 499 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 672 B

После

Ширина:  |  Высота:  |  Размер: 233 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 331 B

После

Ширина:  |  Высота:  |  Размер: 916 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 220 B

После

Ширина:  |  Высота:  |  Размер: 704 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 321 B

После

Ширина:  |  Высота:  |  Размер: 869 B

Двоичные данные
tests/firefox/drag_and_drop/images/win/private_window_logo.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 499 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 277 B

После

Ширина:  |  Высота:  |  Размер: 719 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 672 B

После

Ширина:  |  Высота:  |  Размер: 233 B

Двоичные данные
tests/firefox/drag_and_drop/images/win7/private_window_logo.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 499 B

Просмотреть файл

@ -23,7 +23,7 @@ class Test(FirefoxTest):
copy_image_context_menu_pattern = Pattern('copy_image_option.png') copy_image_context_menu_pattern = Pattern('copy_image_option.png')
navigate('https://mystor.github.io/dragndrop/') navigate('https://mystor.github.io/dragndrop/')
test_page_opened = exists(paste_image_data_radiobutton_pattern, DEFAULT_SITE_LOAD_TIMEOUT) test_page_opened = exists(paste_image_data_radiobutton_pattern, Settings.site_load_timeout)
assert test_page_opened, 'Firefox started and page loaded successfully.' assert test_page_opened, 'Firefox started and page loaded successfully.'
click(paste_image_data_radiobutton_pattern) click(paste_image_data_radiobutton_pattern)
@ -32,7 +32,7 @@ class Test(FirefoxTest):
'it has been selected.' 'it has been selected.'
new_tab() new_tab()
select_tab(2) select_tab('2')
navigate(LocalWeb.POCKET_TEST_SITE) navigate(LocalWeb.POCKET_TEST_SITE)
two_images_displayed_on_the_page = exists(first_picture_pattern) and exists(second_picture_pattern) two_images_displayed_on_the_page = exists(first_picture_pattern) and exists(second_picture_pattern)
assert two_images_displayed_on_the_page, 'Web page successfully loads.' assert two_images_displayed_on_the_page, 'Web page successfully loads.'
@ -43,20 +43,20 @@ class Test(FirefoxTest):
'clicking at the first image' 'clicking at the first image'
click(copy_image_context_menu_pattern) click(copy_image_context_menu_pattern)
select_tab(1) select_tab('1')
edit_paste() edit_paste()
matching_message_appears = scroll_until_pattern_found(matching_message_pattern, type, (Key.PAGE_DOWN,)) matching_message_appears = scroll_until_pattern_found(matching_message_pattern, type, (Key.PAGE_DOWN,))
assert matching_message_appears, '"Matching" appears under the "Drop Stuff Here" area, the expected ' \ assert matching_message_appears, '"Matching" appears under the "Drop Stuff Here" area, the expected ' \
'result is identical to the result.' 'result is identical to the result.'
select_tab(2) select_tab('2')
right_click(second_picture_pattern) right_click(second_picture_pattern)
copy_image_option_available = exists(copy_image_context_menu_pattern) copy_image_option_available = exists(copy_image_context_menu_pattern)
assert copy_image_option_available, '"Copy Image" option is available in the context menu after right ' \ assert copy_image_option_available, '"Copy Image" option is available in the context menu after right ' \
'clicking at the second image' 'clicking at the second image'
click(copy_image_context_menu_pattern) click(copy_image_context_menu_pattern)
select_tab(1) select_tab('1')
edit_paste() edit_paste()
matching_message_appears = exists(matching_message_pattern) matching_message_appears = exists(matching_message_pattern)
assert matching_message_appears, '"Matching" appears under the "Drop Stuff Here" area, the expected result ' \ assert matching_message_appears, '"Matching" appears under the "Drop Stuff Here" area, the expected result ' \

Просмотреть файл

@ -51,7 +51,7 @@ class Test(FirefoxTest):
matching_region = Region(not_matching_message_location.x, not_matching_message_location.y, matching_region = Region(not_matching_message_location.x, not_matching_message_location.y,
width=matching_message_width + 10, height=matching_message_height * 2) width=matching_message_width + 10, height=matching_message_height * 2)
# select_file_in_folder(folderpath, jpg_file_pattern, edit_copy) select_file_in_folder(folderpath, jpg_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'
@ -64,7 +64,7 @@ class Test(FirefoxTest):
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected' \ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected' \
'result is identical to result. ' 'result is identical to result. '
# select_file_in_folder(folderpath, pdf_file_pattern, edit_copy) select_file_in_folder(folderpath, pdf_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'

Просмотреть файл

@ -51,7 +51,7 @@ class Test(FirefoxTest):
matching_region = Region(not_matching_message_location.x, not_matching_message_location.y, matching_region = Region(not_matching_message_location.x, not_matching_message_location.y,
width=matching_message_width + 10, height=matching_message_height * 2) width=matching_message_width + 10, height=matching_message_height * 2)
# select_file_in_folder(folderpath, pdf_file_pattern, edit_copy) select_file_in_folder(folderpath, pdf_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'
@ -64,7 +64,7 @@ class Test(FirefoxTest):
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected' \ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected' \
'result is identical to result. ' 'result is identical to result. '
# select_file_in_folder(folderpath, jpg_file_pattern, edit_copy) select_file_in_folder(folderpath, jpg_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'

Просмотреть файл

@ -55,7 +55,7 @@ class Test(FirefoxTest):
matching_region = Region(not_matching_message_location.x, not_matching_message_location.y, matching_region = Region(not_matching_message_location.x, not_matching_message_location.y,
width=matching_message_width + 10, height=matching_message_height * 2) width=matching_message_width + 10, height=matching_message_height * 2)
# select_file_in_folder(folderpath, pdf_file_pattern, edit_copy) select_file_in_folder(folderpath, pdf_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'
@ -68,7 +68,7 @@ class Test(FirefoxTest):
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected' \ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected' \
'result is identical to result. ' 'result is identical to result. '
# select_file_in_folder(folderpath, jpg_file_pattern, edit_copy) select_file_in_folder(folderpath, jpg_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'

Просмотреть файл

@ -51,7 +51,7 @@ class Test(FirefoxTest):
matching_region = Region(not_matching_message_location.x, not_matching_message_location.y, matching_region = Region(not_matching_message_location.x, not_matching_message_location.y,
width=matching_message_width + 10, height=matching_message_height * 2) width=matching_message_width + 10, height=matching_message_height * 2)
# select_file_in_folder(folderpath, png_file_pattern, edit_copy) select_file_in_folder(folderpath, png_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'
@ -64,7 +64,7 @@ class Test(FirefoxTest):
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected '\ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected '\
'result is identical to result. ' 'result is identical to result. '
# select_file_in_folder(folderpath, txt_file_pattern, edit_copy) select_file_in_folder(folderpath, txt_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'

Просмотреть файл

@ -55,7 +55,7 @@ class Test(FirefoxTest):
matching_region = Region(not_matching_message_location.x, not_matching_message_location.y, matching_region = Region(not_matching_message_location.x, not_matching_message_location.y,
width=matching_message_width + 10, height=matching_message_height * 2) width=matching_message_width + 10, height=matching_message_height * 2)
# select_file_in_folder(folderpath, png_file_pattern, edit_copy) select_file_in_folder(folderpath, png_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'
@ -68,7 +68,7 @@ class Test(FirefoxTest):
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected '\ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected '\
'result is identical to result. ' 'result is identical to result. '
# select_file_in_folder(folderpath, txt_file_pattern, edit_copy) select_file_in_folder(folderpath, txt_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'

Просмотреть файл

@ -50,7 +50,7 @@ class Test(FirefoxTest):
matching_region = Region(not_matching_message_location.x, not_matching_message_location.y, matching_region = Region(not_matching_message_location.x, not_matching_message_location.y,
width=matching_message_width + 10, height=matching_message_height * 2) width=matching_message_width + 10, height=matching_message_height * 2)
# select_file_in_folder(folderpath, txt_file_pattern, edit_copy) select_file_in_folder(folderpath, txt_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'
@ -63,7 +63,7 @@ class Test(FirefoxTest):
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected'\ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected'\
'result is identical to result. ' 'result is identical to result. '
# select_file_in_folder(folderpath, jpg_file_pattern, edit_copy) select_file_in_folder(folderpath, jpg_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'

Просмотреть файл

@ -54,7 +54,7 @@ class Test(FirefoxTest):
matching_region = Region(not_matching_message_location.x, not_matching_message_location.y, matching_region = Region(not_matching_message_location.x, not_matching_message_location.y,
width=matching_message_width + 10, height=matching_message_height * 2) width=matching_message_width + 10, height=matching_message_height * 2)
# select_file_in_folder(folderpath, txt_file_pattern, edit_copy) select_file_in_folder(folderpath, txt_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'
@ -67,7 +67,7 @@ class Test(FirefoxTest):
assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected'\ assert matching_message_displayed, 'Matching appears under the "Drop Stuff Here" area and expected'\
'result is identical to result. ' 'result is identical to result. '
# select_file_in_folder(folderpath, jpg_file_pattern, edit_copy) select_file_in_folder(folderpath, jpg_file_pattern, edit_copy)
drop_here_available = exists(drop_here_pattern) drop_here_available = exists(drop_here_pattern)
assert drop_here_available, '"Drop here" pattern available' assert drop_here_available, '"Drop here" pattern available'