def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    passingTest = Test('This test should pass')
    passingTest.addStep('Click on "Test passes"')

    skippedTest = Test('This test should be skiped')
    skippedTest.addStep('Click on "Skip test"')

    def failingFunction():
        assert False
    failingTest = Test('This test should fail')
    failingTest.addStep("Failing step", function=failingFunction)

    failingSetupTest = Test('This test should fail in the step setup')
    failingSetupTest.addStep("Failing prestep", prestep=failingFunction)

    def errorFunction():
        raise Exception ("Error in test")
    errorTest = Test('This test should error')
    errorTest.addStep("Error step", function=errorFunction)

    return [passingTest, skippedTest, failingTest, failingSetupTest, errorTest]
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    passingTest = Test('This test should pass')
    passingTest.addStep('Click on "Test passes"')

    skippedTest = Test('This test should be skiped')
    skippedTest.addStep('Click on "Skip test"')

    def failingFunction():
        assert False

    failingTest = Test('This test should fail')
    failingTest.addStep("Failing step", function=failingFunction)

    failingSetupTest = Test('This test should fail in the step setup')
    failingSetupTest.addStep("Failing prestep", prestep=failingFunction)

    def errorFunction():
        raise Exception("Error in test")

    errorTest = Test('This test should error')
    errorTest.addStep("Error step", function=errorFunction)

    return [passingTest, skippedTest, failingTest, failingSetupTest, errorTest]
Exemple #3
0
 def test__str___(self):
     """Test __str__ method"""
     t = Test('Test that was skipped')
     t.addStep('Skipped', lambda: False)
     tr = TestResult(t)
     self.assertEqual(
         '{}'.format(tr),
         'Test name: -Test that was skipped\nTest result:Test skipped')
 def test__str___(self):
     """test __str__  that convert a status in readamble string."""
     t = Test('Test that skipped is set')
     t.addStep('Skipped', lambda: False)
     tr = TestResult(t)
     self.assertEqual(
         u"%s" % tr,
         'Test name: -Test that skipped is set\nTest result:Test skipped')
def functionalTests():
    test = Test('Functional test')
    test.addStep('Step 1',
                 prestep=lambda: True, isVerifyStep=True)
    test.addStep('Step 1',
                 prestep=lambda: True, isVerifyStep=True)
    test.setIssueUrl("http://www.example.com")
    return [test]
 def testFailed(self):
     """check if the fail flag is correctly set."""
     t = Test('Test that fail is set')
     t.addStep('Fail', lambda: False)
     tr = TestResult(t)
     tr.failed('fake_step', 'FAILED')
     self.assertEqual(tr.status, tr.FAILED)
     self.assertEqual(tr.errorStep, 'fake_step')
     self.assertEqual(tr.errorMessage, 'FAILED')
 def testSkipped(self):
     """check if the skipped is correctly set."""
     t = Test('Test that skipped is set')
     t.addStep('Skipped', lambda: False)
     tr = TestResult(t)
     tr.skipped()
     self.assertEqual(tr.status, tr.SKIPPED)
     self.assertIsNone(tr.errorStep)
     self.assertIsNone(tr.errorMessage, 'PASSED')
Exemple #8
0
 def testPassed(self):
     """Check if the passed flag is correctly set"""
     t = Test('Test that passed')
     t.addStep('Passed', lambda: False)
     tr = TestResult(t)
     tr.passed()
     self.assertEqual(tr.status, tr.PASSED)
     self.assertIsNone(tr.errorStep)
     self.assertIsNone(tr.errorMessage)
def functionalTests():
    try:
        from qgistester.test import Tests
    except:
        return []

    infoTests = Test("Verify report dialog")
    infoTests.addStep(
        "Open the reporting dialog and verify that it shows system information"
    )
    infoTests.addStep("Verify that 'Copy to clipboard' button works correctly")

    return [infoTests]
def functionalTests():
    try:
        from qgistester.test import Test
        from qgistester.utils import layerFromName
    except:
        return []

    def sampleMethod(self):
        pass

    sampleTest = Test("Sample test")
    sampleTest.addStep("Sample step", sampleMethod)

    return [sampleTest]
def functionalTests():
    try:
        from qgistester.test import Test
        from qgistester.utils import layerFromName
    except:
        return []

    dragdropTest = Test("Verify dragging browser element into workspace")
    dragdropTest.addStep("Setting up catalog and explorer", _setUpCatalogAndExplorer)
    dragdropTest.addStep("Drag layer from browser into testing workspace of testing catalog")
    dragdropTest.addStep("Checking new layer", _checkNewLayer)
    dragdropTest.setCleanup(_clean)

    vectorRenderingTest = Test("Verify rendering of uploaded style")
    vectorRenderingTest.addStep("Preparing data", _openAndUpload)
    vectorRenderingTest.addStep("Check that WMS layer is correctly rendered")
    vectorRenderingTest.setCleanup(_clean)

    return [dragdropTest, vectorRenderingTest]
Exemple #12
0
    def testAddStep(self):
        """check if a test is correclty added."""
        def testFunction1():
            pass

        def testFunction2():
            pass

        description1 = "this is a step description"
        description2 = "this is a step description"
        preStep = Step(description1, testFunction1)
        t = Test('this is the test name')
        # do test
        t.addStep(description2, testFunction2, preStep, True)
        self.assertEqual(len(t.steps), 1)
        s = t.steps[0]
        self.assertTrue(s.description == description2)
        self.assertTrue(s.function == testFunction2)
        self.assertTrue(s.prestep == preStep)
        self.assertTrue(s.isVerifyStep)
    def testAddStep(self):
        """check if a test is correclty added."""
        def testFunction1():
            pass

        def testFunction2():
            pass

        description1 = "this is a step description"
        description2 = "this is a step description"
        preStep = Step(description1, testFunction1)
        t = Test('this is the test name')
        # do test
        t.addStep(description2, testFunction2, preStep, True)
        self.assertEqual(len(t.steps), 1)
        s = t.steps[0]
        self.assertTrue(s.description == description2)
        self.assertTrue(s.function == testFunction2)
        self.assertTrue(s.prestep == preStep)
        self.assertTrue(s.isVerifyStep)
    def testAddStep(self):
        """Check if a test is correclty added"""
        def testFunction1():
            pass

        def testFunction2():
            pass

        description1 = 'this is a step description'
        description2 = 'this is a step description'
        preStep = Step(description1, testFunction1)
        t = Test('this is the test name')

        t.addStep(description2, testFunction2, preStep, True)
        self.assertEqual(len(t.steps), 1)
        s = t.steps[0]
        self.assertEqual(s.description, description2)
        self.assertEqual(s.function, testFunction2)
        self.assertEqual(s.prestep, preStep)
        self.assertTrue(s.isVerifyStep)
 def _test(n):
     test = Test("Verify '%s' tutorial" % n)
     test.addStep("Setting up project", lambda: loadTestProject(n))
     test.addStep("Creating web app", lambda: _createWebApp(n))
     test.addStep("Verify web app in browser", prestep=lambda: webbrowser.open_new(
                 "file:///" + webAppFolder.replace("\\","/") + "/webapp/index_debug.html"))
     return test
 def _comparisonTestCompiled(n):
     test = Test("Compiled app test '%s'" % n, "Compiled app tests")
     test.addStep("Setting up project", lambda: loadTestProject("widgets"))
     test.addStep("Creating web app", lambda: _createWebAppCompiled(n), prestep = _checkConnect)
     test.addStep("Compare web app with expected app in browser",
                  prestep=lambda: _openComparisonCompiled(n))
     return test
 def _comparisonTest(n):
     test = Test("Symbology test '%s'" % n)
     test.addStep("Setting up project", lambda: loadTestProject(n))
     test.addStep("Creating web app", lambda: _createWebApp(n))
     test.addStep("Compare web app with expected app in browser",
                  prestep=lambda: _openComparison(n))
     return test
 def _testWidget(n):
     aboutContent = widgetTestAbout.get(n, None)
     test = Test("Verify '%s' widget" % n, "Widget tests")
     test.addStep("Setting up project", lambda: loadTestProject("widgets"))
     test.addStep("Creating web app", lambda: _createWebApp(n, True, aboutContent))
     test.addStep("Verify web app in browser", prestep=lambda: webbrowser.open_new(
                 "file:///" + webAppFolder.replace("\\","/") + "/webapp/index_debug.html"))
     return test
Exemple #19
0
 def _test(n):
     test = Test("Verify '%s' tutorial" % n)
     test.addStep("Setting up project", lambda: loadTestProject(n))
     test.addStep("Creating web app", lambda: _createWebApp(n))
     test.addStep("Verify web app in browser",
                  prestep=lambda:
                  webbrowser.open_new("file:///" + webAppFolder.replace(
                      "\\", "/") + "/webapp/index_debug.html"))
     return test
def functionalTests():
    ''' functional tests. e.g. intergration test or all tests that require user interacion '''
    try:
        from qgistester.test import Test
    except:
        return []
    
    _tests = []
    
    function1Test = Test("Function 1 description")
    function1Test.addStep("do preparation step 1", function1Step1)
    function1Test.addStep("Message to user to do some action => press 'next step'")
    function1Test.addStep("do previous step check", function1Step2)
    function1Test.setCleanup(cleanUpFunction1)
    _tests.append(function1Test)
    
    function2Test = Test("Function 2 description")
    function2Test.addStep("do preparation step 1", function2Step1)
    function2Test.addStep("Message to user to do some action => press 'next step'")
    function2Test.addStep("do previous step check", function2Step2)
    function2Test.setCleanup(cleanUpFunction2)
    _tests.append(function2Test)

    return _tests
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    def _openProject():
        projfile = os.path.join(os.path.dirname(__file__), "data",
                                "project.qgs")
        iface.addProject(projfile)

    def _openLayerProperties():
        layer = _layerFromName("2525")
        iface.showLayerProperties(layer)

    def _openAttributesTable():
        layer = _layerFromName("2525")
        iface.showAttributeTable(layer)

    def _startEditing():
        layer = _layerFromName("2525")
        layer.startEditing()

    def _stopEditing():
        layer = _layerFromName("2525")
        layer.rollBack()
        iface.newProject()

    def _setRenderer():
        r = MilStd2525Renderer(40, "SDIC")
        layer = _layerFromName("2525")
        if QGis.QGIS_VERSION_INT < 29900:
            layer.setRendererV2(r)
        else:
            layer.setRenderer(r)
        layer.reload()
        layer.triggerRepaint()
        iface.mapCanvas().setExtent(layer.extent())

    def _changeSize():
        layer = _layerFromName("2525")
        if QGis.QGIS_VERSION_INT < 29900:
            r = layer.rendererV2()
        else:
            r = layer.renderer()
        r.size = 80
        layer.triggerRepaint()
        iface.mapCanvas().setExtent(layer.extent())

    editWidgetTest = Test("Test code edit widget")
    editWidgetTest.addStep("Open project", _openProject)
    #editWidgetTest.addStep("Open layer properties", _openLayerProperties)
    editWidgetTest.addStep(
        "Open layer properties, go to the 'Fields' tab  and set the edit widget of the SDIC field to 'SDIC code editor'",
        _openLayerProperties)
    editWidgetTest.addStep("Toggle editing", _startEditing)
    #editWidgetTest.addStep("Open attributes table", _openAttributesTable)
    editWidgetTest.addStep(
        "Select layer in the layers tree and open its attribute table")
    editWidgetTest.addStep(
        "Edit a value in the table using the code editor widget and check that it works correctly"
    )
    editWidgetTest.addStep("Toggle editing", _stopEditing)

    rendererTest = Test("Renderer test")
    rendererTest.addStep("Open project", _openProject)
    rendererTest.addStep(
        "Open layer properties. Go to the 'Style' tab and set renderer of the layer "
        "to 'MIL-STD-2525' renderer. Close dialog by pressing 'OK' button",
        _openLayerProperties)
    rendererTest.addStep("Verify that layer rendered correctly.")

    sizeChangeTest = Test("Size change test")
    sizeChangeTest.addStep("Open project", _openProject)
    #sizeChangeTest.addStep("Set renderer", _setRenderer)
    sizeChangeTest.addStep(
        "Open layer properties. Go to the 'Style' tab and set renderer of the layer "
        "to 'MIL-STD-2525' renderer. Close dialog by pressing 'OK' button",
        _openLayerProperties)
    sizeChangeTest.addStep(
        "Verify that the layer is rendered with MIL-STD-2525 symbology",
        isVerifyStep=True)
    #sizeChangeTest.addStep("Change size", _changeSize)
    sizeChangeTest.addStep(
        "Open layer properties. Go to the 'Style' tab and set symbol size to 80. "
        "Close dialog by pressing 'OK' button", _openLayerProperties)
    sizeChangeTest.addStep("Verify that the size of symbols has changed")

    return [editWidgetTest, rendererTest, sizeChangeTest]
