def deleteAllTheModelsInProject(projectName): module_CommonResource.searchForProjectAndOpen(projectName) # Check if the project has any models. Delete the models first if exists("CheckBoxesInsideProjectView.png", 2): # Click on Select All Checkbox click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 280, 338)) # Click on Delete button click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 1425, 290)) assert exists("DeleteFileMessage.png", 2), "ERROR: No delete files dialog appeared." # Click on delete button click(Pattern("DeleteFileMessage.png").targetOffset(-50, 60), 2) assert not exists( "CheckBoxesInsideProjectView.png", 5 ), "ERROR: After deleting all models, still there are some undeleted ones." # Proceed to delete the project click(module_CommonResource.getFlair3DLogoInTheApp()) # Go to dashboard # Go to Manage project. click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset(1680, 0)) assert exists("InsideManageProjects.png" ), "ERROR: Doesn't seem like I am inside Manage Projects" # Click on the first entry. print "INFO: Assumed that the first project will be the latest one. So deleting it." click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 270, 145)) # Click on the delete project click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 1455, 75)) assert exists("DeleteProjectConfirmationDialog.png" ), "ERROR: Delete project dialog didn't appear." # Click on delete click(Pattern("DeleteProjectConfirmationDialog.png").targetOffset(80, 65)) wait(5) # Make sure we are on the dashboard click(module_CommonResource.getFlair3DLogoInTheApp()) wait(1) # Now check whether the project still exists type(Key.F5) # First refresh the page wait(module_CommonResource.getFlair3DLogoInTheApp(), 5) wait(1) module_CommonResource.searchProjectByName(projectName) searchRegion = Region(805, 250, 311, 342) if searchRegion.exists("Balnk.png", 2): print "INFO: Project has been successfully deleted." else: assert 0, "INFO: Project seems to be still there on dashboard after even deleting."
def checkSearchByComponentName(): assert exists("AdminBuildingFullView.png" ), "ERROR: looks Like Model is not loaded correctly" print "INFO: Model is loaded correctly. Switching to Search tab" click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 175, 55)) # Click on search tab assert module_CommonResource.region_leftPanel.exists( "SearchByMissing.png", 2), "ERROR: Search By field seems missing." print "LOG: Select Search by Component Name" click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( -45, 200)) # Click on Component Name Radio button click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 0, 255)) # Click in the search tex box print "LOG: Clicked inside the Search Textbox" type("Basic Roof") print "LOG: Clicking the Search button" click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( -10, 335)) # Click on Fit To view checkBox print "LOG: Check whether any result appears" assert module_CommonResource.region_leftPanel.exists( "BasicRoofSearchResult.png", 10), "ERROR: No or incorrect serach result appeared" print "LOG: Check the Fit To View checkbox" if module_CommonResource.region_leftPanel.exists( Pattern("FitToViewCheckBox.png").similar(0.90)): click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 135, 425)) # Click on Fit To view checkBox print "LOG: Click on the second result - Basic Roof [615290]" click(Pattern("BasicRoofSearchResult.png").targetOffset(-70, 65)) assert exists( "BasicRoofSearchObjectFit.png", 2), "ERROR: Incorrect Search result or Fit To View didn't work" print "INFO: Search By Component Name worked fine. Exiting Test."
def deleteGivenUser(username, password): if (ifLogin): module_CommonResource.openFlair3DAndLoginForGivenUser( link, username, pwd) print "LOG: Find and delete the user. Click on the User Management icon" click(module_CommonResource.getFlairWindowControls().targetOffset(-75, 0)) wait(2) print "LOG: Searching for the user: "******"LOG: Select the result checkbox" click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 270, 140)) print "LOG: Click on the delete button" click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 1310, 70)) print "LOG: Delete user confirmation dialog should appear" assert exists("DeleteUserComfirmationMessage.png", 2), "ERROR: Delete user confirmation dialog missing" print "LOG: Click on delete in the dialog box" click(Pattern("DeleteUserComfirmationMessage.png").targetOffset(145, 85)) module_CommonResource.logoutFromExistingAccount()
def check2DViewsAreOkay(): assert exists("AdminBuildingFullView.png"), "ERROR: looks Like Model is not loaded correctly" print ("LOG: Click on the show 2D view slider button") module_CommonResource.region_leftPanel.click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset(-65,135)) print ("LOG: Check if the first sheet looks okay.") assert exists("FirstSheetBottom.png"), "ERROR: 1st sheet doesn't look okay" print ("LOG: 2D Sheets should show up in the left panel") assert module_CommonResource.region_leftPanel.exists("SheetList.png"), "ERROR: 2D sheets list not visible" rdoButton1st2DsheetLocation = Location(-40,310) # Offset from the FlairLogo print ("LOG: Check if the 2nd Sheet of 1st Model (ARCH) is okay") module_CommonResource.region_leftPanel.click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset(rdoButton1st2DsheetLocation.getX(),rdoButton1st2DsheetLocation.getY()+45)) assert exists("FourtSheetRightTop.png", 5), "ERROR: 2nd sheet of 1st Model (ARCH) doesn't look okay" print ("LOG: Check if the 1st sheet in second model (STR) is okay. Click on the expand button") module_CommonResource.region_leftPanel.click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset(230,450)) print ("LOG: click on the 000- Cover sheet of STR model") module_CommonResource.region_leftPanel.click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset(-40,400)) assert exists("FirstSheetBottom.png"), "ERROR: 2nd sheet of 2nd Model (STR) doesn't look okay" Debug.log("INFO: Looks like 2D Sheets are fine.")
def checkMarkupWorkflow(): print "LOG: Start Markup Creation" bottomToolBarFirstSection = Pattern( "bottomToolBarFirstSection.png").targetOffset(1, 0) print "LOG: doubleClick on roof to zoom to it" doubleClick( Pattern("bottomToolBarFirstSection.png").targetOffset(140, -320)) print "LOG: Click outside to unselect" click(Pattern("bottomToolBarFirstSection.png").targetOffset(-430, 10)) print "LOG: # click on markup button" click(Pattern("bottomToolBarFirstSection.png").targetOffset(530, 0)) print "LOG: Check if the markup window opens up" assert exists(Pattern("markupViewDialog.png").targetOffset( 1, 0)), "ERROR: Markup dialog isn't visible." dropdownPosition = find( Pattern("markupViewDialog.png").targetOffset(55, -85)).getTarget() cloudMarkupOptionPosition = find( Pattern("markupViewDialog.png").targetOffset(70, -10)).getTarget() markUpNameTextBoxPosition = find( Pattern("markupViewDialog.png").targetOffset(-115, 25)).getTarget() saveButtonPosition = find( Pattern("markupViewDialog.png").targetOffset(95, 25)).getTarget() closeButtonPosition = find( Pattern("markupViewDialog.png").targetOffset(130, -130)).getTarget() circleMarkupOptionPosition = find( Pattern("markupViewDialog.png").targetOffset(65, -125)).getTarget() # Enable the edit mode. click(Pattern("markupViewDialog.png").targetOffset(-85, -85)) # Select dropdown click(dropdownPosition) print "LOG: Selecting the cloud markup" click(cloudMarkupOptionPosition) wait(0.5) drawLocation = module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 775, 725).getTargetOffset() dragDrop(drawLocation, Location(drawLocation.getX() + 200, drawLocation.getY() + 100)) # add a markup name and save click(markUpNameTextBoxPosition) # editable textbox assert exists( "CloudMarkup.png"), "ERROR: Cloud markup messed while drawing" paste("Accessible Ramp") click(saveButtonPosition) # save # close the markup saved message module_CommonResource.closeThePopupMessages() click(closeButtonPosition) # close markup wait(0.5) # click on forge view home module_CommonResource.clickOnViewHome() # click on top view click(module_CommonResource.getFlairWindowControls().targetOffset(50, 75)) wait(0.5) # new markup a circle perhaps. print "LOG: Start with the Circle Markup now" print "LOG: doubleClick on second Panel of the top row of sunroof" doubleClick( Pattern("bottomToolBarFirstSection.png").targetOffset(285, -515)) click(Pattern("bottomToolBarFirstSection.png").targetOffset( -140, -70)) # click outside to unselect click(Pattern("bottomToolBarFirstSection.png").targetOffset( 530, 0)) # click on markup button print "LOG: Check if the markup window opens up" assert exists(Pattern("markupViewDialog.png").targetOffset( 1, 0)), "ERROR: Markup dialog isn't visible." print "LOG: Enable the edit mode." click(Pattern("markupViewDialog.png").targetOffset(-85, -85)) # Select new markup click(dropdownPosition) # Select circle markup click(circleMarkupOptionPosition) wait(0.5) drawLocation = module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 1350, 225).getTargetOffset() print drawLocation dragDrop(drawLocation, Location(drawLocation.getX() + 200, drawLocation.getY() + 200)) dragDrop(drawLocation, Location(drawLocation.getX() + 100, drawLocation.getY() + 100)) # draw two so that we can easily identify print "LG: add a markup name and save the circle markup" click(markUpNameTextBoxPosition) # editable textbox assert exists( "CircleMarkups.png"), "ERROR: Circle markup messed while drawing" paste("Roof Panel Position") click(saveButtonPosition) # save # close the markup saved message module_CommonResource.closeThePopupMessages() click(closeButtonPosition) # close markup # Check if both the markups are saved properly def checkMarkupsAreSavedCorrectly(): click(Pattern("bottomToolBarFirstSection.png").targetOffset( 530, 0)) # click on markup button assert exists(Pattern("TwoMarkupEntries.png").targetOffset( 0, 1)), "ERROR: Markups are not shown in the UI" # click on 1st markup and check if the view shows it appropriately click(Pattern("TwoMarkupEntries.png").targetOffset( -85, -20)) # select 1st cloud markup assert exists((Pattern("CloudMarkup.png").similar(0.80) )), "ERROR: Something wrong with the 1st cloud Markup" click(Pattern("TwoMarkupEntries.png").targetOffset( -85, 20)) # select second markup assert exists( "CircleMarkups.png"), "ERROR: Something wrong with the 1st Markup" checkMarkupsAreSavedCorrectly() print( "INFO: Both markups seems correct. In the same session. Let's check for different session." ) # Go to project view and open project again click(module_CommonResource.getFlair3DLogoInTheApp()) wait(0.5) type(Key.F5) # Refresh the page wait(2) module_CommonResource.searchForProjectAndOpen(projectName) module_CommonResource.selectAllAndOpenProject() # Now check if the markups are showing up in this session checkMarkupsAreSavedCorrectly() print( "INFO: Both markups seems correct in this session as well. Let's proceed to delete" ) # delete the markups. deleteFirstMarkupPosition = find( Pattern("TwoMarkupEntries.png").targetOffset(115, -15)).getTarget() click(deleteFirstMarkupPosition) # delete first markup click(Pattern("MarkupDeleteConfirmation.png").targetOffset( 35, 60)) # confirm delete print "LOG: Now deleteing the remaining markup which should be at the place of 1st" click(deleteFirstMarkupPosition) # delete second markup click(Pattern("MarkupDeleteConfirmation.png").targetOffset( 35, 60)) # confirm delete assert not exists( Pattern("TwoMarkupEntries.png").similar(0.90).targetOffset( 1, 0)), "ERROR: Markups are still showing in the UI" # Prepare to close. click(closeButtonPosition) # close markup
# delete the markups. deleteFirstMarkupPosition = find( Pattern("TwoMarkupEntries.png").targetOffset(115, -15)).getTarget() click(deleteFirstMarkupPosition) # delete first markup click(Pattern("MarkupDeleteConfirmation.png").targetOffset( 35, 60)) # confirm delete print "LOG: Now deleteing the remaining markup which should be at the place of 1st" click(deleteFirstMarkupPosition) # delete second markup click(Pattern("MarkupDeleteConfirmation.png").targetOffset( 35, 60)) # confirm delete assert not exists( Pattern("TwoMarkupEntries.png").similar(0.90).targetOffset( 1, 0)), "ERROR: Markups are still showing in the UI" # Prepare to close. click(closeButtonPosition) # close markup print "LOG: First expand the models" # First expand the models."1577200523998.png" click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset(-80, 172)) wait(0.5) checkMarkupWorkflow() if (ifCloseChrome): module_CommonResource.closeChrome() wait(0.5) Debug.log("TEST PASSED!!")
def createNewProject(projectName, modelPath): # Make sure we are on the dashboard click(module_CommonResource.getFlair3DLogoInTheApp()) wait(2) # Click on open new project click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 1425, 70)) # Click on Project Name Textbox click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset(270, 75)) type(projectName) # Click on the description text box click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 265, 150)) paste( "Test Project created through testing Automation. If you find this you may delete it." ) # Click on create button click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 1335, 340)) # Wait for the project to create wait(2) # Click on upload new file icon click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 1465, 290)) print "LOG: New popup dialog should appear. Click on 'Select From Computer' button." click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 725, 350)) # Select the file stored on the path. print "INFO: It is assumed that the file is there at %s" % modelPath wait(2) # wait for file open dialog to appear. type(modelPath) type(Key.ENTER) wait(2) print "LOG: Clicking on select category dropdown" selectCategoryDropdownLoc = find( module_CommonResource.getFlair3DLogoInTheApp()).getTarget().offset( 680, 425) click(selectCategoryDropdownLoc) assert exists( "SelectCatogoryDropdown.png" ), "ERROR: Select category dialog hasn't appeared or there are changes in it." # Select Structural click( Location(selectCategoryDropdownLoc.getX(), selectCategoryDropdownLoc.getY() + 75)) wait(1) # Select upload click( Location(selectCategoryDropdownLoc.getX(), selectCategoryDropdownLoc.getY() + 50)) # Wait till upload message appears wait("UploadSuccessfulMessage.png", 15) click(Pattern("UploadSuccessfulMessage.png").targetOffset(130, 0), 5) # Close message print "LOG: clicking at an interval of 2 seconds" waitSeconds = 0 while exists("ModelListInProjectViewRightHandIcons.png", 2): # Click on the model name to open. click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( 515, 390)) waitSeconds += 2 wait(2) print "LOG: Waiting for %s seconds for model to open" % waitSeconds if (waitSeconds > 20): break # wait for model to load and be ready loading wait(module_CommonResource.getModelsAreReadyMessage(), 5) # Confirm the visuals. assert exists("1575535525361.png", 2), "ERROR: Check if Forge window appeared correctly" print "INFO: Project upload seems to be working fine! Now let's check delete."
def checkLevelsViewIsOkay(): print("LOG: First Expand the All the models.") click(module_CommonResource.getFlair3DLogoInTheApp().targetOffset( -80, 170)) assert exists("AdminBuildingFullView.png" ), "ERROR: looks Like Model is not loaded correctly" assert module_CommonResource.region_leftPanel.exists( "AllModelsInLeftPanel.png" ), "ERROR: Check Left panel model names; something is wrong there." print "LOG: Click On select all models" module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset(-55, 170)) message = "ERROR: After unselecting all the levels, something is still visibile" assert module_CommonResource.region_centerOfForgeViewer.exists( "1574152971881.png"), message print("LOG: Make everything visible again") module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset(-55, 170)) # We will unselect each level one by one cbxLocation = Location(-35, 195) # Offset from the FlairLogo module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( cbxLocation.getX(), cbxLocation.getY())) module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( cbxLocation.getX(), cbxLocation.getY() + 50)) module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( cbxLocation.getX(), cbxLocation.getY() + 100)) module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( cbxLocation.getX(), cbxLocation.getY() + 150)) # Expand the levels as well. expndrLocation = Location(-55, 205) # Offset from the FlairLogo module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( expndrLocation.getX(), expndrLocation.getY())) module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( expndrLocation.getX(), expndrLocation.getY() + 310)) module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( expndrLocation.getX(), expndrLocation.getY() + 455)) assert not exists( "AdminBuildingFullView.png", 1 ), "ERROR: After unselecting all models, the terminal is still visible." print "LOG: Click On select Arch model" module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( cbxLocation.getX(), cbxLocation.getY())) print cbxLocation assert exists( "OnlyArchVisible.png", 2), "ERROR: After selecting only Arch model, something went wrong." assert module_CommonResource.region_leftPanel.exists( "AllLevelsInArchModel.png" ), "ERROR: Arch model selected, but it problem with all the level count. Check." # Click On select Arch models to make it all invisible. module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( cbxLocation.getX(), cbxLocation.getY())) # Click on 3rd level and see if we have proper output module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( cbxLocation.getX() + 25, cbxLocation.getY() + 170)) wait(1) assert module_CommonResource.region_centerOfForgeViewer.exists( "ArchLevel3.png" ), "ERROR: 3rd Level was selected but not an expected result" # Click on Level 1 of Structure model and check if the output is correct. module_CommonResource.region_leftPanel.click( module_CommonResource.getFlair3DLogoInTheApp().targetOffset( cbxLocation.getX() + 25, cbxLocation.getY() + 570)) message = "ERROR: 3rd Level of Arch and Level 1 of Structure were selected but not an expected result" assert module_CommonResource.region_centerOfForgeViewer.exists( "Arch3rdLevel1stStructLevel.png", 2), message Debug.log("INFO: Looks like levels are fine.")