|
4 | 4 |
|
5 | 5 | import java.io.File; |
6 | 6 | import java.io.IOException; |
| 7 | +import java.nio.file.FileSystems; |
7 | 8 | import java.nio.file.Path; |
| 9 | +import java.nio.file.PathMatcher; |
8 | 10 | import java.nio.file.Paths; |
9 | 11 |
|
10 | 12 | import org.apache.commons.lang3.SystemUtils; |
@@ -80,16 +82,79 @@ private static void openPreferencesBuildEnvVariables() throws Exception { |
80 | 82 |
|
81 | 83 | private static void verifyToolsPaths() { |
82 | 84 | idfToolsPath(); |
| 85 | + closeDialog(); |
| 86 | + idfPath(); |
| 87 | + closeDialog(); |
| 88 | + openOCDScripts(); |
| 89 | + closeDialog(); |
| 90 | + idfPythonEnvPath(); |
| 91 | + closeDialog(); |
| 92 | + pythonExePath(); |
| 93 | + closeDialog(); |
83 | 94 | } |
84 | 95 |
|
85 | 96 | private static void idfToolsPath() { |
86 | 97 | bot.table().select("IDF_TOOLS_PATH"); |
87 | 98 | bot.table().getTableItem("IDF_TOOLS_PATH").doubleClick(); |
88 | | - bot.sleep(1000); |
| 99 | + TestWidgetWaitUtility.waitForDialogToAppear(bot, "Edit variable", 5000); |
89 | 100 |
|
90 | 101 | Path idfToolsPath = Paths.get(System.getProperty("user.home"), ".espressif", IDFConstants.TOOLS_FOLDER); |
91 | 102 | String actualPath = bot.textWithLabel("Value:").getText(); |
92 | 103 | assertTrue(actualPath.equals(idfToolsPath.toString())); |
93 | 104 | } |
| 105 | + |
| 106 | + private static void idfPath() { |
| 107 | + bot.table().select("IDF_PATH"); |
| 108 | + bot.table().getTableItem("IDF_PATH").doubleClick(); |
| 109 | + TestWidgetWaitUtility.waitForDialogToAppear(bot, "Edit variable", 5000); |
| 110 | + |
| 111 | + Path idfPath = Paths.get(IDFUtil.getIDFPath()); |
| 112 | + String actualPath = bot.textWithLabel("Value:").getText(); |
| 113 | + assertTrue(actualPath.equals(idfPath.toString())); |
| 114 | + } |
| 115 | + |
| 116 | + private static void openOCDScripts() { |
| 117 | + bot.table().select("OPENOCD_SCRIPTS"); |
| 118 | + bot.table().getTableItem("OPENOCD_SCRIPTS").doubleClick(); |
| 119 | + TestWidgetWaitUtility.waitForDialogToAppear(bot, "Edit variable", 5000); |
| 120 | + |
| 121 | + String actualPath = bot.textWithLabel("Value:").getText(); |
| 122 | + String home = System.getProperty("user.home").replace("\\", "/"); |
| 123 | + String pattern = "glob:" + home + "/.espressif/" + IDFConstants.TOOLS_FOLDER |
| 124 | + + "/openocd-esp32/*/openocd-esp32/share/openocd/scripts"; |
| 125 | + |
| 126 | + PathMatcher matcher = FileSystems.getDefault().getPathMatcher(pattern); |
| 127 | + assertTrue(matcher.matches(Paths.get(actualPath))); |
| 128 | + } |
| 129 | + |
| 130 | + private static void idfPythonEnvPath() { |
| 131 | + bot.table().select("IDF_PYTHON_ENV_PATH"); |
| 132 | + bot.table().getTableItem("IDF_PYTHON_ENV_PATH").doubleClick(); |
| 133 | + TestWidgetWaitUtility.waitForDialogToAppear(bot, "Edit variable", 5000); |
| 134 | + |
| 135 | + String actualPath = bot.textWithLabel("Value:").getText(); |
| 136 | + String home = System.getProperty("user.home").replace("\\", "/"); |
| 137 | + String pattern = "glob:" + home + "/.espressif/" + IDFConstants.TOOLS_FOLDER + "/python/*/venv"; |
| 138 | + |
| 139 | + PathMatcher matcher = FileSystems.getDefault().getPathMatcher(pattern); |
| 140 | + assertTrue(matcher.matches(Paths.get(actualPath))); |
| 141 | + } |
| 142 | + |
| 143 | + private static void pythonExePath() { |
| 144 | + bot.table().select("PYTHON_EXE_PATH"); |
| 145 | + bot.table().getTableItem("PYTHON_EXE_PATH").doubleClick(); |
| 146 | + TestWidgetWaitUtility.waitForDialogToAppear(bot, "Edit variable", 5000); |
| 147 | + |
| 148 | + String actualPath = bot.textWithLabel("Value:").getText(); |
| 149 | + String home = System.getProperty("user.home").replace("\\", "/"); |
| 150 | + String pattern = "glob:" + home + "/.espressif/" + IDFConstants.TOOLS_FOLDER + "/python/*/venv/bin/python"; |
| 151 | + |
| 152 | + PathMatcher matcher = FileSystems.getDefault().getPathMatcher(pattern); |
| 153 | + assertTrue(matcher.matches(Paths.get(actualPath))); |
| 154 | + } |
| 155 | + |
| 156 | + private static void closeDialog() { |
| 157 | + bot.button("OK").click(); |
| 158 | + } |
94 | 159 | } |
95 | 160 | } |
0 commit comments