Robot Framework - using relative paths to run tests from different directory variations
There are several built-in variables that can help you define the path correctly.
The one that is most interesting here is ${CURDIR}
From the documentation:
${CURDIR} An absolute path to the directory where the test data file is located. This variable is case-sensitive.
I usually define a master suite setup file (in your case, in the root tests folder) and in there, I would define the following 3 global level variables
Create a file __init.robot at the root tests folder.
In it create a suite setup section (which will run before any test - but only once!)
Set Global Variable ${testsRootFolder} ${CURDIR}
Set Global Variable ${pagesRootFolder} %{CURDIR}${/}..${/}_pages
Set Global Variable ${firefoxProfileFolder} %{CURDIR}${/}..${/}firefoxTestProfile