def functionalTests():
    try:
        from qgistester.test import Test
        from qgistester.utils import layerFromName
    except:
        return []


    def _openProject():
        projfile = os.path.join(os.path.dirname(__file__), "data", "project.qgs")
        iface.addProject(projfile)

    def _openLayerProperties():
        layer = layerFromName("2525")
        iface.showLayerProperties(layer)

    def _openAttributesTable():
        layer = layerFromName("2525")
        iface.showAttributeTable(layer)

    def _startEditing():
        layer = layerFromName("2525")
        layer.startEditing()

    def _stopEditing():
        layer = layerFromName("2525")
        layer.rollBack()
        iface.newProject()

    def _setRenderer():
        r = MilStd2525Renderer(40, "SDIC")
        layer = layerFromName("2525")
        layer.setRendererV2(r)
        layer.reload()
        layer.triggerRepaint()
        iface.mapCanvas().setExtent(layer.extent())

    def _changeSize():
        layer = layerFromName("2525")
        r = layer.rendererV2()
        r.size = 80
        layer.triggerRepaint()

    editWidgetTest = Test("Test code edit widget")
    editWidgetTest.addStep("Open project", _openProject)
    #editWidgetTest.addStep("Open layer properties", _openLayerProperties)
    editWidgetTest.addStep("Open layer properties, go to the 'Fields' tab  and set the edit widget of the SDIC field to 'SDIC code editor'")
    editWidgetTest.addStep("Toggle editing", _startEditing)
    editWidgetTest.addStep("Open attributes table", _openAttributesTable)
    editWidgetTest.addStep("Edit a value in the table using the code editor widget and check that it works correctly")
    editWidgetTest.addStep("Toggle editing", _stopEditing)

    rendererTest = Test("Renderer test")
    rendererTest.addStep("Open project", _openProject)
    rendererTest.addStep("Open layer properties. Go to the 'Style' tab and set renderer of the layer "
                         "to 'MIL-STD-2525' renderer. Close dialog by pressing 'OK' button", _openLayerProperties)
    rendererTest.addStep("Verify that layer rendered correctly.")

    sizeChangeTest = Test("Size change test")
    sizeChangeTest.addStep("Open project", _openProject)
    sizeChangeTest.addStep("Set renderer", _setRenderer)
    sizeChangeTest.addStep("Verify that the layer is rendered with MIL-STD-2525 symbology", isVerifyStep=True)
    sizeChangeTest.addStep("Change size", _changeSize)
    sizeChangeTest.addStep("Verify that the size of symbols has changed")

    return [editWidgetTest, rendererTest, sizeChangeTest]
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    dragdropTest = Test("Verify dragging browser element into workspace")
    # pki context setup
    dragdropTest.addStep("Setting up pki auth context", utils.initAuthManager)
    dragdropTest.addStep("configuring pki auth context", utils.populatePKITestCerts)
    # normal steps
    dragdropTest.addStep("Setting up catalog and explorer", utils.setUpCatalogAndExplorer)
    dragdropTest.addStep("Setting up test data project", utils.loadTestData)
    dragdropTest.addStep("Drag layer from browser 'Project home->qgis_plugin_test_pt1.shp' into\ntest_catalog->Workspaces->test_workspace")
    dragdropTest.addStep("Checking new layer", utils.checkNewLayer)
    # cleaup with clean of pki context
    dragdropTest.setCleanup(utils.cleanAndPki)

    vectorRenderingTest = Test("Verify rendering of uploaded style")
    # pki context setup
    vectorRenderingTest.addStep("Setting up pki auth context", utils.initAuthManager)
    vectorRenderingTest.addStep("configuring pki auth context", utils.populatePKITestCerts)
    # normal steps
    vectorRenderingTest.addStep("Preparing data", utils.openAndUpload)
    vectorRenderingTest.addStep("Check that WMS layer is correctly rendered")
    # cleaup with clean of pki context
    vectorRenderingTest.setCleanup(utils.cleanAndPki)

    return [dragdropTest, vectorRenderingTest]
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    logTest = Test("Verify in-app message log has no errors for default install. QGIS-62")
    logTest.addStep("Open log messages panel",
                    prestep=lambda:_openLogMessagesDialog())
    logTest.addStep("Review 'General' tab output. Check it has no issues",
                    isVerifyStep=True)
    logTest.addStep("Check there are no errors in 'Plugins' tab",
                    isVerifyStep=True)
    logTest.addStep("If exists, check there are no errors in 'Python warning' tab",
                    isVerifyStep=True)
    logTest.addStep("If exists, check there are no errors in 'Qt' tab",
                    isVerifyStep=True)
    logTest.addStep("Review the Init Script, check there are no errors in 'Qt' tab",
                    isVerifyStep=True)
    logTest.addStep("Review any other existing tabs, check that there are no errors",
                    isVerifyStep=True)

    spatialiteTest = Test("Test Spatialite. QGIS-120")
    spatialiteTest.addStep("Load Spatialite layer",
                           prestep=lambda:_loadSpatialite())
    spatialiteTest.addStep("Open DB Manager",
                           prestep=lambda:_openDBManager())
    spatialiteTest.addStep("Check that 'test' layer is available "
                           "in DB manager, in 'Virtual layers/QGIS layers'",
                           isVerifyStep=True)

    aboutTest = Test("Verify dependency versions and providers in About dialog. QGIS-53")
    aboutTest.addStep("Open About dialog",
                      prestep=lambda:_openAboutDialog())
    if sys.platform == 'darwin':
        filePath = os.path.join(testPath, "data", "about.mac")
    else:
        filePath = os.path.join(testPath, "data", "about.windows")
    with open(filePath) as f:
        content = f.readlines()
    data = ""
    for line in content:
        data += "<p>{}</p>".format(line)
    aboutTest.addStep("Verify that content of the About dialog matches"
                      "following data\n{}\n\n".format(data),
                      isVerifyStep=True)

    arcmapTest = Test("Test ArcMapserver")
    arcmapTest.addStep("Load layer",
                           prestep=_loadArcMap)

    arcfeatureTest = Test("Test ArcFeatureserver")
    arcfeatureTest.addStep("Load layer",
                           prestep=_loadArcFeature)

    wcsTest = Test("Test WCS")
    wcsTest.addStep("Load WCS layer",
                           prestep=_loadWcs)

    wfsTest = Test("Test WFS")
    wfsTest.addStep("Modify and load WFS layer",
                           prestep=_modifyAndLoadWfs)

    postgisTest = Test("Test PostGIS")
    postgisTest.addStep("Create and load PostGIS layer",
                           prestep=_addToDbAndLoadLayer)

    offlineTest = Test("WFS Smoke Test (Server) - Offline Editing")
    offlineTest.addStep("Load WFS layer layer",
                           prestep=_loadWfsToBeEdited)
    offlineTest.addStep("Enable *Offline editing* plugin from *Plugins > Manage and install plugins* in the *Installed* tab.",
                           isVerifyStep=True)
    offlineTest.addStep("Convert the project to an offline project by selecting *Database > Offline editing > Convert to offline project*. Keep the layer selected and click *OK*.",
                           isVerifyStep=True)
    offlineTest.addStep("Enable editing on the recently added layer. Activate the layer in the *Layers* panel and enable editing."
                        " In the *Digitizing toolbar* (in the second row of menu icons), click the *Toggle editing* icon (it's a pencil)"
                         "or from menus go to *Layer > Toogle Editing* This will allow you to edit the layer.",
                           isVerifyStep=True)
    offlineTest.addStep("Click the *Add Feature* icon in the same toolbar.",
                           isVerifyStep=True)
    offlineTest.addStep('''
Click once anywhere in the viewer window - this sets the first vertex of the polygon. Keep clicking other places to add more vertices.

*on OS X*:
to finish the polygon hold the control key down and click (this will add one last vertex).

*on Windows*:
use the right mouse button to end (no other vertex is added).

When you complete the polygon a *Feature Attributes* dialog will pop-up.

Simply click the *Ok* button to dismiss it.
''',
                           isVerifyStep=True)
    offlineTest.addStep("Click the *Save Layer Edits* icon or go to *Layer > Save Layer Edits* menu.",
                           isVerifyStep=True)
    offlineTest.addStep("Click the *Toggle Editing* icon or select the 'Toggle Editing' menu item under Layer.",
                           isVerifyStep=True)
    offlineTest.addStep("Sync the project by selecting *Database > Offline editing > Synchronize*",
                           isVerifyStep=True)    
    offlineTest.addStep("Verify that your changes were stored on the GeoServer. Compare the edited layer with the new one, and verify that they are identical.",
                           prestep= lambda: _loadWfsToBeEdited("testlayer_afterediting"), isVerifyStep=True)    

    return [spatialiteTest, logTest, aboutTest, wcsTest, wfsTest, arcmapTest, arcfeatureTest, postgisTest, offlineTest]
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    allTests = []
    dragdropTest = Test("Verify dragging browser element into workspace")
    dragdropTest.addStep("Setting up catalog and explorer", utils.setUpCatalogAndExplorer)
    dragdropTest.addStep("Setting up test data project", utils.loadTestData)
    dragdropTest.addStep("Drag layer from browser 'Project home->qgis_plugin_test_pt1.shp' into\ntest_catalog->Workspaces->test_workspace")
    dragdropTest.addStep("Checking new layer", utils.checkNewLayer)
    dragdropTest.setCleanup(utils.clean)

    allTests.append(dragdropTest)

    for i, testProject in enumerate(utils.testProjects()):
        renderingTest = Test("Verify rendering of uploaded style (%i)" % i)
        renderingTest.addStep("Preparing data", partial(utils.openAndUpload, testProject))
        renderingTest.addStep("Check that WMS layer is correctly rendered")
        renderingTest.setCleanup(utils.clean)
        allTests.append(renderingTest)

    return allTests
def functionalTests():
    try:
        from qgistester.test import Test

    except:
        return []

    def _loadLayer():
        layerfile = os.path.join(os.path.dirname(__file__), "w3w.shp")
        layer = loadLayer(layerfile, provider="ogr")
        QgsMapLayerRegistry.instance().addMapLayer(layer)

    def _setTool():
        plugins["what3words"].setTool()

    def _zoomTo():
        plugins["what3words"].zoomTo()

    w3wTest = Test("Test w3w")
    w3wTest.addStep("Load layer", _loadLayer)
    w3wTest.addStep("Select map tool", _setTool)
    w3wTest.addStep(
        "Click within the layer polygon and verify that the computed 3 coords are 'healings.distorting.harsher'",
        isVerifyStep=True)
    w3wTest.addStep("Move map canvas",
                    lambda: iface.mapCanvas().setCenter(QgsPoint(0, 0)))
    w3wTest.addStep("Open panel", _zoomTo)
    w3wTest.addStep(
        "Enter 'healings.distorting.harsher' and click on 'zoom to'. Verify it zooms to the polygon layer"
    )
    w3wTest.addStep(
        "Click on 'remove marker' and verify it removes the marker")
    return [w3wTest]
def functionalTests():
    try:
        from qgistester.test import Test
        from qgistester.utils import loadLayer
        import mgrs
    except:
        return []

    def _loadLayer():
        layerfile = os.path.join(os.path.dirname(__file__), "data", "MGRS_100kmSQ_ID_02H.shp")
        layer = loadLayer(layerfile)
        QgsMapLayerRegistry.instance().addMapLayer(layer)

    def _setTool():
        plugins["mgrstools"].setTool()

    def _zoomTo():
        plugins["mgrstools"].zoomTo()

    mgrsTest = Test("Test MRGS tools")
    mgrsTest.addStep("Load layer", _loadLayer)
    mgrsTest.addStep("Select map tool", _setTool)
    mgrsTest.addStep("Click within the upper left polygon. Verify that the computed mrgrs coord starts with 02HKK'", isVerifyStep = True)
    mgrsTest.addStep("Open panel", _zoomTo)
    mgrsTest.addStep("Enter '02HKK' and click on 'zoom to'. Verify it centers the view on to the upper left polygon and adds a marker")
    mgrsTest.addStep("Click on 'remove marker' and verify it removes the marker")
    return [mgrsTest]
