-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SWTBot: 'ESP-IDF Install New Component' test case #833
Conversation
WalkthroughThe changes introduce a new test case for the Espressif IDF project, enhancing the testing suite by simulating project creation, build, and component installation. The updates also improve the ProjectTestOperations class, adding methods for project build waiting, component installation, project refreshing, and component YAML file interaction. Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 3
Files selected for processing (2)
- tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java (2 hunks)
- tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (3 hunks)
Additional comments (Suppressed): 6
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/operations/ProjectTestOperations.java (6)
61-74: The new method
waitForProjectNewComponentInstalled
is introduced to wait until the console view contains the message "Successfully added dependency", indicating that a new component has been installed successfully. This method is similar towaitForProjectBuild
but waits for a different message. The timeout value for waiting is set to 10,000 milliseconds (10 seconds). Please verify if this timeout value is sufficient for the component installation process.103-110: The new method
refreshProjectUsingContextMenu
is introduced to refresh a project using the context menu. This method can be useful in scenarios where the project needs to be refreshed to reflect the latest changes, such as after a new component has been installed.113-141: The new method
openProjectComponentYMLFileInTextEditorUsingContextMenu
is introduced to open theidf_component.yml
file of a project in a text editor using the context menu. This method can be useful in scenarios where the content of theidf_component.yml
file needs to be checked or modified. The method tries to find theidf_component.yml
file in the 'main' subfolder of the project and throws aRuntimeException
if the file is not found after a certain number of attempts.143-154: The new helper method
findTreeItem
is introduced to find a tree item with a specific name under a given parent item. This method can be useful in scenarios where a specific item needs to be found in the project explorer.156-163: The new method
checkTextEditorContentForPhrase
is introduced to check if the content of the active text editor contains a specific phrase. This method can be useful in scenarios where the content of a text file needs to be checked for a specific phrase, such as after a new component has been installed. The method throws aRuntimeException
if the specified phrase is not found in the text editor.165-173: The new method
openProjectNewComponentUsingContextMenu
is introduced to open the "Install New Component" option of a project using the context menu. This method can be useful in scenarios where a new component needs to be installed in a project.
....test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java
Show resolved
Hide resolved
private static void whenInstallNewComponentUsingContextMenu() throws IOException | ||
{ | ||
ProjectTestOperations.openProjectNewComponentUsingContextMenu(projectName, bot); | ||
bot.editorByTitle(projectName).show(); | ||
bot.button("Install").click(); | ||
ProjectTestOperations.waitForProjectNewComponentInstalled(bot); | ||
bot.editorByTitle(projectName).close(); | ||
ProjectTestOperations.refreshProjectUsingContextMenu(projectName, bot); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method whenInstallNewComponentUsingContextMenu()
installs a new component and refreshes the project. However, it doesn't handle any potential exceptions that might occur during the installation or the refresh. Consider adding error handling to make the code more robust.
private static void whenInstallNewComponentUsingContextMenu() throws IOException
{
try {
ProjectTestOperations.openProjectNewComponentUsingContextMenu(projectName, bot);
bot.editorByTitle(projectName).show();
bot.button("Install").click();
ProjectTestOperations.waitForProjectNewComponentInstalled(bot);
bot.editorByTitle(projectName).close();
ProjectTestOperations.refreshProjectUsingContextMenu(projectName, bot);
} catch (Exception e) {
e.printStackTrace();
fail("Failed to install new component using context menu: " + e.getMessage());
}
}
....test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@AndriiFilippov I would suggest you to please wait for any more tests along the idf components area as that will probably be revamped in the near future and may require you to write new tests again or update the old ones drastically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Added 'ESP-IDF Install New Component' test case.
Test case install New Component (mdns) - checks the console for the presence of the correct message - checks the idf_component.yml file for the presence of component record (espressif/mdns)
Fixes # (IEP-XXX)
Type of change
Test Configuration:
Checklist
Summary by CodeRabbit
These updates aim to improve the reliability of the software by enhancing testing capabilities and making project operations more efficient.