def test_auto_elide_label(app_dialog): # Click on the Context Selector widget app_dialog.open_demo_pane("Auto-Elide Label") assert app_dialog.root.captions["Auto-Elide Label"].exists( ), "Not on the Auto-Elide Label Widget" # Validate default lable value assert app_dialog.root.captions[ "Lorem ipsum dolor sit amet, consectetur adipiscing el..."].exists( ), "Default Auto-Elide text value is good" # Slide to the left side to remove the text and validate labelIndicator = first(app_dialog.root.buttons["Page left"]) width, height = labelIndicator.size app_dialog.root.indicators.Position[1].mouseSlide() labelIndicator.mouseDrag(width * 0, height * 0) assert app_dialog.root.captions[""].exists( ), "Empty Auto-Elide text value is good" # Slide to the right side to show all the text and validate labelIndicator = first(app_dialog.root.buttons["Page right"]) width, height = labelIndicator.size app_dialog.root.indicators.Position[1].mouseSlide() labelIndicator.mouseDrag(width * 1, height * 0) assert app_dialog.root.captions[ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque non posuere lorem. Donec non lobortis mauris...."].exists( ), "Full Auto-Elide text value is good"
def test_view_mode(app_dialog): # Select list mode app_dialog.root.checkboxes["list_mode"].mouseClick() # Make sure list mode button is checked assert app_dialog.root.checkboxes[ "list_mode"].checked, "List view mode is not selected." # Make sure thumb scale slider is not available in list mode assert (app_dialog.root["thumb_scale"].exists() is False), "Thumbnail scale slider shouldn't be visible." # Select thumbnail mode app_dialog.root.checkboxes["thumbnail_mode"].mouseClick() # Make sure thumbnail mode button is checked assert app_dialog.root.checkboxes[ "thumbnail_mode"].checked, "Thumbnail view mode is not selected." # Make sure thumb scale slider is available in lithumbnail mode assert app_dialog.root["thumb_scale"].exists( ), "Thumbnail scale slider isn't available." # Validate thumbnail slider # Move slider to get small thumbnails thumbnailSlider = first(app_dialog.root["position"]) width, height = thumbnailSlider.size app_dialog.root["Position"].get().mouseSlide() thumbnailSlider.mouseDrag(width * -15, height * 0) # Move slider to get big thumbnails thumbnailSlider = first(app_dialog.root["position"]) width, height = thumbnailSlider.size app_dialog.root["Position"].get().mouseSlide() thumbnailSlider.mouseDrag(width * 15, height * 0)
def test_shotgun_hierarchy(app_dialog): # Click on the Shotgun Hierarchy widget app_dialog.open_demo_pane("ShotGrid Hierarchy") assert app_dialog.root.captions["ShotGrid Hierarchy"].exists( ), "Not on the ShotGrid Hierarchy widget" # Wait until widget is showing up app_dialog.root.outlineitems["Demo: Animation"].waitExist(), 30 # Click on Demo: Animation entity app_dialog.root.outlineitems["Demo: Animation"].get().mouseDoubleClick() app_dialog.root.tables.rows["1"].cells[ "bunny_080_0010_layout_v001"].waitExist(), 30 # Scroll down in the navigation table to show more asset type characters tableScrollBar = first(app_dialog.root.scrollbars[2]) width, height = tableScrollBar.size app_dialog.root.scrollbars[2]["Position"].get().mouseSlide() tableScrollBar.mouseDrag(width * 0, height * 1) # Validate last entries is available assert ( app_dialog.root.tables.rows["40"].cells["bunny_080_0200_layout_v001"]. exists() ), "Last Demo: Animation entry is missing in the ShotGrid Hierarchy widget" # Click on Demo: Animation Shots entity app_dialog.root.outlineitems["Shots"].get().mouseDoubleClick() app_dialog.root.tables.rows["40"].cells[ "bunny_080_0200_layout_v001"].waitExist(), 30 # Validate Shots are showing up app_dialog.root.outlineitems["bunny_010"].waitExist(), 30 assert app_dialog.root.outlineitems["bunny_010"].exists( ), "bunny_010 is missing from the ShotGrid Entity Model widget" assert app_dialog.root.outlineitems["bunny_080"].exists( ), "bunny_080 is missing from the ShotGrid Entity Model widget" # Click on bunny_080 entity model app_dialog.root.outlineitems["bunny_080"].get().mouseDoubleClick() if (app_dialog.root.tables.rows["40"].cells["bunny_080_0200_layout_v001"]. exists() is True): app_dialog.root.tables.rows["40"].cells[ "bunny_080_0200_layout_v001"].waitExist(), 30 else: # Scroll down tableScrollBar = first(app_dialog.root.scrollbars[2]) width, height = tableScrollBar.size app_dialog.root.scrollbars[2]["Position"].get().mouseSlide() tableScrollBar.mouseDrag(width * 0, height * 1) # Validate bunny_080_0200_layout_v001 is showing up app_dialog.root.tables.rows["40"].cells[ "bunny_080_0200_layout_v001"].waitExist(), 30 # Select shot bunny_080_0020 app_dialog.root.outlineitems["bunny_080_0020"].get().mouseClick() assert ( app_dialog.root.tables.rows["2"].cells["bunny_080_0020_layout_v002"]. exists() ), "bunny_080_0020_layout_v002 is missing in the ShotGrid Hierarchy widget"
def test_shotgun_field_delegate(app_dialog): # Click on the Shotgun Field Delegate widget app_dialog.open_demo_pane("ShotGrid Field Delegate") assert app_dialog.root.captions["ShotGrid Field Delegate"].exists( ), "Not on the ShotGrid Field Delegate widget" app_dialog.root.captions[ "A ShotgunTableView with auto-assigned field delegates:"].waitExist( ), 30 # Validate Demo: Animation is showing up if app_dialog.root.tables[0].cells["Demo: Animation*"].exists() is True: assert ( app_dialog.root.tables[0].cells["Demo: Animation*"].exists() ), "Demo: Animation project not showing up in the ShotGrid Field Delegate widget" assert ( app_dialog.root.tables[0].cells["https://sg-media*.amazonaws.com*"] .exists()), "Demo: Animation project doesn't have a thumbnail" else: # Scroll down activityScrollBar = first(app_dialog.root.scrollbars[1]) width, height = activityScrollBar.size app_dialog.root.scrollbars[1]["Position"].get().mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) # Validate Demo: Animation is showing up assert ( app_dialog.root.tables[0].cells["Demo: Animation*"].exists() ), "Demo: Animation project not showing up in the ShotGrid Field Delegate widget" assert ( app_dialog.root.tables[0].cells["https://sg-media*.amazonaws.com*"] .exists()), "Demo: Animation project doesn't have a thumbnail" # Validate scroll bar is working fine activityScrollBar = first(app_dialog.root.scrollbars[1]) width, height = activityScrollBar.size app_dialog.root.scrollbars[1]["Position"].get().mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) # Validate second table assert (app_dialog.root.tables[1].cells["New Project"].exists( )), "New Project not showing up in the ShotGrid Field Delegate widget" # Change New Project name app_dialog.root.tables[1].cells["New Project"].get().mouseDoubleClick() app_dialog.root.tables[1].cells["New Project"].get().mouseDoubleClick() app_dialog.root.tables[1].cells["New Project"].typeIn(" Renamed") app_dialog.root.tables[1].get().mouseClick() assert (app_dialog.root.tables[1].cells["Renamed"].exists() ), "Project rename didn't work" # Validate scroll bar is working fine activityScrollBar = first(app_dialog.root.scrollbars[2]) width, height = activityScrollBar.size app_dialog.root.scrollbars[2]["Position"].get().mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1)
def test_shotgun_globals(app_dialog): # Click on the Shotgun Globals widget app_dialog.open_demo_pane("Shotgun Globals") assert app_dialog.root.captions["Shotgun Globals"].exists( ), "Not on the Shotgun Globals widget" # Wait until widget is showing up app_dialog.root.captions["Select an Entity type from the list:"].waitExist( ), 30 # Validate Shotgun globals first dropdown menu app_dialog.root.dropdowns.mouseClick() # Scroll up in the widgets panel and select Asset entity type activityScrollBar = first(topwindows.indicators.Position) width, height = activityScrollBar.size topwindows.indicators.Position.get().mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 0) topwindows.listitems["Asset"].get().mouseClick() assert app_dialog.root.captions["Asset"].exists( ), "Asset didn't get selected from the firts dropdown menu" assert app_dialog.root.captions[ ":/tk-framework-shotgunutils/icon_Asset_dark.png"].exists( ), "Asset didn't get selected from the firts dropdown menu" # Validate Shotgun globals second dropdown menu app_dialog.root.dropdowns[1].mouseClick() topwindows.listitems["Description"].get().mouseClick() assert app_dialog.root.captions["Description"].exists( ), "Description didn't get selected from the second dropdown menu"
def test_shotgun_field_widgets_form(app_dialog): # Click on the Shotgun Field Widgets Form widget app_dialog.open_demo_pane("Shotgun Field Widgets Form") assert app_dialog.root.captions["Shotgun Field Widgets Form"].exists( ), "Not on the Shotgun Field Widgets Form widget" app_dialog.root.captions["Analytics Truth Finder Onboarded:"].waitExist( ), 30 # Validate widget interactions app_dialog.root.checkboxes[ "analytics_truth_finder_onboarded_widget"].mouseClick() assert app_dialog.root.captions[ "> Analytics Truth Finder Onboarded widget value changed to: True"].exists( ), ("Checkbox wasn't successfully checked in the Shotgun Field Widgets Form widget" ) # Validate scroll bar is working fine activityScrollBar = first(app_dialog.root.scrollbars[1]) width, height = activityScrollBar.size app_dialog.root.scrollbars[1]["Position"].get().mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) # Validate widget interactions app_dialog.root.checkboxes["welcome_page_visited_widget"].mouseClick() assert app_dialog.root.captions[ "> Welcome Page Visited widget value changed to: False"].exists( ), "Checkbox wasn't successfully unchecked in the Shotgun Field Widgets Form widget"
def test_publish_type(app_dialog): # Make sure buttons are available assert app_dialog.root.buttons["Select All"].exists( ), "Select All button is missing" assert app_dialog.root.buttons["Select None"].exists( ), "Select None button is missing" # Unselect Folders. That checkbox is hidden from qt so I need to do some hack to select it. foldersCheckbox = first( app_dialog.root["publish_type_list"].listitems["Folders"]) width, height = foldersCheckbox.size app_dialog.root["publish_type_list"].listitems["Folders"].get().mouseSlide( ) foldersCheckbox.mouseClick(width * 0.05, height * 0.5) # Make sure Big Buck Bunny project is no more showing up in the publish view assert ( app_dialog.root["publish_view"].listitems["*Big Buck Bunny"].exists() is False), "Big Buck Bunny project shouldn't be visible." # Click on Select All button app_dialog.root.buttons["Select All"].mouseClick() # Make sure Big Buck Bunny project is showing up in the publish view assert (app_dialog.root["publish_view"].listitems["*Big Buck Bunny"]. exists()), "Big Buck Bunny project ins't available."
def test_publish_type(app_dialog, tk_test_project): # Make sure buttons are available assert app_dialog.root.buttons[ "Select All" ].exists(), "Select All button is missing" assert app_dialog.root.buttons[ "Select None" ].exists(), "Select None button is missing" # Unselect Folders. That checkbox is hidden from qt so I need to do some hack to select it. app_dialog.root["publish_type_list"].mouseClick() foldersCheckbox = first(app_dialog.root["publish_type_list"].listitems["Folders"]) width, height = foldersCheckbox.size app_dialog.root["publish_type_list"].listitems["Folders"].get().mouseSlide() foldersCheckbox.mouseClick(width * 0.05, height * 0.5) # Make sure Toolkit UI Automation project is no more showing up in the publish view assert ( app_dialog.root["publish_view"] .listitems["*" + str(tk_test_project["name"])] .exists() is False ), "Toolkit UI Automation project shouldn't be visible." # Click on Select All button app_dialog.root.buttons["Select All"].mouseClick() # Make sure Toolkit UI Automation project is showing up in the publish view assert ( app_dialog.root["publish_view"] .listitems["*" + str(tk_test_project["name"])] .exists() ), "Toolkit UI Automation project ins't available." # Make sure publish item is showing up correctly app_dialog.root["publish_view"].listitems["Assets"].get().mouseDoubleClick() # app_dialog.root["publish_view"].listitems["Character"].waitExist(timeout=30) # app_dialog.root["publish_view"].listitems["Character"].get().mouseDoubleClick() app_dialog.root["publish_view"].listitems["AssetAutomation"].waitExist(timeout=30) app_dialog.root["publish_view"].listitems[ "AssetAutomation" ].get().mouseDoubleClick() app_dialog.root["publish_view"].listitems["sven.png"].waitExist(timeout=30) # Make sure published file detail view is good app_dialog.root["publish_view"].listitems["sven.png"].get().mouseClick() app_dialog.root["details_image"].waitExist(timeout=30) assert app_dialog.root.captions[ "Name*sven.png*Type*No Type*Version*001*Link*Asset AssetAutomation*Task*Model*Waiting to Start*Review*Pending Review" ].exists(), "Published File informations is missing." assert ( app_dialog.root["history_view"].listitems["001"].exists() ), "Version isn't visible." app_dialog.root["history_view"].listitems["001"].get().mouseClick() # This mouseSlide() is to get the version item's tooltip showing up. app_dialog.root["history_view"].listitems["001"].get().mouseSlide(width * 0.25) topwindows[ "Version 001*This file was published by the toolkit ui automation" ].waitExist(timeout=30)
def test_action_items(app_dialog): # Click on the Actions drop down menu. That menu is hidden from qt so I need to do some hack to select it. folderThumbnail = first( app_dialog.root["publish_view"].listitems["*Big Buck Bunny"]) width, height = folderThumbnail.size app_dialog.root["publish_view"].listitems["*Big Buck Bunny"].get( ).mouseSlide() folderThumbnail.mouseClick(width * 0.9, height * 0.9) # Validate action items. assert topwindows.menuitems["Show details in Shotgun"].exists( ), "Show details in Shotgun isn't available." assert topwindows.menuitems["Show in Media Center"].exists( ), "Show in Media Center isn't available."
def test_note_editor(app_dialog): # Click on the Note Editor widget app_dialog.open_demo_pane("Note Editor") assert app_dialog.root.captions["Note Editor"].exists( ), "Not on the Note Editor widget" # Click to create a new note if app_dialog.root.captions["Click to create a new note..."].exists(): app_dialog.root.captions["Click to create a new note..."].get( ).mouseClick() # Validate that all buttons are available assert app_dialog.root.buttons["Cancel"].exists( ), "Cancel buttons is not showing up" assert app_dialog.root.buttons["Attach Files"].exists( ), "Attach Screenshot buttons is not showing up" assert app_dialog.root.buttons["Take Screenshot"].exists( ), "Take Screenshot buttons is not showing up" assert app_dialog.root.buttons["Create Note"].exists( ), "Create Note buttons is not showing up" # Validate that the File browser is showing up after clicking on the Files to attach button then close it app_dialog.root.buttons["Attach Files"].get().mouseClick() app_dialog.root.dialogs["Select files to attach."].waitExist(), 30 app_dialog.root.dialogs["Select files to attach."].buttons["Close"].get( ).mouseClick() # Validate that all buttons are available assert app_dialog.root.buttons["Cancel"].exists( ), "Cancel button is not showing up" assert app_dialog.root.buttons["add_button"].exists( ), "Add attachments button is not showing up" assert app_dialog.root.buttons["remove_button"].exists( ), "Remove attachments button is not showing up" assert app_dialog.root.buttons["Create Note"].exists( ), "Create Note button is not showing up" app_dialog.root.buttons["Cancel"].get().mouseClick() # Take a screenshot app_dialog.root.buttons["Take Screenshot"].get().mouseClick() MyOGL = first(app_dialog.root) width, height = MyOGL.size MyOGL.mouseSlide(width * 0, height * 0) MyOGL.mouseDrag(width * 1, height * 1) # Add a note app_dialog.root.textfields.typeIn("New Note") app_dialog.root.buttons["Create Note"].get().mouseClick() app_dialog.root.captions["Click to create a new note..."].waitExist(), 30
def test_screen_capture(app_dialog): # Click on the Screen Capture widget app_dialog.open_demo_pane("Screen Capture") assert app_dialog.root.captions["Screen Capture"].exists( ), "Not on the Screen Capture widget" # Validate get_desktop_pixmap button app_dialog.root.buttons["get_desktop_pixmap(rect)"].get().mouseClick() # Validate screen_capture button app_dialog.root.buttons["screen_capture()"].get().mouseClick() MyOGL = first(app_dialog.root) width, height = MyOGL.size MyOGL.mouseSlide(width * 0, height * 0) MyOGL.mouseDrag(width * 1, height * 1) # Validate screen_capture_file button app_dialog.root.buttons["screen_capture_file()"].get().mouseClick() MyOGL = first(app_dialog.root) width, height = MyOGL.size MyOGL.mouseSlide(width * 0, height * 0) MyOGL.mouseDrag(width * 1, height * 1) assert app_dialog.root.captions["Output file: *"].exists( ), "Output file is missing"
def test_activity_stream(app_dialog): # Validate that Demo app is on the welcome page assert app_dialog.root.captions["Help With this App"].exists( ), "Not on the Demos app Welcome Page" # Click on the Activity Stream widget app_dialog.open_demo_pane("Activity Stream") assert app_dialog.root.captions["Activity Stream"].exists( ), "Not on the Activity Stream widget" # Wait until note creation field is showing up. while app_dialog.root.captions["Loading Shotgun Data..."].exists(): time.sleep(1) # Click to create a new note app_dialog.root.captions["Click to create a new note..."].get().mouseClick( ) # Validate that all buttons are available assert app_dialog.root.buttons["Cancel"].exists( ), "Cancel buttons is not showing up" assert app_dialog.root.buttons["Attach Files"].exists( ), "Attach Screenshot buttons is not showing up" assert app_dialog.root.buttons["Take Screenshot"].exists( ), "Take Screenshot buttons is not showing up" assert app_dialog.root.buttons["Create Note"].exists( ), "Create Note buttons is not showing up" # Add a note app_dialog.root.textfields.typeIn("New Note") app_dialog.root.buttons["Create Note"].get().mouseClick() app_dialog.root.waitIdle(), 30 app_dialog.root.captions["New Note"].get().waitExist(), 30 # Validate the Note gets created assert app_dialog.root.captions["New Note"].exists( ), "New note wasn't created" assert app_dialog.root.captions["Reply to this Note"].exists( ), "New note wasn't created" # Scroll down in the activity stream activityScrollBar = first(app_dialog.root.scrollbars[1]) width, height = activityScrollBar.size app_dialog.root.scrollbars[1]["Position"].get().mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) assert app_dialog.root.buttons[ "Click here to see the Activity stream in Shotgun."].exists( ), "Hyperlink to see the Activity Stream in Shotgun is missing"
def test_activity_notes_tabs( app_dialog, tk_test_project, tk_test_entities, tk_test_current_user ): """ Activity and Notes tabs validation """ # Wait for the UI to show up and click on the Activity tab app_dialog.root.tabs["Activity"].waitExist(timeout=30) # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list if app_dialog.root.buttons["Click to go to your work area"].exists() is True: app_dialog.root.buttons["Click to go to your work area"].mouseClick() else: app_dialog.root.buttons[9].mouseClick() # Click on the Activity tab app_dialog.root.tabs["Activity"].mouseClick() assert ( app_dialog.root.tabs["Activity"].selected or app_dialog.root.tabs["Activity"].focused ), "Activity tab should be selected by default" # Wait until note creation field is showing up. wait = time.time() while wait + 30 > time.time(): if app_dialog.root.captions["Loading SG Data..."].exists(): time.sleep(1) else: break # Click to create a new note app_dialog.root.captions["Click to create a new note..."].mouseClick() # Validate that all buttons are available # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list assert ( app_dialog.root.buttons["Cancel"].exists() or app_dialog.root.buttons[27].exists() ), "Cancel buttons is not showing up" assert ( app_dialog.root.buttons["Attach Files"].exists() or app_dialog.root.buttons[28].exists() ), "Attach Screenshot buttons is not showing up" assert ( app_dialog.root.buttons["Take Screenshot"].exists() or app_dialog.root.buttons[29].exists() ), "Take Screenshot buttons is not showing up" assert ( app_dialog.root.buttons["Create Note"].exists() or app_dialog.root.buttons[30].exists() ), "Create Note buttons is not showing up" # Add a note app_dialog.root.textfields.typeIn("New note created by automation") # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list if app_dialog.root.buttons["Create Note"].exists() is True: app_dialog.root.buttons["Create Note"].mouseClick() else: app_dialog.root.buttons[30].mouseClick() app_dialog.root.captions["Reply to this Note"].waitExist(timeout=30) # Validate the Note gets created assert app_dialog.root.captions[ "New note created by automation" ].exists(), "New note wasn't created" assert app_dialog.root.captions[ "Reply to this Note" ].exists(), "New note wasn't created" # Validate that all activities are showing up in the activity stream assert app_dialog.root.captions[ "Published File sven.png was created on Asset AssetAutomation" ].exists(), "Published File sven.png creation is missing in the activity stream" assert app_dialog.root.captions[ "Version sven.png was created on Asset AssetAutomation" ].exists(), "Version sven.png creation is missing in the activity stream" assert app_dialog.root.captions[ "Task Rig was created on Asset AssetAutomation" ].exists(), "Task Rig creation is missing in the activity stream" assert app_dialog.root.captions[ "Task Model was created on Asset AssetAutomation" ].exists(), "Task Model creation is missing in the activity stream" assert app_dialog.root.captions[ "Asset AssetAutomation was created" ].exists(), "Asset AssetAutomation creation is missing in the activity stream" assert app_dialog.root.captions[ "Project " + str(tk_test_project["name"]) + " was created" ].exists(), ( "Project Toolkit UI Automation creation is missing in the activity stream" ) assert app_dialog.root.buttons[ "Click here to see the Activity stream in ShotGrid." ].exists(), "Hyperlink to see the Activity Stream in SG is missing" # Click on the Notes tab app_dialog.root.tabs["Notes"].mouseClick() assert ( app_dialog.root.tabs["Notes"].selected or app_dialog.root.tabs["Notes"].focused ), "Noted tab should be selected by default" # Notes tab validation app_dialog.root.captions["All notes for this project, in update order."].waitExist( timeout=30 ) # Open the note item app_dialog.root.listitems.waitExist(timeout=30) app_dialog.root.listitems.mouseDoubleClick() app_dialog.root.captions["*Note on " + str(tk_test_project["name"])].waitExist( timeout=30 ) assert app_dialog.root.captions[ "New note created by automation" ].exists(), "New Note is missing" assert app_dialog.root.captions[ "Note by " + tk_test_current_user["name"] + "*Written on*Addressed to: " + tk_test_current_user["name"] + "*Associated With:*" + tk_test_project["name"] + "*" ].exists(), "Not the Notes details" # Create a reply app_dialog.root.captions["Reply to this Note"].mouseClick() app_dialog.root.dialogs["Reply"].waitExist(timeout=30) # Validate that all buttons are available # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list assert ( app_dialog.root.dialogs["Reply"].buttons["Cancel"].exists() or app_dialog.root.dialogs["Reply"].buttons[1].exists() ), "Cancel buttons is not showing up" assert ( app_dialog.root.dialogs["Reply"].buttons["Attach Files"].exists() or app_dialog.root.dialogs["Reply"].buttons[2].exists() ), "Attach Screenshot buttons is not showing up" assert ( app_dialog.root.dialogs["Reply"].buttons["Take Screenshot"].exists() or app_dialog.root.dialogs["Reply"].buttons[3].exists() ), "Take Screenshot buttons is not showing up" assert ( app_dialog.root.dialogs["Reply"].buttons["Create Note"].exists() or app_dialog.root.dialogs["Reply"].buttons[4].exists() ), "Create Note buttons is not showing up" # Validate that the File browser is showing up after clicking on the Files to attach button then close it # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list if app_dialog.root.dialogs["Reply"].buttons["Attach Files"].exists() is True: app_dialog.root.dialogs["Reply"].buttons["Attach Files"].mouseClick() else: app_dialog.root.dialogs["Reply"].buttons[2].mouseClick() app_dialog.root.dialogs["Select files to attach."].waitExist(timeout=30) # Get image path to be published image_path = os.path.normpath( os.path.expandvars("${TK_TEST_FIXTURES}/files/images/sven.png") ) # Type in image path app_dialog.root.dialogs["Select files to attach."].textfields[ "File name:" ].mouseClick() app_dialog.root.dialogs["Select files to attach."].textfields["File name:"].pasteIn( image_path ) app_dialog.root.dialogs["Select files to attach."].textfields[ "File name:" ].waitIdle(timeout=30) app_dialog.root.dialogs["Select files to attach."].textfields["File name:"].typeIn( "{ENTER}" ) # Validate that all buttons are available # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list assert ( app_dialog.root.dialogs["Reply"].buttons["Cancel"].exists() or app_dialog.root.dialogs["Reply"].buttons[1].exists() ), "Cancel button is not showing up" assert ( app_dialog.root.dialogs["Reply"].buttons["add_button"].exists() ), "Add attachments button is not showing up" assert ( app_dialog.root.dialogs["Reply"].buttons["remove_button"].exists() ), "Remove attachments button is not showing up" assert ( app_dialog.root.dialogs["Reply"].buttons["Create Note"].exists() or app_dialog.root.dialogs["Reply"].buttons[2].exists() ), "Create Note button is not showing up" if app_dialog.root.dialogs["Reply"].buttons["Create Note"].exists() is True: app_dialog.root.dialogs["Reply"].buttons["Create Note"].mouseClick() else: app_dialog.root.dialogs["Reply"].buttons[2].mouseClick() # Take a screenshot # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list if app_dialog.root.dialogs["Reply"].buttons["Take Screenshot"].exists() is True: app_dialog.root.dialogs["Reply"].buttons["Take Screenshot"].mouseClick() else: app_dialog.root.dialogs["Reply"].buttons[3].mouseClick() app_window = first(app_dialog.root) width, height = app_window.size app_window.mouseSlide(width * 0, height * 0) app_window.mouseDrag(width * 1, height * 1) # Add a note app_dialog.root.dialogs["Reply"].textfields.typeIn("New Reply") # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list if app_dialog.root.dialogs["Reply"].buttons["Create Note"].exists() is True: app_dialog.root.dialogs["Reply"].buttons["Create Note"].mouseClick() else: app_dialog.root.dialogs["Reply"].buttons[4].mouseClick() app_dialog.root.captions["New Reply"].waitExist(timeout=30) # Validate the note gets created # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list if app_dialog.root.buttons["Click to go back"].exists() is True: app_dialog.root.buttons["Click to go back"].mouseClick() else: app_dialog.root.buttons[10].mouseClick() app_dialog.root.captions["All notes for this project, in update order."].waitExist( timeout=30 ) app_dialog.root.tabs["Activity"].mouseClick() app_dialog.root.captions["New Reply"].waitExist(timeout=30) # Go back to the default work area # PySide2 doesn't see button's name so we need to use integer to point to it in the hierarchy list if app_dialog.root.buttons["Click to go to your work area"].exists() is True: app_dialog.root.buttons["Click to go to your work area"].mouseClick() else: app_dialog.root.buttons[9].mouseClick()
def test_shotgun_entity_model(app_dialog): # Scroll down in the widgets panel activityScrollBar = first(app_dialog.root.indicators.Position) width, height = activityScrollBar.size app_dialog.root.indicators.Position.get().mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) # Click on the Shotgun Entity Model widget app_dialog.open_demo_pane("Shotgun Entity Model") assert app_dialog.root.captions["Shotgun Entity Model"].exists( ), "Not on the Shotgun Entity Model widget" # Wait until widget is showing up app_dialog.root.outlineitems["Demo: Animation"].waitExist(), 30 # Click on Demo: Animation entity model app_dialog.root.outlineitems["Demo: Animation"].get().mouseDoubleClick() # Validate Asset Types are showing up app_dialog.root.outlineitems["Character"].waitExist(), 30 assert app_dialog.root.outlineitems["Character"].exists( ), "Character is missing from the Shotgun Entity Model widget" assert app_dialog.root.outlineitems["Environment"].exists( ), "Environment is missing from the Shotgun Entity Model widget" assert app_dialog.root.outlineitems["Matte Painting"].exists( ), "Matte Painting is missing from the Shotgun Entity Model widget" assert app_dialog.root.outlineitems["Prop"].exists( ), "Prop is missing from the Shotgun Entity Model widget" assert app_dialog.root.outlineitems["Vehicle"].exists( ), "Vehicle is missing from the Shotgun Entity Model widget" # Click on Character entity model app_dialog.root.outlineitems["Character"].get().mouseDoubleClick() # Validate Characters are showing up app_dialog.root.outlineitems["Alice"].waitExist(), 30 assert app_dialog.root.outlineitems["Alice"].exists( ), "Character Alice is not in the navigation widget" assert app_dialog.root.outlineitems["Anders"].exists( ), "Character Anders is not in the navigation widget" assert app_dialog.root.outlineitems["Blue Jay"].exists( ), "Character Blue Jay is not in the navigation widget" assert app_dialog.root.outlineitems["Buck"].exists( ), "Character Buck is not in the navigation widget" assert app_dialog.root.outlineitems["Bunny"].exists( ), "Character Bunny is not in the navigation widget" assert app_dialog.root.outlineitems["Caterpillar"].exists( ), "Character Caterpillar is not in the navigation widget" assert app_dialog.root.outlineitems["Darcy"].exists( ), "Character Darcy is not in the navigation widget" # Scroll down in the navigation tree to show more asset type characters activityScrollBar = first(app_dialog.root.scrollbars[1]) width, height = activityScrollBar.size app_dialog.root.scrollbars[1]["Position"].get().mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) # Continue to validate that all Characters are there assert app_dialog.root.outlineitems["Fern"].exists( ), "Character Fern is not in the navigation widget" assert app_dialog.root.outlineitems["Flash"].exists( ), "Character Flash is not in the navigation widget" assert app_dialog.root.outlineitems["Hamster"].exists( ), "Character Hamster is not in the navigation widget" assert app_dialog.root.outlineitems["Jimmy"].exists( ), "Character Jimmy is not in the navigation widget" assert app_dialog.root.outlineitems["Jojo"].exists( ), "Character Jojo is not in the navigation widget" assert app_dialog.root.outlineitems["Mr Banning"].exists( ), "Character Mr Banning is not in the navigation widget" assert app_dialog.root.outlineitems["Mrs Banning"].exists( ), "Character Mrs Banning is not in the navigation widget" assert app_dialog.root.outlineitems["Queen"].exists( ), "Character Queen is not in the navigation widget" assert app_dialog.root.outlineitems["Scare Crow"].exists( ), "Character Scare Crow is not in the navigation widget" assert app_dialog.root.outlineitems["Squirrel"].exists( ), "Character Squirrel is not in the navigation widget" assert app_dialog.root.outlineitems["Young Bunny"].exists( ), "Character Young Bunny is not in the navigation widget"
def test_description_inheritance(app_dialog, tk_test_project): """ Ensure summary description inheritance is working fine. """ # Click on Browse file to publish and then select the file to publish app_dialog.root.buttons["Browse files to publish"].mouseClick() app_dialog.root.dialogs["Browse files to publish"].waitExist(timeout=30) app_dialog.root.dialogs["Browse files to publish"].waitIdle(timeout=30) # Get images path to be published # # This is commented out because it is not working on Azure! # image_path = os.path.normpath( # os.path.expandvars( # '${TK_TEST_FIXTURES}/files/images/"svenFace.jpg" "sven.png"' # ) # ) image_path = os.path.expandvars( "${TK_TEST_FIXTURES}/files/images/svenFace.jpg") # Type in image path app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].mouseClick() app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].pasteIn(image_path) app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].waitIdle(timeout=30) app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].typeIn("{ENTER}") app_dialog.root["item details"].captions["svenFace.jpg"].waitExist( timeout=30) # Open the Browse file to publish and then select the second file to publish app_dialog.root["button container"].navIndexes("0").mouseClick() # Get images path to be published image_path = os.path.expandvars( "${TK_TEST_FIXTURES}/files/images/sven.png") # Type in image path app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].mouseClick() app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].pasteIn(image_path) app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].waitIdle(timeout=30) app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].typeIn("{ENTER}") # Validate file to publish is there and the right project is selected app_dialog.root["item details"].captions["Publish Summary"].waitExist( timeout=30) app_dialog.root["item details"].captions["12 tasks to execute"].waitExist( timeout=30) assert (app_dialog.root["context picker widget"].captions[ "*" + tk_test_project["name"]].exists() ), "Context is not set to Toolkit Publish2 UI Automation project." # Add a summary description and make sure all items inherited it app_dialog.root.textfields.typeIn("Description Summary") # Make sure first parent item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*svenFace.jpg*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: Summary"].exists() ), "Description should be inherited" # Make sure first child of the first parent item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*svenFace.jpg_sub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: Summary"].exists() ), "Description should be inherited" # Make sure second child of the first parent item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*svenFace.jpg_evenmoresub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: Summary"].exists() ), "Description should be inherited" # Scroll down to make sure to have all second items showing up activityScrollBar = first(app_dialog.root.scrollbars) width, height = activityScrollBar.size app_dialog.root["collected items tree"].scrollbars.indicators[ "Position"].mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) # Make sure second item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*sven.png*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: Summary"].exists() ), "Description should be inherited" # Make sure first child of the second item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*sven.png_sub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: Summary"].exists() ), "Description should be inherited" # Make sure second child of the second item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*sven.png_evenmoresub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: Summary"].exists() ), "Description should be inherited" # Add description for the first image # Scroll up to make sure to have all first items showing up activityScrollBar = first(app_dialog.root.scrollbars) width, height = activityScrollBar.size app_dialog.root["collected items tree"].scrollbars.indicators[ "Position"].mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 0) # Select the first parent item app_dialog.root["collected items tree"].outlineitems[ "*svenFace.jpg*"].mouseClick() # Make sure it is the right item assert (app_dialog.root["item details"].captions["svenFace.jpg"].exists() ), "Not the right tree item selected" app_dialog.root["item details"].textfields["item description"].typeIn( "Description for item 1") # Make sure description is not inherited assert ( app_dialog.root["item details"].captions["Description not inherited"]. exists()), "Description should not be inherited" # Make sure first child of the first parent item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*svenFace.jpg_sub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: svenFace.jpg"].exists() ), "Description should be inherited" # Make sure second child of the first parent item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*svenFace.jpg_evenmoresub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: svenFace.jpg"].exists() ), "Description should be inherited" # Add descriptions for the second image # Scroll down to make sure to have all second items showing up activityScrollBar = first(app_dialog.root.scrollbars) width, height = activityScrollBar.size app_dialog.root["collected items tree"].scrollbars.indicators[ "Position"].mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) # Select the second parent item app_dialog.root["collected items tree"].outlineitems[ "*sven.png*"].mouseClick() # Make sure it is the right item assert (app_dialog.root["item details"].captions["sven.png"].exists() ), "Not the right tree item selected" # Make sure description is still inherited for item 2 assert (app_dialog.root["item details"]. captions["Description inherited from: Summary"].exists() ), "Description should be inherited" app_dialog.root["item details"].textfields["item description"].typeIn( "Description for item 2") # Make sure description is no more inherited assert ( app_dialog.root["item details"].captions["Description not inherited"]. exists()), "Description should not be inherited" # Make sure first child of the second item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*sven.png_sub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: sven.png"].exists() ), "Description should be inherited" # Make sure second child of the second item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*sven.png_evenmoresub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: sven.png"].exists() ), "Description should be inherited" # Add description for the first child of the first image # Scroll up to make sure to have all first items showing up activityScrollBar = first(app_dialog.root.scrollbars) width, height = activityScrollBar.size app_dialog.root["collected items tree"].scrollbars.indicators[ "Position"].mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 0) # Select the first child of the first item app_dialog.root["collected items tree"].outlineitems[ "*svenFace.jpg_sub*"].mouseClick() # Make sure it is the right item assert (app_dialog.root["item details"].captions["svenFace.jpg_sub"]. exists()), "Not the right tree item selected" # Make sure description is still inherited for item 1 first child assert (app_dialog.root["item details"]. captions["Description inherited from: svenFace.jpg"].exists() ), "Description should be inherited" app_dialog.root["item details"].textfields["item description"].typeIn( "Description of the first child for item 1") # Make sure description is not inherited assert ( app_dialog.root["item details"].captions["Description not inherited"]. exists()), "Description should not be inherited" # Make sure second child of the first parent item inherited the first child description app_dialog.root["collected items tree"].outlineitems[ "*svenFace.jpg_evenmoresub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: svenFace.jpg_sub"].exists() ), "Description should be inherited" # Add descriptions for the first child of the second image # Scroll down to make sure to have all second items showing up activityScrollBar = first(app_dialog.root.scrollbars) width, height = activityScrollBar.size app_dialog.root["collected items tree"].scrollbars.indicators[ "Position"].mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) # Select the second parent item app_dialog.root["collected items tree"].outlineitems[ "*sven.png_sub*"].mouseClick() # Make sure it is the right item assert (app_dialog.root["item details"].captions["sven.png_sub"].exists() ), "Not the right tree item selected" # Make sure description is still inherited for item 2 first child assert (app_dialog.root["item details"]. captions["Description inherited from: sven.png"].exists() ), "Description should be inherited" app_dialog.root["item details"].textfields["item description"].typeIn( "Description of the first child for item 2") # Make sure description is no more inherited assert ( app_dialog.root["item details"].captions["Description not inherited"]. exists()), "Description should not be inherited" # Make sure second child of the second item inherited the summary description app_dialog.root["collected items tree"].outlineitems[ "*sven.png_evenmoresub*"].mouseClick() assert (app_dialog.root["item details"]. captions["Description inherited from: sven.png_sub"].exists() ), "Description should be inherited"
def test_file_publish(app_dialog, tk_test_project): """ Ensure you can publish an image file successfully. """ # Click on Browse file to publish and then select the file to publish app_dialog.root.buttons["Browse files to publish"].mouseClick() app_dialog.root.dialogs["Browse files to publish"].waitExist(timeout=30) app_dialog.root.dialogs["Browse files to publish"].waitIdle(timeout=30) # Get image path to be published image_path = os.path.expandvars( "${TK_TEST_FIXTURES}/files/images/svenFace.jpg") # Type in image path app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].mouseClick() app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].pasteIn(image_path) app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].waitIdle(timeout=30) app_dialog.root.dialogs["Browse files to publish"].textfields[ "File name:"].typeIn("{ENTER}") # Validate file to publish is there and the right project is selected app_dialog.root["item details"].captions["svenFace.jpg"].waitExist( timeout=30) assert (app_dialog.root["context picker widget"].captions[ "*" + tk_test_project["name"]].exists() ), "Context is not set to Toolkit Publish2 UI Automation." # Change context to use a comp task from shot_001 # Select a shot app_dialog.root["context picker widget"].captions[ "*" + tk_test_project["name"]].mouseClick() app_dialog.root["context picker widget"].textfields.typeIn("Shot") topwindows.listitems["Shot_001"].get().mouseClick() app_dialog.root["context picker widget"].captions["*Shot_001"].waitExist( timeout=30) # Select the comp task from the dropdown menu app_dialog.root["context picker widget"].checkboxes.mouseClick() # Click on validate button app_dialog.root["Bottom frame"].buttons["Validate"].mouseClick() assert (app_dialog.root["Bottom frame"]. captions["Validation Complete. All checks passed."].exists() ), "Validation didn't complete successfully" # Publish app_dialog.root["Bottom frame"].buttons["Publish"].mouseClick() app_dialog.root.captions[ "Publish Complete! For details, click here."].waitExist(timeout=30) assert (app_dialog.root["Bottom frame"]. captions["Publish Complete! For details, click here."].exists() ), "Publish failed." assert (app_dialog.root["Upper frame"].captions["Publish*Complete"].exists( )), "Publish failed." # Validate the Progress Details view app_dialog.root["Upper frame"].captions[ "For more details, click here."].mouseClick() app_dialog.root["Upper frame"].captions["Progress Details"].waitExist( timeout=30) # Validate Copy to clipboard button assert (app_dialog.root["Upper frame"].buttons["Copy to Clipboard"].exists( )), "Copy to Clipboard button is missing." app_dialog.root["Upper frame"].buttons["Copy to Clipboard"].mouseClick() # Validate the plugin is showing up. assert (app_dialog.root["Upper frame"]. outlineitems["File publisher plugin accepted: *svenFace.jpg"]. exists()), "Missing File Publisher plugins" # Scroll down to make sure to have all second items showing up activityScrollBar = first(app_dialog.root.scrollbars) width, height = activityScrollBar.size app_dialog.root["Upper frame"].scrollbars.indicators[ "Position"].mouseSlide() activityScrollBar.mouseDrag(width * 0, height * 1) # Validate the finalizing pass assert (app_dialog.root["Upper frame"]. outlineitems["DEBUG: Executing post finalize hook method..."]. exists()), "Post finalizing hook is missing" assert (app_dialog.root["Upper frame"]. outlineitems["Publish Complete! For details, click here."].exists( )), "Publish Complete! For details, click here is missing" # Close Progress Details view app_dialog.root["Upper frame"].buttons["Close"].mouseClick() app_dialog.root["Upper frame"].captions[ "To publish again, click here"].waitExist(timeout=30) # Return to the main dialog app_dialog.root["Upper frame"].captions[ "To publish again, click here"].mouseClick() # make sure you're on the main dialog assert app_dialog.root.captions[ "Drag and drop files or folders here"].exists( ), "Drag and drop files or folders here text is missing." assert app_dialog.root.buttons["Browse files to publish"].exists( ), "Browse files to publish button is missing." assert app_dialog.root.buttons["Browse sequences to publish"].exists( ), "Browse folders to publish image sequences button is missing."