Exemple #28
0
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    def _loadLayer():
        layerfile = os.path.join(os.path.dirname(__file__), "data", "MGRS_100kmSQ_ID_02H.shp")
        layer = loadLayer(layerfile, provider="ogr")
        QgsMapLayerRegistry.instance().addMapLayer(layer)

    def _setTool():
        plugins["mgrstools"].setTool()

    def _zoomTo():
        plugins["mgrstools"].zoomTo()

    mgrsTest = Test("Test MRGS tools")
    mgrsTest.addStep("Load layer", _loadLayer)
    mgrsTest.addStep("Select map tool", _setTool)
    mgrsTest.addStep("Click within the upper left polygon. Verify that the computed mrgrs coord starts with 02HKK'", isVerifyStep=True)
    mgrsTest.addStep("Open panel", _zoomTo)
    mgrsTest.addStep("Enter '02HKK' and click on 'zoom to'. Verify it centers the view on to the upper left polygon and adds a marker")
    mgrsTest.addStep("Click on 'remove marker' and verify it removes the marker")
    return [mgrsTest]
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    spatialiteTest = Test("Test Spatialite. QGIS-72")
    spatialiteTest.addStep("Load Spatialite layer",
                           prestep=lambda:_loadSpatialite())
    spatialiteTest.addStep("Open DB Manager",
                           prestep=lambda:_openDBManager())
    spatialiteTest.addStep("Check that 'test' layer is available "
                           "in DB manager, in 'Virtual layers/QGIS layers'",
                           isVerifyStep=True)

    aboutTest = Test("Verify dependency versions and providers in About dialog. QGIS-53")
    aboutTest.addStep("Open About dialog",
                      prestep=lambda:_openAboutDialog())
    if sys.platform == 'darwin':
        filePath = os.path.join(testPath, "data", "about.mac")
    else:
        filePath = os.path.join(testPath, "data", "about.windows")
    with open(filePath) as f:
        content = f.readlines()
    data = ""
    for line in content:
        data += "<p>{}</p>".format(line)
    aboutTest.addStep("Verify that content of the About dialog matches"
                      "following data\n{}\n\n".format(data),
                      isVerifyStep=True)

    logTest = Test("Verify in-app message log has no errors for default install. QGIS-54")
    logTest.addStep("Open log messages panel",
                    prestep=lambda:_openLogMessagesDialog())
    logTest.addStep("Review 'General' tab output. Check it has no issues",
                    isVerifyStep=True)
    logTest.addStep("Check there are no errors in 'Plugins' tab",
                    isVerifyStep=True)
    logTest.addStep("Check there are no errors in 'Qt' tab",
                    isVerifyStep=True)

    return [spatialiteTest, logTest, aboutTest]
Exemple #30
0
def functionalTests():
    spatialiteTest = Test("Test Spatialite. QGIS-72")
    spatialiteTest.addStep("Load Spatialite layer", _loadSpatialite)
    spatialiteTest.addStep("Open DB Manager", _openDBManager)
    spatialiteTest.addStep("Check that 'elk' layer is available in DB manager")

    aboutTest = Test("Verify dependency versions and providers in About dialog. QGIS-53")
    aboutTest.addStep("Open About dialog", _openAboutDialog)
    if sys.platform == 'darwin':
        descriptionFile = os.path.join(os.path.dirname(__file__), "data", "about.mac")
    else:
        descriptionFile = os.path.join(os.path.dirname(__file__), "data", "about.windows")
    aboutTest.addStep(descriptionFile)

    logTest = Test("Verify in-app message log has no errors for default install. QGIS-54")
    logTest.addStep("Open log messages panel", _openLogMessagesDialog)
    logTest.addStep("Review 'General' tab output", isVerifyStep = True)
    logTest.addStep("Check there are no errors in 'Plugins' tab", isVerifyStep = True)
    logTest.addStep("Check there is no 'Python warning' tab", isVerifyStep = True)
    logTest.addStep("Check there is no 'Qt' tab", isVerifyStep = True)
    logTest.addStep("Check there is no other tab", isVerifyStep = True)

    return [spatialiteTest, aboutTest, logTest]
