Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt QuickTest and native dialogs



  • I am using QtQuickTest to test our qml views. There is a use case where the application workflow differs depending on which button has been pressed inside a native file selection dialog ( Qml Item FileDialog). Since I have no access (using findchild,etc) to the buttons inside of the dialog I cannot handle this use case accordingly. If somebody had the same issue I would be curious to know how he has solved it. Implementation of custom qml file dialog will be too much effort, i think.

        function test_createNewProject_UnsavedProjectData_UndefinedFilename() {
            // set flag for unsaved project changes
            applicationController.simProject.hasUnsavedProjectData = true
    
            pressCreateNewProjectAndSaveChanges();
    
            // because of missing project filename there must be a file dialog
            // for path and filename defintion
            var fileSaveDialog = findChild(welcomPage, "fileSaveDlg")
            verify(fileSaveDialog)
    
            *here I would like simulate a mouse click on the ok or cancel button....*
    
        }