Exemple #1
0
	def findInstalledNVDAPath(self) -> Optional[str]:
		NVDAFilePath = _pJoin(_expandvars('%PROGRAMFILES%'), 'nvda', 'nvda.exe')
		legacyNVDAFilePath = _pJoin(_expandvars('%PROGRAMFILES%'), 'NVDA', 'nvda.exe')
		exeErrorMsg = f"Unable to find installed NVDA exe. Paths tried: {NVDAFilePath}, {legacyNVDAFilePath}"
		try:
			opSys.file_should_exist(NVDAFilePath)
			return NVDAFilePath
		except AssertionError:
			# Older versions of NVDA (<=2020.4) install the exe in NVDA\nvda.exe
			opSys.file_should_exist(legacyNVDAFilePath, exeErrorMsg)
			return legacyNVDAFilePath
Exemple #2
0
    def __init__(self):
        # robot is expected to be run from the NVDA repo root directory. We want all repo specific
        # paths to be relative to this. This would allow us to change where it is run from if we decided to.
        self.repoRoot = _abspath("./")
        self.stagingDir = _tempFile.gettempdir()
        opSys.directory_should_exist(self.stagingDir)

        self.whichNVDA = builtIn.get_variable_value("${whichNVDA}", "source")
        self._installFilePath = builtIn.get_variable_value(
            "${installDir}", None)
        self.NVDAInstallerCommandline = None
        if self.whichNVDA == "source":
            self._runNVDAFilePath = _pJoin(self.repoRoot, "runnvda.bat")
            self.baseNVDACommandline = self._runNVDAFilePath
        elif self.whichNVDA == "installed":
            self._runNVDAFilePath = _pJoin(_expandvars('%PROGRAMFILES%'),
                                           'nvda', 'nvda.exe')
            self.baseNVDACommandline = f'"{str(self._runNVDAFilePath)}"'
            if self._installFilePath is not None:
                self.NVDAInstallerCommandline = f'"{str(self._installFilePath)}"'
        else:
            raise AssertionError(
                "RobotFramework should be run with argument: '-v whichNVDA [source|installed]'"
            )

        self.profileDir = _pJoin(self.stagingDir, "nvdaProfile")
        self.logPath = _pJoin(self.profileDir, 'nvda.log')
        self.preservedLogsDir = _pJoin(
            builtIn.get_variable_value("${OUTPUT DIR}"), "nvdaTestRunLogs")
Exemple #3
0
process = builtIn.get_library_instance('Process')  # type: Process
opSys = builtIn.get_library_instance('OperatingSystem')  # type: OperatingSystem

spyServerPort = 8270  # is `registered by IANA` for remote server usage. Two ASCII values:'RF'
spyServerURI = 'http://127.0.0.1:{}'.format(spyServerPort)
spyAlias = "nvdaSpy"

# robot is expected to be run from the NVDA repo root directory. We want all repo specific
# paths to be relative to this. This would allow us to change where it is run from if we decided to.
repoRoot = _abspath("./")
whichNVDA = builtIn.get_variable_value("${whichNVDA}", "source")
if whichNVDA == "source":
	NVDACommandPathToCheckExists = _pJoin(repoRoot, "source/nvda.pyw")
	baseNVDACommandline = "pythonw "+NVDACommandPathToCheckExists
elif whichNVDA == "installed":
	NVDACommandPathToCheckExists = _pJoin(_expandvars('%PROGRAMFILES%'),'nvda','nvda.exe')
	baseNVDACommandline='"%s"' % NVDACommandPathToCheckExists
else:
	raise AssertionError("robot should be given argument `-v whichNVDA [source|installed]")

# Paths
systemTestSourceDir = _pJoin(repoRoot, "tests", "system")
tempDir = tempfile.gettempdir()
opSys.directory_should_exist(tempDir)
nvdaProfileWorkingDir = _pJoin(tempDir, "nvdaProfile")
nvdaLogFilePath = _pJoin(nvdaProfileWorkingDir, 'nvda.log')
systemTestSpyAddonName = "systemTestSpy"
testSpyPackageDest = _pJoin(nvdaProfileWorkingDir, "scratchpad", "globalPlugins")
outDir = builtIn.get_variable_value("${OUTPUT DIR}")
testOutputNvdaLogsDir = _pJoin(outDir, "nvdaTestRunLogs")
Exemple #4
0
opSys = builtIn.get_library_instance(
    'OperatingSystem')  # type: OperatingSystem

spyServerPort = 8270  # is `registered by IANA` for remote server usage. Two ASCII values:'RF'
spyServerURI = 'http://127.0.0.1:{}'.format(spyServerPort)
spyAlias = "nvdaSpy"

# robot is expected to be run from the NVDA repo root directory. We want all repo specific
# paths to be relative to this. This would allow us to change where it is run from if we decided to.
repoRoot = _abspath("./")
whichNVDA = builtIn.get_variable_value("${whichNVDA}", "source")
if whichNVDA == "source":
    NVDACommandPathToCheckExists = _pJoin(repoRoot, "source/nvda.pyw")
    baseNVDACommandline = "pythonw " + NVDACommandPathToCheckExists
elif whichNVDA == "installed":
    NVDACommandPathToCheckExists = _pJoin(_expandvars('%PROGRAMFILES%'),
                                          'nvda', 'nvda.exe')
    baseNVDACommandline = '"%s"' % NVDACommandPathToCheckExists
else:
    raise AssertionError(
        "robot should be given argument `-v whichNVDA [source|installed]")

# Paths
systemTestSourceDir = _pJoin(repoRoot, "tests", "system")
tempDir = tempfile.gettempdir()
opSys.directory_should_exist(tempDir)
nvdaProfileWorkingDir = _pJoin(tempDir, "nvdaProfile")
nvdaLogFilePath = _pJoin(nvdaProfileWorkingDir, 'nvda.log')
systemTestSpyAddonName = "systemTestSpy"
testSpyPackageDest = _pJoin(nvdaProfileWorkingDir, "scratchpad",
                            "globalPlugins")