def functionalTests():
    try:
        from qgistester.test import Test
        from qgistester.utils import layerFromName
    except:
        return []

    def sampleMethod(self):
        pass

    plotTest = Test("Plot workflow")
    plotTest.addStep("Copy folder path", copyDatacubeFolder)
    plotTest.addStep(
        "Add data source to plugin main panel. Datacube URL has been copied to the clipboard"
    )
    plotTest.addStep("Add all layers from the ls7 coverage")
    plotTest.addStep(
        "Move to the 'Plot' tab and click the 'Select point tool' button."
        "Click on a point in the canvas. You should see a plot in the plot panel.",
        isVerifyStep=True)
    plotTest.addStep(
        "Click on the 'Select region tool'. Click and drag a small rectangle in the canvas."
        " You should see a box and whiskers plot in the plot panel",
        isVerifyStep=True)
    plotTest.addStep(
        "Move the sliders in the 'Plot' tab and verify that the plot panel reacts correctly",
        isVerifyStep=True)
    plotTest.addStep(
        "Change the parameter to plot and verify that the plot panel reacts correctly",
        isVerifyStep=True)
    plotTest.addStep(
        "Change the coverage to plot and verify that the plot panel is cleared",
        isVerifyStep=True)
    plotTest.addStep(
        "Change back the coverage to plot and verify that the plot panel shows a plot again",
        isVerifyStep=True)

    renderingTest = Test("Rendering test")
    renderingTest.addStep("Copy folder path", copyDatacubeFolder)
    renderingTest.addStep(
        "Add data source to plugin main panel. Datacube URL has been copied to the clipboard"
    )
    renderingTest.addStep("Add one layer from the ls7 coverage")
    renderingTest.addStep(
        "Modify the rendering of the ls7 coverage so r=green, g=blue, b=nir. Click on apply and verify the rendering changes",
        isVerifyStep=True)
    renderingTest.addStep(
        "Add the remaining layer from the ls7 coverage and verify in its properties that it uses bands 2, 3 and 4 for the rendering",
        isVerifyStep=True)

    wrongEndpointTest = Test("Rendering test")
    wrongEndpointTest.addStep(
        "Add wrong source to plugin main panel, entering 'wrong' in the endpoint dialog. Verify that a warning message is shown"
    )

    mosaicParametersTest = Test("Mosaic parameters test")
    mosaicParametersTest.addStep("Copy folder path", copyDatacubeFolder)
    mosaicParametersTest.addStep(
        "Add data source to plugin main panel. Datacube URL has been copied to the clipboard"
    )
    mosaicParametersTest.addStep(
        "Open the mosaic panel and try to create a mosaic. Verify it complains that extent is not configured",
        isVerifyStep=True)
    mosaicParametersTest.addStep(
        "Fill the extent values clicking on 'Canvas extent'. Try to create a mosaic. Verify it complains that there are no coverages.",
        isVerifyStep=True)
    mosaicParametersTest.addStep(
        "Add one layer from the ls7 coverage and then remove it from the QGIS project. Try to create the mosaic and verify a warning is shown",
        isVerifyStep=True)

    mosaicTest = Test("Mosaic parameters test")
    mosaicTest.addStep("Copy folder path", copyDatacubeFolder)
    mosaicTest.addStep(
        "Add data source to plugin main panel. Datacube URL has been copied to the clipboard"
    )
    mosaicTest.addStep("Add one layer from the ls7 coverage")
    mosaicTest.addStep(
        "Open the mosaic panel. Click on 'Select on canvas'. Click and drag on the canvas to define a extent. Click on 'Create mosaic'. Verify the mosaic is created and added"
    )

    return [
        plotTest, renderingTest, wrongEndpointTest, mosaicTest,
        mosaicParametersTest
    ]
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    tests = []
    test = Test("Create new repository")
    test.addStep("Set repos folder", lambda: _setReposFolder("new"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Create new repo and verify it is correctly added to the list")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Add layer without repo")
    test.addStep("Set repos folder", lambda: _setReposFolder("new"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Right click on the layer and try to add it to a repository.\n"
                 "Verify that it shows a warning because there are no repositories defined.")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Create new repository with existing name")
    test.addStep("Set repos folder", lambda: _setReposFolder("emptyrepo"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Create new repo named 'testrepo' and verify it cannot be created")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Change repository title")
    test.addStep("Set repos folder", lambda: _setReposFolder("emptyrepo"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Edit repository title and check it is updated in the repo summary")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Delete repository")
    test.addStep("Set repos folder", lambda: _setReposFolder("emptyrepo"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete repository and check it is removed from the list")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Add layer to repository")
    test.addStep("Set repos folder", lambda: _setReposFolder("emptyrepo"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Add layer 'points' to the 'testrepo' repository")
    test.addStep("Check layer has been added to repo", _checkLayerInRepo)
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Add layer with unconfigured user")
    test.addStep("Set repos folder", lambda: _setReposFolder("emptyrepo"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Remove user configuration", _removeUserConfig)
    test.addStep("Add layer 'points' to the 'testrepo' repository")
    test.addStep("Check layer has been added to repo", _checkLayerInRepo)
    test.setCleanup(_restoreUserConfig)
    tests.append(test)

    test = Test("Open repository layers in QGIS")
    test.addStep("Set repos folder", lambda: _setReposFolder("pointsrepo"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Select the 'testrepo' repository and click on 'Open repository in QGIS'")
    test.addStep("Check layer has been added to project", _checkLayerInProject)
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Update repository when there are no changes")
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Set repos folder", lambda: _setReposFolder("pointsrepo"))
    test.addStep("Export repo layers", lambda:_exportRepoLayers("repo"))
    test.addStep("Right click on 'points' layer and select 'GeoGig/Update repository with this version'\n"
                 "Verify that the plugin shows that there are no changes to add")
    test.setCleanup(_cleanRepoClone)
    tests.append(test)

    test = Test("Modify feature and create new version")
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Set repos folder", lambda: _setReposFolder("pointsrepo"))
    test.addStep("Export repo layers", lambda:_exportRepoLayers("repo"))
    test.addStep("Edit layer", _modifyFeature)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Update repository with this version'")
    test.addStep("Check layer has been updated", _checkFeatureModifiedInRepo)
    test.setCleanup(_cleanRepoClone)
    tests.append(test)

    test = Test("Add feature and create new version")
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Set repos folder", lambda: _setReposFolder("pointsrepo"))
    test.addStep("Export repo layers", lambda:_exportRepoLayers("repo"))
    test.addStep("Edit layer", _addFeature)
    test.addStep("Right click on 'points' layer and select 'GeoGig/Update repository with this version'")
    test.addStep("Check layer has been updated", _checkFeatureAddedInRepo)
    test.setCleanup(_cleanRepoClone)
    tests.append(test)

    test = Test("Add layer to repository from context menu")
    test.addStep("Open test data", lambda: openTestProject("points"))
    test.addStep("Set repos folder", lambda: _setReposFolder("emptyrepo"))
    test.addStep("Add layer using context menu")
    test.addStep("Check layer has been added to repo", _checkLayerInRepo)
    test.addStep("Check layer context menus", _checkLayerHasTrackedContextMenus)
    test.setCleanup(_cleanRepoClone)
    tests.append(test)

    test = Test("Remove layer from repository")
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Set repos folder", lambda: _setReposFolder("pointsrepo"))
    test.addStep("Export repo layers", lambda:_exportRepoLayers("repo"))
    test.addStep("Right click on 'points' layer and select 'GeoGig/Remove layer from repository'")
    test.addStep("Check layer has been correctly deleted", _checkLayerNotInRepo)
    test.addStep("Check layer context menus", _checkLayerHasUntrackedContextMenus)
    test.setCleanup(_cleanRepoClone)
    tests.append(test)

    test = Test("Show version characteristics")
    test.addStep("Set repos folder", lambda: _setReposFolder("pointsrepo"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Right click on repo's only commit and select 'Show detailed description'\nVerify description is correctly shown")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Create new branch")
    test.addStep("Set repos folder", lambda: _setReposFolder("pointsrepo"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Create new branch at current branch's HEAD and verify it is added to history tree")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Switch branch")
    test.addStep("Set repos folder", lambda: _setReposFolder("twobranches"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Export repo layers", lambda:_exportRepoLayers("repo"))
    test.addStep("Switch to 'newbranch' branch and verify the map is updated")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Merge branch")
    test.addStep("Set repos folder", lambda: _setReposFolder("twobranches"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Export repo layers", lambda:_exportRepoLayers("repo"))
    test.addStep("Merge 'newbranch' into 'master' and verify the map and versions tree are updated")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Merge conflicted  branch")
    test.addStep("Set repos folder", lambda: _setReposFolder("conflicted"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Export repo layers", lambda:_exportRepoLayers("repo"))
    test.addStep("Merge 'conflicted' into 'master' and solve the conflicts.\n"
                 "Verify the merge is correctly finished and the tree and map are updated")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Merge conflicted  branch and abort")
    test.addStep("Set repos folder", lambda: _setReposFolder("conflicted"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Export repo layers", lambda:_exportRepoLayers("repo"))
    test.addStep("Merge 'conflicted' into 'master' and abort.\n"
                 "Verify the merge is correctly aborted.")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Delete branch")
    test.addStep("Set repos folder", lambda: _setReposFolder("twobranches"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Delete 'newbranch' and verify the versions tree is updated")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Pull from remote")
    test.addStep("Set repos folder", lambda: _setReposFolder("remote"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add remote", _addRemote)
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Export repo layers", lambda:_exportRepoLayers("local"))
    test.addStep("Sync local repo pulling from remote.\n"
                 "Verify the repo and the map are correctly updated.")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    test = Test("Pull from remote with conflicts")
    test.addStep("Set repos folder", lambda: _setReposFolder("conflictedremote"))
    test.addStep("Open navigator", _openNavigator)
    test.addStep("Add remote", _addRemote)
    test.addStep("New project", qgis.utils.iface.newProject)
    test.addStep("Sync local repo pulling from remote.\n"
                 "Verify the conflict is detected.")
    test.setCleanup(_removeTempRepoFolder)
    tests.append(test)

    return tests
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    emptyCredentialsTest = Test('Check Connect plugin recognize empty credentials')
    emptyCredentialsTest.addStep('Press "Login" button without entering any credentials. '
                                 'Check that Connect shows error message complaining about empty credentials.'
                                 'Close error message by pressing "Ok" button.'
                                 'Check that the Connect panel shows login page.',
                                 prestep=lambda: _startConectPlugin(),
                                 isVerifyStep=True)

    invalidCredentialsTest = Test('Check Connect plugin recognize invalid credentials')
    invalidCredentialsTest.addStep('Enter invalid Connect credentials and accept dialog by pressing "Login" button. '
                                   'Check that dialog asking for credentials is shown and close it by pressing "Cancel" button. '
                                   'Check that Connect shows error message complaining about invalid credentials. '
                                   'Close error message by pressing "Ok" button. '
                                   'Check that the Connect panel shows login page.',
                                   prestep=lambda: _startConectPlugin(),
                                   isVerifyStep=True)

    invalidEndpointTest = Test('Check login with wrong endpoint')
    invalidEndpointTest.addStep('Open plugin settings from "PLugins -> Boundless Connect -> Plugin Settings" menu. '
                                'Enter "https://dummy.com" as Connect endpoint and close dialog by pressing OK.')
    invalidEndpointTest.addStep('Enter valid Connect credentials and press "Login" button. Verify that error '
                                'message about token is shown and login page is active.',
                                prestep=lambda: _startConectPlugin(),
                                isVerifyStep=True)

    repeatedLoginTest = Test("Check repeated logging")
    repeatedLoginTest.addStep('Enter valid Connect credentials, check "Remember me" '
                              'checkbox and press "Login" button.',
                              prestep=lambda: _startConectPlugin())
    repeatedLoginTest.addStep('Check that label with your login info '
                              'is shown in the lower part of the Connect panel.',
                              isVerifyStep=True)
    repeatedLoginTest.addStep('Click on the "Logout" button')
    repeatedLoginTest.addStep('Verify that login and password fields are '
                              'filled with login and password you used at '
                              'the previous login and "Remember me" checkbox '
                              'is checked.',
                              isVerifyStep=True)
    repeatedLoginTest.addStep('Enter another another valid credentials and '
                              'keep "Remember me" checkbox checked. Press '
                              '"Login" button.',
                              isVerifyStep=True)
    repeatedLoginTest.addStep('Check that in the lower part of Connect '
                              'plugin, correct login name is displayed.',
                              isVerifyStep=True)
    repeatedLoginTest.addStep('Click on the "Logout" button')
    repeatedLoginTest.addStep('Verify that login and password fields are '
                              'filled with login and password you used at '
                              'the previous login and "Remember me" checkbox '
                              'is checked.',
                              isVerifyStep=True)
    repeatedLoginTest.addStep('Close Connect dock.')
    repeatedLoginTest.addStep('Open Connect dock from "Plugins -> Boundless Connect" '
                              'menu. Verify that login and password fields are '
                              'filled with login and password you used at '
                              'the previous login',
                              isVerifyStep=True)
    repeatedLoginTest.addStep('Uncheck "Remember me". Close Connect dock.',)
    repeatedLoginTest.addStep('Open Connect dock from "Plugins -> Boundless Connect" '
                              'menu. Verify that login and password fields are '
                              'empty and "Remember me" checkbox is unchecked.',
                              isVerifyStep=True)

    emptySearchTest = Test("Check empty search")
    emptySearchTest.addStep('Enter valid Connect credentials and press "Login" button.',
                            prestep=lambda: _startConectPlugin())
    emptySearchTest.addStep('Verify that "Knowledge" tab is shown, '
                            'populated with content and no error is thrown',
                            isVerifyStep=True)
    emptySearchTest.addStep('Switch to the "Data" tab. Verify that '
                            'some results are shown and no error is thrown',
                            isVerifyStep=True)
    emptySearchTest.addStep('Switch to the "Plugins" tab. Verify that '
                            'some results are shown and no error is thrown',
                            isVerifyStep=True)
    emptySearchTest.addStep('Type "mapbox" in the search box and Switch '
                            'to the "Knowledge" tab. Verify that some '
                            'results are shown and no error is thrown',
                            isVerifyStep=True)
    emptySearchTest.addStep('Switch to the "Plugins" tab. Verify that no '
                            'results are shown and no error is thrown',
                            isVerifyStep=True)
    emptySearchTest.addStep('Clear search field and switch to the "Data" '
                            'tab. Verify that some results are shown and '
                            'no error is thrown',
                            isVerifyStep=True)

    searchTest = Test("Check normal search")
    searchTest.addStep('Enter valid Connect credentials and press "Login" button.',
                       prestep=lambda: _startConectPlugin())
    searchTest.addStep('Verify that "Knowledge" tab is shown, '
                       'populated with content and no error is thrown',
                       isVerifyStep=True)
    searchTest.addStep('Type "gdal" in the search box and press Enter. '
                       'Verify that a list of results is shown.',
                       isVerifyStep=True)
    searchTest.addStep('Type "lesson" in the search box and switch '
                       'to the "Plugins" tab. Verify that one plugin result is shown.',
                       isVerifyStep=True)
    searchTest.addStep('Type "mapbox" in the search box and switch '
                       'to the "Data" tab. Verify that a list of results is shown.',
                       isVerifyStep=True)

    paginationTest = Test("Check normal search")
    paginationTest.addStep('Enter valid Connect credentials and press "Login" button.',
                           prestep=lambda: _startConectPlugin())
    paginationTest.addStep('Verify that "Knowledge" tab is shown, '
                           'populated with content and no error is thrown',
                           isVerifyStep=True)
    paginationTest.addStep('Type "geogig" in the search box and press Enter. '
                           'Verify that a list of results is shown and there is'
                           'a "Next" button at the bottom',
                           isVerifyStep=True)
    paginationTest.addStep('Click on the "Next" button. Verify that new '
                           'results are loaded and at the bottom there are '
                           'two buttons: "Next" and "Previous"',
                           isVerifyStep=True)
    paginationTest.addStep('Continue clicking on the "Next" button until '
                           'last page loaded. Verify that only "Previous" '
                           'is shown at the bottom of the results list',
                            isVerifyStep=True)
    paginationTest.addStep('Click on the "Previous" button. Verify that '
                           'new you returned to the previous page.',
                           isVerifyStep=True)
    paginationTest.addStep('Continue clicking on the "Previous" button until '
                           'first page loaded. Verify that only "Next" '
                           'is shown at the bottom of the results list',
                            isVerifyStep=True)

    wrongSearchTest = Test("Check wrong search")
    wrongSearchTest.addStep('Enter valid Connect credentials and press "Login" button.',
                            prestep=lambda: _startConectPlugin())
    wrongSearchTest.addStep('Verify that "Knowledge" tab is shown, '
                            'populated with content and no error is thrown',
                            isVerifyStep=True)
    wrongSearchTest.addStep('Type "wrongsearch" in the search box and '
                            'press Enter. Verify that a warning is displayed.',
                            isVerifyStep=True)

    categorySearchTest = Test("Check search by categories")
    categorySearchTest.addStep('Enter valid Connect credentials and press "Login" button.',
                               prestep=lambda: _startConectPlugin())
    categorySearchTest.addStep('Verify that "Knowledge" tab is shown, '
                               'populated with content and no error is thrown',
                               isVerifyStep=True)
    categorySearchTest.addStep('Type "MIL-STD-2525" in the search box and '
                               'ensure no category is selected in "Search in" '
                               'combobox. Press Enter. Verify that multiple '
                               'results are shown and they are from '
                               'different categories.',
                               isVerifyStep=True)
    categorySearchTest.addStep('Type "style" in the search box and in '
                               'the "Search in" combobox select "Lesson" '
                               'and deselect any other items. '
                               'Click on the "Search" button again and '
                               'check that only lessons results are shown',
                               isVerifyStep=True)
    categorySearchTest.addStep('In the "Search in" combobox additionaly '
                               'select "Learning". Click on the "Search" '
                               'button again and check that multiple results '
                               'are shown: lesson and learning center content.',
                               isVerifyStep=True)

    pluginSearchTest = Test("Check that plugins search results correctly retrieved")
    pluginSearchTest.addStep('Login with valid Connect credentials',
                             prestep=lambda: _startConectPlugin())
    pluginSearchTest.addStep('Verify that "Knowledge" tab is shown, '
                             'populated with content and no error is thrown',
                             isVerifyStep=True)
    pluginSearchTest.addStep('Switch to the "Plugins" tab, type '
                             '"MIL-STD-2525" in the search field '
                             'and press search button')
    pluginSearchTest.addStep('Verify that single plugin result returned.',
                             isVerifyStep=True)

    rolesDisplayTest = Test("Check roles display")
    rolesDisplayTest.addStep('Enter valid (non-enterprise) Connect credentials and press "Login" button.',
                             prestep=lambda: _startConectPlugin())
    rolesDisplayTest.addStep('Verify that "Knowledge" tab is shown, '
                             'populated with content and no error is thrown',
                             isVerifyStep=True)
    rolesDisplayTest.addStep('Switch to the "Plugin" tab. Type '
                             '"MIL-STD-2525" in the search box and '
                             'press Enter. Verify that one plugin result '
                             'is shown and is not available (orange)',
                             isVerifyStep=True)
    rolesDisplayTest.addStep('Click on "MIL-STD-2525" and verify it '
                             'opens a browser where the user can '
                             'subscribe to Boundless Connect',
                             isVerifyStep=True)
    rolesDisplayTest.addStep('Click on the "Logout" button')
    rolesDisplayTest.addStep('Login with credentials for "Desktop Enterprise"')
    rolesDisplayTest.addStep('Verify that "Knowledge" tab is shown, '
                             'populated with content and no error is thrown',
                             isVerifyStep=True)
    rolesDisplayTest.addStep('Switch to the "Plugin" tab. Type '
                             '"MIL-STD-2525" in the search box and '
                             'press Enter. Verify that one plugin result '
                             'is shown and is available (blue)',
                             isVerifyStep=True)
    rolesDisplayTest.addStep('Click on "MIL-STD-2525" and verify it '
                             'install the plugins or tells you that it '
                             'is already installed',
                             isVerifyStep=True)

    basemapsLoadingTest = Test("Check basemaps loading")
    basemapsLoadingTest.addStep('Login with credentials for "Desktop Enterprise".',
                                prestep=lambda: _startConectPlugin())
    basemapsLoadingTest.addStep('Verify that "Knowledge" tab is shown, '
                                'populated with content and no error is thrown',
                                isVerifyStep=True)
    basemapsLoadingTest.addStep('Type "mapbox" in the search box and '
                                'switch to the "Data" tab. Verify that '
                                'list of the basemaps shown.',
                                isVerifyStep=True)
    basemapsLoadingTest.addStep('Press "ADD TO MAP" button under any '
                                'basemap and verify that basemap added '
                                'to the current project and no error is thrown.',
                                isVerifyStep=True)
    basemapsLoadingTest.addStep('Pan canvas in different directions, '
                                'zoom in and out to ensure that basemap '
                                'is working correctly and no error is thrown.',
                                isVerifyStep=True)
    basemapsLoadingTest.addStep('Press "ADD TO MAP" button under another '
                                'basemap from the search results and '
                                'verify that second basemap added to '
                                'the current project and no error is thrown.',
                                isVerifyStep=True)
    basemapsLoadingTest.addStep('Pan canvas in different directions, '
                                'zoom in and out to ensure that basemap '
                                'is working correctly and no error is thrown.',
                                isVerifyStep=True)
    basemapsLoadingTest.addStep('Change visibility of both basemaps, '
                                'reorder them in the layer tree to '
                                'ensure that they are working correctly '
                                'and no error is thrown.',
                                isVerifyStep=True)

    defaultProjectTest = Test("Check simple default project")
    defaultProjectTest.addStep('Login with credentials for "Desktop Enterprise".',
                                prestep=lambda: _startConectPlugin())
    defaultProjectTest.addStep('Switch to the "Data" tab. Type "mapbox" '
                                'in the search box and press Enter. '
                                'Verify that list of the basemaps shown.',
                                isVerifyStep=True)
    defaultProjectTest.addStep('Press "ADD TO DEFAULT PROJECT" button '
                               'under any basemap and verify that '
                               'message saying it was added to the '
                               'default project shown and no error '
                               'is thrown.',
                                isVerifyStep=True)
    defaultProjectTest.addStep('Press "New project" button at the QGIS '
                               'toolbar and verify new project with '
                               'basemap added by default created.',
                                isVerifyStep=True)
    defaultProjectTest.addStep('Change visibility of basemap, zoom in '
                               'and out, pan acros the map to ensure '
                               'that it works correctly and no error '
                               'is thrown.',
                                isVerifyStep=True)
    defaultProjectTest.addStep('Unset default project',
                               function=lambda: basemaputils.unsetDefaultProject())

    complexDefaultProjectTest = Test("Check complex default project")
    complexDefaultProjectTest.addStep('Login with credentials for "Desktop Enterprise".',
                                      prestep=lambda: _startConectPlugin())
    complexDefaultProjectTest.addStep('Switch to the "Data" tab. Type "mapbox" '
                                      'in the search box and press Enter. '
                                      'Verify that list of the basemaps shown.',
                                      isVerifyStep=True)
    complexDefaultProjectTest.addStep('Press "ADD TO DEFAULT PROJECT" button '
                                      'under any basemap and verify that '
                                      'message saying it was added to the '
                                      'default project shown and no error '
                                      'is thrown.',
                                      isVerifyStep=True)
    complexDefaultProjectTest.addStep('Press "ADD TO DEFAULT PROJECT" button '
                                      'under another basemap and verify that '
                                      'message saying it was added to the '
                                      'default project shown and no error '
                                      'is thrown.',
                                      isVerifyStep=True)
    complexDefaultProjectTest.addStep('Press "New project" button at the QGIS '
                                      'toolbar and verify new project with '
                                      'two basemaps added by default created.',
                                      isVerifyStep=True)
    complexDefaultProjectTest.addStep('Change visibility of basemap, '
                                      'reorder them in layer tree, zoom in '
                                      'and out, pan acros the map to ensure '
                                      'that it works correctly and no error '
                                      'is thrown.',
                                      isVerifyStep=True)
    complexDefaultProjectTest.addStep('Unset default project',
                                      function=lambda: basemaputils.unsetDefaultProject())

    lessonsInstallTest = Test("Check lessons installation")
    lessonsInstallTest.addStep('Login with credentials for "Desktop Enterprise".',
                               prestep=lambda: _startConectPlugin())
    lessonsInstallTest.addStep('Switch to the "Plugins" tab. Type "lessons" '
                               'in the search box and press Enter. '
                               'Verify that single plugin result is '
                               'shown and available for installation '
                               '(button color is blue).',
                               isVerifyStep=True)
    lessonsInstallTest.addStep('Press "INSTALL" button and verify that '
                               'plugin installed, activated and no error '
                               'is thrown.',
                               isVerifyStep=True)
    lessonsInstallTest.addStep('Switch to the "Knowledge" tab, enter '
                               '"lesson" in the search box and select '
                               '"Lessons" from the "Search in" combobox. '
                               'Press Enter to perform search, verify '
                               'that lessons results are shown and no '
                               'available (buttons are blue) and no '
                               'error is thrown.',
                               isVerifyStep=True)
    lessonsInstallTest.addStep('Press "LESSON" button under any lesson '
                               'result and verify that lessons installed, '
                               'activated and no error is thrown.',
                               isVerifyStep=True)

    helpTest = Test("Check Help displaying")
    helpTest.addStep('Click on "Help" button and verify help is '
                     'correctly open in a browser.',
                     prestep=lambda: _startConectPlugin())

    toggleVisibilityTest = Test("Check visibility toggling")
    toggleVisibilityTest.addStep('Close Connect dock.',
                                 prestep=lambda: _startConectPlugin())
    toggleVisibilityTest.addStep('Open dock from menu "Plugins -> Boundless '
                                 'Connect". Verify that dock opened with '
                                 'active login screen.',
                                 isVerifyStep=True)
    toggleVisibilityTest.addStep('Close Connect dock.')
    toggleVisibilityTest.addStep('Right-click on QGIS toolbar and check '
                                 '"Boundless Connect" panel. Verify that '
                                 'dock opened with active login screen.',
                                 isVerifyStep=True)
    toggleVisibilityTest.addStep('Enter valid Connect credentials and press "Login" button and then '
                                 'close dock.')
    toggleVisibilityTest.addStep('Open dock from menu "Plugins -> Boundless '
                                 'Connect". Verify that dock opened with '
                                 'active search screen.',
                                 isVerifyStep=True)
    toggleVisibilityTest.addStep('Close dock.')
    toggleVisibilityTest.addStep('Right-click on QGIS toolbar and check '
                                '"Boundless Connect" panel. Verify that '
                                'dock opened with active search screen.',
                                 isVerifyStep=True)


    return [emptyCredentialsTest, invalidCredentialsTest, repeatedLoginTest,
            invalidEndpointTest, emptySearchTest, searchTest, paginationTest,
            wrongSearchTest, categorySearchTest, pluginSearchTest, rolesDisplayTest,
            basemapsLoadingTest, defaultProjectTest, complexDefaultProjectTest,
            lessonsInstallTest, helpTest, toggleVisibilityTest]
Exemple #34
0
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    dragdropTest = Test("Verify dragging browser element into workspace")
    # pki context setup
    dragdropTest.addStep("Setting up pki auth context", utils.initAuthManager)
    dragdropTest.addStep("configuring pki auth context", utils.populatePKITestCerts)
    # normal steps
    dragdropTest.addStep("Setting up catalog and explorer", utils.setUpCatalogAndExplorer)
    dragdropTest.addStep("Setting up test data project", utils.loadTestData)
    dragdropTest.addStep("Drag layer from browser 'Project home->qgis_plugin_test_pt1.shp' into\ntest_catalog->Workspaces->test_workspace")
    dragdropTest.addStep("Checking new layer", utils.checkNewLayer)
    # cleaup with clean of pki context
    dragdropTest.setCleanup(utils.cleanAndPki)

    vectorRenderingTest = Test("Verify rendering of uploaded style")
    # pki context setup
    vectorRenderingTest.addStep("Setting up pki auth context", utils.initAuthManager)
    vectorRenderingTest.addStep("configuring pki auth context", utils.populatePKITestCerts)
    # normal steps
    vectorRenderingTest.addStep("Preparing data", utils.openAndUpload)
    vectorRenderingTest.addStep("Check that WMS layer is correctly rendered")
    # cleaup with clean of pki context
    vectorRenderingTest.setCleanup(utils.cleanAndPki)

    return [dragdropTest, vectorRenderingTest]
Exemple #35
0
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    logTest = Test(
        "Verify in-app message log has no errors for default install. QGIS-62")
    logTest.addStep("Open log messages panel",
                    prestep=lambda: _openLogMessagesDialog())
    logTest.addStep("Review 'General' tab output. Check it has no issues",
                    isVerifyStep=True)
    logTest.addStep("Check there are no errors in 'Plugins' tab",
                    isVerifyStep=True)
    logTest.addStep(
        "If exists, check there are no errors in 'Python warning' tab",
        isVerifyStep=True)
    logTest.addStep("If exists, check there are no errors in 'Qt' tab",
                    isVerifyStep=True)
    logTest.addStep(
        "Review the Init Script, check there are no errors in 'Qt' tab",
        isVerifyStep=True)
    logTest.addStep(
        "Review any other existing tabs, check that there are no errors",
        isVerifyStep=True)

    spatialiteTest = Test("Test Spatialite. QGIS-120")
    spatialiteTest.addStep("Load Spatialite layer",
                           prestep=lambda: _loadSpatialite())
    spatialiteTest.addStep("Open DB Manager", prestep=lambda: _openDBManager())
    spatialiteTest.addStep(
        "Check that 'test' layer is available "
        "in DB manager, in 'Virtual layers/QGIS layers'",
        isVerifyStep=True)

    aboutTest = Test(
        "Verify dependency versions and providers in About dialog. QGIS-53")
    aboutTest.addStep("Open About dialog", prestep=lambda: _openAboutDialog())
    if sys.platform == 'darwin':
        filePath = os.path.join(testPath, "data", "about.mac")
    else:
        filePath = os.path.join(testPath, "data", "about.windows")
    with open(filePath) as f:
        content = f.readlines()
    data = ""
    for line in content:
        data += "<p>{}</p>".format(line)
    aboutTest.addStep("Verify that content of the About dialog matches"
                      "following data\n{}\n\n".format(data),
                      isVerifyStep=True)

    arcmapTest = Test("Test ArcMapserver")
    arcmapTest.addStep("Load layer", prestep=_loadArcMap)

    arcfeatureTest = Test("Test ArcFeatureserver")
    arcfeatureTest.addStep("Load layer", prestep=_loadArcFeature)

    wcsTest = Test("Test WCS")
    wcsTest.addStep("Load WCS layer", prestep=_loadWcs)

    wfsTest = Test("Test WFS")
    wfsTest.addStep("Modify and load WFS layer", prestep=_modifyAndLoadWfs)

    postgisTest = Test("Test PostGIS")
    postgisTest.addStep("Create and load PostGIS layer",
                        prestep=_addToDbAndLoadLayer)

    offlineTest = Test("WFS Smoke Test (Server) - Offline Editing")
    offlineTest.addStep("Load WFS layer layer", prestep=_loadWfsToBeEdited)
    offlineTest.addStep(
        "Enable *Offline editing* plugin from *Plugins > Manage and install plugins* in the *Installed* tab.",
        isVerifyStep=True)
    offlineTest.addStep(
        "Convert the project to an offline project by selecting *Database > Offline editing > Convert to offline project*. Keep the layer selected and click *OK*.",
        isVerifyStep=True)
    offlineTest.addStep(
        "Enable editing on the recently added layer. Activate the layer in the *Layers* panel and enable editing."
        " In the *Digitizing toolbar* (in the second row of menu icons), click the *Toggle editing* icon (it's a pencil)"
        "or from menus go to *Layer > Toogle Editing* This will allow you to edit the layer.",
        isVerifyStep=True)
    offlineTest.addStep("Click the *Add Feature* icon in the same toolbar.",
                        isVerifyStep=True)
    offlineTest.addStep('''
Click once anywhere in the viewer window - this sets the first vertex of the polygon. Keep clicking other places to add more vertices.

*on OS X*:
to finish the polygon hold the control key down and click (this will add one last vertex).

*on Windows*:
use the right mouse button to end (no other vertex is added).

When you complete the polygon a *Feature Attributes* dialog will pop-up.

Simply click the *Ok* button to dismiss it.
''',
                        isVerifyStep=True)
    offlineTest.addStep(
        "Click the *Save Layer Edits* icon or go to *Layer > Save Layer Edits* menu.",
        isVerifyStep=True)
    offlineTest.addStep(
        "Click the *Toggle Editing* icon or select the 'Toggle Editing' menu item under Layer.",
        isVerifyStep=True)
    offlineTest.addStep(
        "Sync the project by selecting *Database > Offline editing > Synchronize*",
        isVerifyStep=True)
    offlineTest.addStep(
        "Verify that your changes were stored on the GeoServer. Compare the edited layer with the new one, and verify that they are identical.",
        prestep=lambda: _loadWfsToBeEdited("testlayer_afterediting"),
        isVerifyStep=True)

    return [
        spatialiteTest, logTest, aboutTest, wcsTest, wfsTest, arcmapTest,
        arcfeatureTest, postgisTest, offlineTest
    ]
def functionalTests():
    ''' functional tests. e.g. intergration test or all tests that require user interacion '''
    try:
        from qgistester.test import Test
    except:
        return []

    _tests = []

    function1Test = Test("Function 1 description")
    function1Test.addStep("do preparation step 1", function1Step1)
    function1Test.addStep(
        "Message to user to do some action => press 'next step'")
    function1Test.addStep("do previous step check", function1Step2)
    function1Test.setCleanup(cleanUpFunction1)
    _tests.append(function1Test)

    function2Test = Test("Function 2 description")
    function2Test.addStep("do preparation step 1", function2Step1)
    function2Test.addStep(
        "Message to user to do some action => press 'next step'")
    function2Test.addStep("do previous step check", function2Step2)
    function2Test.setCleanup(cleanUpFunction2)
    _tests.append(function2Test)

    return _tests
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    # advanced setting editing are reset after closing of options gui - #26327
    testAdvancedSettings = Test('Advanced settings editor saves changes',
                                category='Regression tests')
    testAdvancedSettings.setIssueUrl(
        'https://github.com/qgis/QGIS/issues/26327')
    testAdvancedSettings.addStep(
        'Open QGIS Settings and change some values using Advanced Settings Editor and close dialog by pressing OK button.',
        prestep=lambda: _showOptions(),
        busyCursor=False)
    testAdvancedSettings.addStep(
        'Open QGIS Settings again. Check that previously changed settings have correct values.',
        prestep=lambda: _showOptions(),
        isVerifyStep=True,
        busyCursor=False)

    # adding WMTS from Browser paner - #36264
    testBrowserAddWmts = Test('Adding WMTS from Browser',
                              category='Regression tests')
    testBrowserAddWmts.setIssueUrl('https://github.com/qgis/QGIS/issues/36264')
    testBrowserAddWmts.addStep('Create test WMTS connection.',
                               function=lambda: _addWmtsConnection())
    testBrowserAddWmts.addStep(
        'Expand "WMS/WMTS" node in the Browser panel. Then expand "TesterPlugin" connection.'
    )
    testBrowserAddWmts.addStep(
        'Try to add layer "112 Par satellite" from the Browser to QGIS canvas. Check that QGIS prompts for date and after setting a date layer added to canvas and visible.',
        isVerifyStep=True)
    testBrowserAddWmts.setCleanup(lambda: _removeWmtsConnection())

    # adding rows in the Processing batch interface - #39696
    testAddBatchRows = Test('Adding new rows in Processing batch interface',
                            category='Regression tests')
    testAddBatchRows.setIssueUrl('https://github.com/qgis/QGIS/issues/39696')
    testAddBatchRows.addStep('Start native "Buffer" algorithm in batch mode',
                             prestep=lambda: _runProcessingBatch(),
                             busyCursor=False)
    testAddBatchRows.addStep(
        'Check that every time green plus button in the dialog toolbar is pressed a new row added to the batch.',
        isVerifyStep=True)
    testAddBatchRows.addStep('Close dialog by pressing "Close" button.')

    # filename prefix not shown when loading GPX or similar files - #37551
    testGpxFilenamePrefix = Test(
        'Filename prefix is not shown when adding layers from GPX',
        category='Regression tests')
    testGpxFilenamePrefix.setIssueUrl(
        'https://github.com/qgis/QGIS/issues/37551')
    testGpxFilenamePrefix.addStep(
        'Add GPX layer to QGIS. Ensure that all layers in the "Select Vector Layers to Add" dialog are selected and "Add layers to group" checkbox is checked. Press "OK" button',
        prestep=lambda: iface.addVectorLayer(
            os.path.join(dataPath, 'elev.gpx'), 'elev', 'ogr'),
        busyCursor=False)
    testGpxFilenamePrefix.addStep(
        'Check that in the layer tree there is an "elev" group with 5 layers inside it and layer names are not prefixed with the "elev".',
        isVerifyStep=True)
    testGpxFilenamePrefix.addStep(
        'Remove group with layers from the project.',
        function=lambda: QgsProject.instance().clear())
    testGpxFilenamePrefix.addStep(
        'Add GPX layer to QGIS. Ensure that all layers in the "Select Vector Layers to Add" dialog are selected and "Add layers to group" checkbox is NOT checked. Press "OK" button',
        prestep=lambda: iface.addVectorLayer(
            os.path.join(dataPath, 'elev.gpx'), 'elev', 'ogr'),
        busyCursor=False)
    testGpxFilenamePrefix.addStep(
        'Check that in the layer tree there are 5 layers and their layer names are prefixed with the "elev".',
        isVerifyStep=True)
    testGpxFilenamePrefix.setCleanup(lambda: QgsProject.instance().clear())

    # check Processing providers
    testProcessingProviders = Test('Processing providers are functional',
                                   category='Installation Smoke tests')
    testProcessingProviders.addStep(
        'Open Processing toolbox from the "Processing -> Toolbox" menu')
    testProcessingProviders.addStep(
        'Verify that native QGIS tools groups are exist in the Processing toolbox.',
        isVerifyStep=True)
    testProcessingProviders.addStep(
        'Verify that the GDAL group is exist in the Processing toolbox and that it contains several sub-groups.',
        isVerifyStep=True)
    testProcessingProviders.addStep(
        'Verify that the GRASS group is exist in the Processing toolbox and that it contains several sub-groups.',
        isVerifyStep=True)
    testProcessingProviders.addStep(
        'Verify that the SAGA group is exist in the Processing toolbox and that it contains several sub-groups.',
        isVerifyStep=True)

    return [
        testAdvancedSettings,
        testBrowserAddWmts,
        testAddBatchRows,
        testGpxFilenamePrefix,

        # generic tests not linked to any ticket
        testProcessingProviders
    ]
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    dragdropTest = Test("Verify dragging browser element into workspace")
    dragdropTest.addStep("Setting up pki auth context", lambda: utils.setUtilContext(pki=True))
    dragdropTest.addStep("Setting up catalog and explorer", utils.setUpCatalogAndExplorer)
    dragdropTest.addStep("Setting up test data project", utils.loadTestData)
    dragdropTest.addStep("Drag layer from browser 'Project home->qgis_plugin_test_pt1.shp' into\ntest_catalog->Workspaces->test_workspace")
    dragdropTest.addStep("Checking new layer", utils.checkNewLayer)
    dragdropTest.setCleanup(utils.clean)

    vectorRenderingTest = Test("Verify rendering of uploaded style")
    vectorRenderingTest.addStep("Setting up basic pki context", lambda: utils.setUtilContext(pki=True))
    vectorRenderingTest.addStep("Preparing data", utils.openAndUpload)
    vectorRenderingTest.addStep("Check that WMS layer is correctly rendered")
    vectorRenderingTest.setCleanup(utils.clean)

    return [dragdropTest, vectorRenderingTest]
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    openPluginManagerTest = Test('Verify that Boundless Connect can start Plugin Manager')
    openPluginManagerTest.addStep('Check that OpenGeo Explorer listed in Plugin Manager as well as plugins from QGIS repository',
                                prestep=lambda: _openPluginManager(False), isVerifyStep=True)
    openPluginManagerTest.setIssueUrl("https://issues.boundlessgeo.com:8443/browse/QGIS-325")

    openPluginManagerBoundlessOnlyTest = Test('Verify that Boundless Connect can start Plugin Manager only with Boundless plugins')
    openPluginManagerBoundlessOnlyTest.addStep('Check that Plugin manager is open and contains only Boundless plugins',
                                prestep=lambda: _openPluginManager(True), isVerifyStep=True)
    openPluginManagerBoundlessOnlyTest.setIssueUrl("https://issues.boundlessgeo.com:8443/browse/QGIS-325")

    coreConnectUpdateTest = Test('Test updating core Connect plugin via Plugin Manager')
    coreConnectUpdateTest.addStep('Downgrade installed Connect plugin', lambda: _downgradePlugin('boundlessconnect'))
    coreConnectUpdateTest.addStep('Check that Connect plugin is upgradable',
                                  prestep=lambda: _openPluginManager(True), isVerifyStep=True)
    coreConnectUpdateTest.addStep('Upgrade Connect plugin')
    coreConnectUpdateTest.addStep('Check that Connect plugin updated, loaded from user folder and has latest version', isVerifyStep=True)
    coreConnectUpdateTest.setIssueUrl("https://issues.boundlessgeo.com:8443/browse/QGIS-602")
    coreConnectUpdateTest.setCleanup(lambda: _restoreVersion('boundlessconnect'))

    return [openPluginManagerTest, openPluginManagerBoundlessOnlyTest, coreConnectUpdateTest]
Exemple #40
0
def functionalTests():
    try:
        from qgistester.test import Test
        from qgistester.utils import layerFromName
    except:
        return []

    def _createWebApp(n):
        global webAppFolder
        webAppFolder = createAppFromTestAppdef(n)

    def _test(n):
        test = Test("Verify '%s' tutorial" % n)
        test.addStep("Setting up project", lambda: loadTestProject(n))
        test.addStep("Creating web app", lambda: _createWebApp(n))
        test.addStep("Verify web app in browser",
                     prestep=lambda:
                     webbrowser.open_new("file:///" + webAppFolder.replace(
                         "\\", "/") + "/webapp/index_debug.html"))
        return test

    tests = [_test("bakeries"), _test("schools"), _test("fires")]

    unconfiguredBookmarksTest = Test(
        "Verify bookmarks widget cannot be used if no bookmarks defined")
    unconfiguredBookmarksTest.addStep("Load project",
                                      lambda: loadTestProject())
    unconfiguredBookmarksTest.addStep("Open WAB", lambda: openWAB())
    unconfiguredBookmarksTest.addStep(
        "Try to create an app with the bookmarks widget, without configuring it to add bookmarks.\n"
        "Verify it shows a warning.")
    unconfiguredBookmarksTest.setCleanup(closeWAB)
    tests.append(unconfiguredBookmarksTest)

    unsupportedSymbologyTest = Test("Verify warning for unsupported symbology")
    unsupportedSymbologyTest.addStep("Load project", lambda: loadTestProject())
    unsupportedSymbologyTest.addStep("Open WAB", openWAB)
    unsupportedSymbologyTest.addStep(
        "Click on 'Preview'. Verify a warning about unsupported symbology is shown.\n"
        "Verify it shows a warning.")
    tests.append(unsupportedSymbologyTest)
    unsupportedSymbologyTest.setCleanup(closeWAB)

    wrongLogoTest = Test("Verify warning for wrong logo file")
    wrongLogoTest.addStep("Load project", lambda: loadTestProject())
    wrongLogoTest.addStep("Open WAB", openWAB)
    wrongLogoTest.addStep(
        "Enter 'wrong' in the logo textbox and click on 'Preview'."
        "The logo texbox should get a yellow background.")
    wrongLogoTest.setCleanup(closeWAB)
    tests.append(wrongLogoTest)

    previewWithAllWidgetsTest = Test("Verify preview of an app with all tests")
    previewWithAllWidgetsTest.addStep("Load project",
                                      lambda: loadTestProject("layers"))
    appdef = testAppdef("allwidgets", False)
    previewWithAllWidgetsTest.addStep("Open WAB", lambda: openWAB(appdef))
    previewWithAllWidgetsTest.addStep(
        "Click on 'Preview' and verify app is correctly shown and it works.")
    previewWithAllWidgetsTest.setCleanup(closeWAB)
    tests.append(previewWithAllWidgetsTest)

    return tests
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    userProfileAutosaveTest = Test("""Check that user profile is saved on first execution""")
    userProfileAutosaveTest.addStep("Rename user profile folder", _deleteUserProfiles)
    userProfileAutosaveTest.addStep("Select any profile in the profiles menu")
    userProfileAutosaveTest.addStep("Check file was created", _checkFileCreated)
    userProfileAutosaveTest.setCleanup(_recoverUserProfiles)

    userProfileAutosaveFromManagerTest = Test("""Check that user profile is saved on first execution from Profiles Manager""")
    userProfileAutosaveFromManagerTest.addStep("Rename user profile folder", _deleteUserProfiles)
    userProfileAutosaveFromManagerTest.addStep("Select any profile and set it. "
                                               "Check that a new entry appears under the 'user profiles' group",
                                               prestep = _openProfileManager, isVerifyStep = True)
    userProfileAutosaveFromManagerTest.addStep("Check file was created", _checkFileCreated)
    userProfileAutosaveFromManagerTest.setCleanup(lambda: _runFunctions([_closeProfileManager, _recoverUserProfiles]))

    noMenusTest = Test("""Check that a profile with no buttons is correctly applied""")
    noMenusTest.addStep("Save previous state", _savePreviousState)
    noMenusTest.addStep("Apply profile", lambda: applyProfile("nobuttons.json"))
    noMenusTest.addStep("Verify no toolbar is visible")
    noMenusTest.setCleanup(_recoverPreviousState)

    noMenusFromManagerTest = Test("""Check that a profile is correctly applied from the Plugin Manager""")
    noMenusFromManagerTest.addStep("Save previous state", _savePreviousState)
    noMenusFromManagerTest.addStep("Open profile manager", lambda: _openProfileManager)
    noMenusFromManagerTest.addStep("Set the 'no buttons' profile. Verify it has been applied and no toolbar is visible", isVerifyStep=True)
    noMenusFromManagerTest.setCleanup(_recoverPreviousState)

    cannotInstallPlugin = Test("""Check that when a plugin cannot be installed, a warning is shown""")
    cannotInstallPlugin.addStep("Save previous state", _savePreviousState)
    cannotInstallPlugin.addStep("Apply profile", lambda: applyProfile("wrongplugin.json"))
    cannotInstallPlugin.addStep("Verify warning is displayed: 'profile applied with errors'")
    cannotInstallPlugin.setCleanup(_recoverPreviousState)

    correctlySetPanelsTest = Test("""Check that panels are correctly set by profile""")
    correctlySetPanelsTest.addStep("Save previous state", _savePreviousState)
    correctlySetPanelsTest.addStep("Apply profile", lambda: applyProfile("onlyonepanel.json"))
    correctlySetPanelsTest.addStep("Verify log panel is the only visible panel")
    correctlySetPanelsTest.setCleanup(_recoverPreviousState)

    correctlySetPythonConsoleTest = Test("""Check that Python console is correctly handled""")
    correctlySetPythonConsoleTest.addStep("Save previous state", _savePreviousState)
    correctlySetPythonConsoleTest.addStep("Apply profile", lambda: applyProfile("pythonconsole.json"))
    correctlySetPythonConsoleTest.addStep("Verify Python console is visible")
    correctlySetPythonConsoleTest.setCleanup(_recoverPreviousState)

    renameMenuTest = Test("""Check that menu rename is correctly performed""")
    renameMenuTest.addStep("Save previous state", _savePreviousState)
    renameMenuTest.addStep("Apply profile", lambda: applyProfile("renamemenu.json"))
    renameMenuTest.addStep("Verify Processing Toolbox menu entry has been renamed")
    renameMenuTest.setCleanup(_recoverPreviousState)

    customButtonsTest = Test("""Check that custom toolbars are correctly created""")
    customButtonsTest.addStep("Save previous state", _savePreviousState)
    customButtonsTest.addStep("Apply profile", lambda: applyProfile("onlynavigationtoolbar.json"))
    customButtonsTest.addStep("Verify map navigation toolbar is the only one visible, and is splitted into two toolbars",
                              isVerifyStep = True)
    customButtonsTest.addStep("Recover previous state", _recoverPreviousState)
    customButtonsTest.addStep("Verify navigation toolbar is not split anymore")

    def _enableProcessing():
        loadPlugin("processing")
        startPlugin("processing")
        QtCore.QSettings().setValue('/PythonPlugins/processing', True)
        updateAvailablePlugins()
        updatePluginManager()
        assert "processing" in active_plugins

    processingIgnoredTest = Test("""Check Processing is ignored""")
    processingIgnoredTest.addStep("Enable Processing", _enableProcessing)
    processingIgnoredTest.addStep("Save previous state", _savePreviousState)
    processingIgnoredTest.addStep("Apply profile", lambda: applyProfile("noplugins.json"))
    processingIgnoredTest.addStep("Verify Processing menu is available")
    processingIgnoredTest.setCleanup(_recoverPreviousState)

    profilesPluginIgnoredTest = Test("""Check Profiles entries are ignored when setting up menus""")
    profilesPluginIgnoredTest.addStep("Save previous state", _savePreviousState)
    profilesPluginIgnoredTest.addStep("Apply profile", lambda: applyProfile("nomenus.json"))
    profilesPluginIgnoredTest.addStep("Verify Settings/Profiles menus are available")
    profilesPluginIgnoredTest.setCleanup(_recoverPreviousState)

    def _removeTestPlugin():
        unloadPlugin("what3words")
        updateAvailablePlugins()
        updatePluginManager()
        assert "what3words" not in available_plugins

    def _checkTestPlugin():
        assert "what3words" in active_plugins

    correctlyDownloadPluginTest = Test("""Check plugin is correctly downloaded and installed""")
    correctlyDownloadPluginTest.addStep("Save previous state", _savePreviousState)
    correctlyDownloadPluginTest.addStep("Manually remove what3words if installed")#TODO:automate this
    correctlyDownloadPluginTest.addStep("Apply profile", lambda: applyProfile("onlyoneplugin.json"))
    correctlyDownloadPluginTest.addStep("Verify plugin is installed", _checkTestPlugin)
    correctlyDownloadPluginTest.addStep("Verify Plugins/what3words plugin menu is available")
    correctlyDownloadPluginTest.setCleanup(_recoverPreviousState)

    folder = os.path.join(os.path.dirname(os.path.dirname(__file__)), "userprofiles")
    profilesCount = len([name for name in os.listdir(folder) if name.endswith(".json")])
    setMenuEntriesTest = Test("""Check that menu entries are correctly created""")
    setMenuEntriesTest.addStep("Verify settings/profiles menu has %i available profiles" % profilesCount)

    noEmptyMenusTest = Test("""Check that no empty menus are shown""")
    noEmptyMenusTest.addStep("Save previous state", _savePreviousState)
    noEmptyMenusTest.addStep("Apply profile", lambda: applyProfile("noemptymenus.json"))
    noEmptyMenusTest.addStep("Verify that the 'Layers/New Layer' menu does not exist")
    noEmptyMenusTest.setCleanup(_recoverPreviousState)

    createCustomProfileTest = Test("""Check that the current state is correctly saved in manager""")
    createCustomProfileTest.addStep("Rename user profile folder", _deleteUserProfiles)
    createCustomProfileTest.addStep("Create a new profile with the current configuration and check that the profile appears in the profiles tree",
                                                prestep = _openProfileManager, isVerifyStep = True)
    createCustomProfileTest.addStep("Click on the profile. In the description panel, click on 'delete profile' and check that the profile is deleted",
                                                prestep = _openProfileManager, isVerifyStep = True)
    createCustomProfileTest.setCleanup(lambda: _runFunctions([_closeProfileManager, _recoverUserProfiles]))

    expandBoxesInToolBarTest = Test("""Check boxes are expanded in toolbars""")
    expandBoxesInToolBarTest.addStep("Save previous state", _savePreviousState)
    expandBoxesInToolBarTest.addStep("Apply profile", lambda: applyProfile("decision_maker.json"))
    expandBoxesInToolBarTest.addStep("Verify search box in toolbar has a normal size (not too small)")
    expandBoxesInToolBarTest.setCleanup(_recoverPreviousState)

    customLayersTest = Test("""Check that custom layers are kept on profiles changing""")
    customLayersTest.addStep("Save previous state", _savePreviousState)
    customLayersTest.addStep("Apply profile", lambda: applyProfile("data_manager.json"))
    customLayersTest.addStep("Add raster layer using QuickMapServices plugin", isVerifyStep=False)
    customLayersTest.addStep("Apply profile", lambda: applyProfile("decision_maker.json"))
    customLayersTest.addStep("Verify that raster layer still loaded in project")
    customLayersTest.setCleanup(_recoverPreviousState)


    return [userProfileAutosaveTest, userProfileAutosaveFromManagerTest,
            noMenusTest, noMenusFromManagerTest, cannotInstallPlugin,
            correctlySetPanelsTest, renameMenuTest, customButtonsTest,
            processingIgnoredTest, profilesPluginIgnoredTest,
            correctlyDownloadPluginTest, setMenuEntriesTest, noEmptyMenusTest,
            createCustomProfileTest, correctlySetPythonConsoleTest,
            expandBoxesInToolBarTest, customLayersTest
            ]
Exemple #42
0
def functionalTests():
    test = Test('Functional test')
    test.addStep('Step 1', prestep=lambda: True, isVerifyStep=True)
    test.addStep('Step 1', prestep=lambda: True, isVerifyStep=True)
    test.setIssueUrl("http://www.example.com")
    return [test]
def functionalTests():
    # create TestCase instance to use Assert methods
    tc = unittest.TestCase('__init__')

    try:
        from qgistester.test import Test
        from qgistester.utils import layerFromName
    except:
        return []

    def _createWebApp(n, preview=True, aboutContent=None):
        global webAppFolder
        webAppFolder = createAppFromTestAppdef(n, preview, aboutContent)

    def _test(n):
        test = Test("Verify '%s' tutorial" % n)
        test.addStep("Setting up project", lambda: loadTestProject(n))
        test.addStep("Creating web app", lambda: _createWebApp(n))
        test.addStep("Verify web app in browser",
                     prestep=lambda:
                     webbrowser.open_new("file:///" + webAppFolder.replace(
                         "\\", "/") + "/webapp/index_debug.html"))
        return test

    tests = [_test("bakeries"), _test("schools"), _test("fires")]

    appdefFolder = os.path.join(os.path.dirname(__file__), "data")

    def _testWidget(n):
        aboutContent = widgetTestAbout.get(n, None)
        test = Test("Verify '%s' widget" % n)
        test.addStep("Setting up project", lambda: loadTestProject("widgets"))
        test.addStep("Creating web app",
                     lambda: _createWebApp(n, True, aboutContent))
        test.addStep("Verify web app in browser",
                     prestep=lambda:
                     webbrowser.open_new("file:///" + webAppFolder.replace(
                         "\\", "/") + "/webapp/index_debug.html"))
        return test

    for w in widgets:
        for i in ["", "2", "3"]:
            testName = w + i
            f = os.path.join(appdefFolder, "%s.appdef" % testName)
            if os.path.exists(f):
                tests.append(_testWidget(testName))

    def _openComparison(n):
        webbrowser.open_new("file:///" +
                            os.path.dirname(__file__).replace("\\", "/") +
                            "/expected/apps/%s/index_debug.html" % n)
        webbrowser.open_new("file:///" + webAppFolder.replace("\\", "/") +
                            "/webapp/index_debug.html")

    def _comparisonTest(n):
        test = Test("Symbology test '%s'" % n)
        test.addStep("Setting up project", lambda: loadTestProject(n))
        test.addStep("Creating web app", lambda: _createWebApp(n))
        test.addStep("Compare web app with expected app in browser",
                     prestep=lambda: _openComparison(n))
        return test

    comparisonTests = [
        "points", "points2", "osm", "polygons", "labels", "arrows"
    ]
    for t in comparisonTests:
        tests.append(_comparisonTest(t))

    unconfiguredBookmarksTest = Test(
        "Verify bookmarks widget cannot be used if no bookmarks defined")
    unconfiguredBookmarksTest.addStep("Load project",
                                      lambda: loadTestProject())
    unconfiguredBookmarksTest.addStep("Open WAB", lambda: openWAB())
    unconfiguredBookmarksTest.addStep(
        "Try to create an app with the bookmarks widget, without configuring it to add bookmarks.\n"
        "Verify it shows a warning.")
    unconfiguredBookmarksTest.setCleanup(closeWAB)
    tests.append(unconfiguredBookmarksTest)

    unsupportedSymbologyTest = Test("Verify warning for unsupported symbology")
    unsupportedSymbologyTest.addStep("Load project", lambda: loadTestProject())
    unsupportedSymbologyTest.addStep("Open WAB", openWAB)
    unsupportedSymbologyTest.addStep(
        "Click on 'Preview'. Verify a warning about unsupported symbology is shown."
    )
    unsupportedSymbologyTest.setCleanup(closeWAB)
    tests.append(unsupportedSymbologyTest)

    wrongLogoTest = Test("Verify warning for wrong logo file")
    wrongLogoTest.addStep("Load project", lambda: loadTestProject())
    wrongLogoTest.addStep("Open WAB", openWAB)
    wrongLogoTest.addStep(
        "Enter 'wrong' in the logo textbox and click on 'Preview'."
        "The logo texbox should get a yellow background.")
    wrongLogoTest.setCleanup(closeWAB)
    tests.append(wrongLogoTest)

    nodataTest = Test("Verify that NODATA values are transparent")
    nodataTest.addStep("Load project", lambda: loadTestProject("nodata"))
    nodataTest.addStep("Creating web app", lambda: _createWebApp("nodata"))
    nodataTest.addStep(
        "Verify web app in browser. NODATA values should be transparent. "
        "<b>NOTE</b> don't use Chrome/Chromium to check this web app they "
        "have bug and it might not work as expected. Use Firefox or another browser.",
        prestep=lambda: webbrowser.open_new("file:///" + webAppFolder.replace(
            "\\", "/") + "/webapp/index_debug.html"))
    tests.append(nodataTest)

    createEmpyAppTest = Test("Verify preview an app with no layers")
    createEmpyAppTest.addStep("Load project", iface.newProject)
    createEmpyAppTest.addStep("Open WAB", lambda: openWAB())
    createEmpyAppTest.addStep(
        "Create an app preview and check it is correctly created")
    createEmpyAppTest.setCleanup(closeWAB)
    tests.append(createEmpyAppTest)

    wrongEndpointTest = Test("Verify wrong SDK service URL")
    wrongEndpointTest.addStep("Load project", iface.newProject)
    wrongEndpointTest.addStep("Load project", _setWrongSdkEndpoint)
    wrongEndpointTest.addStep("Open WAB", lambda: openWAB())
    wrongEndpointTest.addStep(
        "Try to create an app and check it complains of a wrong URL")
    wrongEndpointTest.setCleanup(_resetSdkEndpoint)
    tests.append(wrongEndpointTest)

    wmsTimeinfoTest = Test("Verify that spatio-temporal WMS layers supported")
    wmsTimeinfoTest.addStep("Load project",
                            lambda: loadTestProject("wms-timeinfo-interval"))
    wmsTimeinfoTest.addStep(
        "Creating web app",
        lambda: _createWebApp("wms-timeinfo-interval", checkApp=True))
    wmsTimeinfoTest.addStep(
        "Verify web app in browser.",
        prestep=lambda: webbrowser.open_new("file:///" + webAppFolder.replace(
            "\\", "/") + "/webapp/index_debug.html"))
    tests.append(wmsTimeinfoTest)

    try:
        from boundlessconnect.tests.testerplugin import _startConectPlugin
        denyCompilationTest = Test(
            "Verify deny compilation for invalid Connect credentials")
        denyCompilationTest.addStep("Reset project", iface.newProject)
        denyCompilationTest.addStep(
            'Enter invalid Connect credentials and accept dialog by pressing "Login" button.\n'
            'Check that Connect shows Warning message complaining about only open access permissions.'
            'Close error message by pressing "Yes" button.',
            prestep=lambda: _startConectPlugin(),
            isVerifyStep=True)
        denyCompilationTest.addStep("Open WAB", lambda: openWAB())
        denyCompilationTest.addStep(
            "Create an EMPTY app and check it complains of a permission denied"
        )
        denyCompilationTest.setCleanup(closeWAB)
        tests.append(denyCompilationTest)
        localTimeoutCompilationTest = Test(
            "Verify compilation timeout due to local settings")
        localTimeoutCompilationTest.addStep("Reset project", iface.newProject)
        localTimeoutCompilationTest.addStep(
            'Enter EnterpriseTestDesktop Connect credentials and accept dialog by pressing "Login" button.\n'
            'Check that Connect is logged showing [email protected] in the bottom',
            prestep=lambda: _startConectPlugin(),
            isVerifyStep=True)
        localTimeoutCompilationTest.addStep("Open WAB", lambda: openWAB())
        localTimeoutCompilationTest.addStep(
            "Setting timeout", lambda: setNetworkTimeout(value=3000))
        localTimeoutCompilationTest.addStep(
            "Create an EMPTY app and check it complains of network timeout",
            isVerifyStep=True)
        localTimeoutCompilationTest.addStep("Close WAB", closeWAB)
        localTimeoutCompilationTest.setCleanup(resetNetworkTimeout)
        tests.append(localTimeoutCompilationTest)

        successCompilationTest = Test(
            "Verify successful compilation with EnterpriseTestDesktop")
        successCompilationTest.addStep("Reset project", iface.newProject)
        successCompilationTest.addStep(
            'Enter EnterpriseTestDesktop Connect credentials and accept dialog by pressing "Login" button.\n'
            'Check that Connect is logged showing [email protected] in the bottom',
            prestep=lambda: _startConectPlugin(),
            isVerifyStep=True)
        successCompilationTest.addStep("Open WAB", lambda: openWAB())
        successCompilationTest.addStep(
            "Create an EMPTY app and check it successfully ends",
            isVerifyStep=True)
        successCompilationTest.setCleanup(closeWAB)
        tests.append(successCompilationTest)

        # test stopCompilationTest
        def checkStartoStopButton(text=None):
            dlg = getWABDialog()
            tc.assertIn(dlg.buttonCreateOrStopApp.text(), text)

        def clickStopButton(after=5000):
            QTest.qWait(after)
            dlg = getWABDialog()
            QTest.mouseClick(dlg.buttonCreateOrStopApp, Qt.LeftButton)

        stopCompilationTest = Test(
            "Verify stop compilation with EnterpriseTestDesktop user")
        stopCompilationTest.addStep("Reset project", iface.newProject)
        stopCompilationTest.addStep(
            'Enter EnterpriseTestDesktop Connect credentials and accept dialog by pressing "Login" button.\n'
            'Check that Connect is logged showing [email protected] in the bottom',
            prestep=lambda: _startConectPlugin(),
            isVerifyStep=True)
        stopCompilationTest.addStep("Open WAB", lambda: openWAB())
        stopCompilationTest.addStep(
            "Create an EMPTY app and start compilation, then click on next step!"
        )
        stopCompilationTest.addStep("Verify if stop button is set",
                                    lambda: checkStartoStopButton(text='Stop'))
        stopCompilationTest.addStep("Click stop",
                                    lambda: clickStopButton(after=1000))
        stopCompilationTest.addStep(
            "Verify if StartApp button is set",
            lambda: checkStartoStopButton(text='CreateApp'))
        stopCompilationTest.setCleanup(closeWAB)
        tests.append(stopCompilationTest)
    except ImportError:
        pass

    return tests
def functionalTests():
    try:
        from qgistester.test import Test
    except:
        return []

    initial_models = None
    final_models = None

    def open_schema_import_dialog(models):
        plugin = qgis.utils.plugins['asistente_ladm_col']
        plugin.show_dlg_import_schema(**models)

    def open_schema_import_dialog_model1():
        open_schema_import_dialog({'selected_models': [LADMColModelRegistry().model(LADMNames.SUPPLIES_MODEL_KEY).full_name()]})

    def open_schema_import_dialog_model2():
        open_schema_import_dialog({'selected_models': [LADMColModelRegistry().model(LADMNames.SNR_DATA_SUPPLIES_MODEL_KEY).full_name()]})

    def get_initial_models_in_cache():
        global initial_models
        initial_models = get_models_in_cache()

    def get_models_in_cache():
        plugin = qgis.utils.plugins['asistente_ladm_col']
        models = [record[QueryNames.MODEL] for record in plugin.app.core.get_cached_layers()]
        models = set(models)
        if None in models:
            models.remove(None)
        return models

    def get_final_models_in_cache():
        global final_models
        final_models = get_models_in_cache()

    def validate_initial_final_models():
        global initial_models
        global final_models
        assert len(final_models -initial_models) > 0, "Modelos iniciales: {}, Modelos finales: {}".format(initial_models, final_models)

    layer_relations_cache_test = Test(
        'CACHE DE CAPAS Y RELACIONES DEBE SER RECONSTRUIDO SI SE EJECUTÓ BIEN UN SCHEMA IMPORT.')
    layer_relations_cache_test.addStep("""INSTRUCCIONES:<br>
    1. Se abrirá por 1era vez el diálogo Schema Import automáticamente.<br> 
       1.a Selecciona una conexión nueva (se recomienda a GPKG).<br>
       1.b Dale click a Run para importar la estructura pre-seleccionada a la GPKG.<br>
       1.c Cierra el diálogo.<br>
    2. Se abrirá por 2da vez el diálogo Schema Import automáticamente.<br>
       2.a Dale click a Run para importar la estructura pre-seleccionada a la GPKG.<br>
       2.b Cierra el diálogo.<br><br>
    Luego de esto, el test evaluará automáticamente si el caché de capas y relaciones se reconstruyó.
      """)
    layer_relations_cache_test.addStep('Usar diálogo Schema Import (1era vez)...', open_schema_import_dialog_model1)
    layer_relations_cache_test.addStep('Obtener modelos en 1er Schema Import', get_initial_models_in_cache)
    layer_relations_cache_test.addStep('¿Todo va bien?', isVerifyStep=True)
    layer_relations_cache_test.addStep('Usar diálogo Schema Import (2da vez)...', open_schema_import_dialog_model2)
    layer_relations_cache_test.addStep('¿Hasta acá todo va bien?', isVerifyStep=True)
    layer_relations_cache_test.addStep('Obtener modelos en 2do Schema Import', get_final_models_in_cache)
    layer_relations_cache_test.addStep('Se reconstruyó el cache? Esto es, hay más modelos finales que iniciales?', validate_initial_final_models)

    return [layer_relations_cache_test]
def functionalTests():
    try:
        from qgistester.test import Test
        from qgistester.utils import layerFromName
    except:
        return []

    def _createWebApp(n):
        global webAppFolder
        webAppFolder = createAppFromTestAppdef(n)

    def _test(n):
        test = Test("Verify '%s' tutorial" % n)
        test.addStep("Setting up project", lambda: loadTestProject(n))
        test.addStep("Creating web app", lambda: _createWebApp(n))
        test.addStep("Verify web app in browser", prestep=lambda: webbrowser.open_new(
                    "file:///" + webAppFolder.replace("\\","/") + "/webapp/index_debug.html"))
        return test
    tests = [_test("bakeries"), _test("schools"), _test("fires")]

    unconfiguredBookmarksTest = Test("Verify bookmarks widget cannot be used if no bookmarks defined")
    unconfiguredBookmarksTest.addStep("Load project", lambda: loadTestProject())
    unconfiguredBookmarksTest.addStep("Open WAB", lambda: openWAB())
    unconfiguredBookmarksTest.addStep("Try to create an app with the bookmarks widget, without configuring it to add bookmarks.\n"
                         "Verify it shows a warning.")
    unconfiguredBookmarksTest.setCleanup(closeWAB)
    tests.append(unconfiguredBookmarksTest)

    unsupportedSymbologyTest = Test("Verify warning for unsupported symbology")
    unsupportedSymbologyTest.addStep("Load project", lambda: loadTestProject())
    unsupportedSymbologyTest.addStep("Open WAB", openWAB)
    unsupportedSymbologyTest.addStep("Click on 'Preview'. Verify a warning about unsupported symbology is shown.\n"
                         "Verify it shows a warning.")
    tests.append(unsupportedSymbologyTest)
    unsupportedSymbologyTest.setCleanup(closeWAB)

    wrongLogoTest = Test("Verify warning for wrong logo file")
    wrongLogoTest.addStep("Load project", lambda: loadTestProject())
    wrongLogoTest.addStep("Open WAB", openWAB)
    wrongLogoTest.addStep("Enter 'wrong' in the logo textbox and click on 'Preview'."
                                     "The logo texbox should get a yellow background.")
    wrongLogoTest.setCleanup(closeWAB)
    tests.append(wrongLogoTest)

    previewWithAllWidgetsTest = Test("Verify preview of an app with all widgets")
    previewWithAllWidgetsTest.addStep("Load project", lambda: loadTestProject("layers"))
    appdef = testAppdef("allwidgets", False)
    previewWithAllWidgetsTest.addStep("Open WAB", lambda: openWAB(appdef))
    previewWithAllWidgetsTest.addStep("Click on 'Preview' and verify app is correctly shown and it works.")
    previewWithAllWidgetsTest.setCleanup(closeWAB)
    tests.append(previewWithAllWidgetsTest)

    return tests