Skip to content

Commit 47c9982

Browse files
authored
Update the README.md file (#67)
Fixes #40 Signed-off-by: Zbynek Cervinka <[email protected]>
1 parent 8fdb212 commit 47c9982

File tree

1 file changed

+71
-15
lines changed

1 file changed

+71
-15
lines changed

README.md

Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,43 @@
1-
# intellij-common-ui-test-library
1+
Welcome to the IntelliJ IDEA UI test library project! Here you'll find several pieces of information and advices on how to setup, use and contribute to this library.
22

3-
### Add this library to an existing IntelliJ Plugin project
3+
## Purpose of this project
4+
This project allows you to create automated UI tests for your IntelliJ IDEA plugin project. Using this library you are able to access UI elements such as buttons, inputs, tree elements etc. and perform actions with them. Navigating through wizards, clicking on buttons or editing file content of newly created project could be automated using this library.
45

5-
1) Extend the build.gradle file of the IntelliJ Plugin repo
6+
## Any Suggestions or Questions?
7+
Please submit an [issue](https://github.com/redhat-developer/intellij-common-ui-test-library/issues) to this project.
68

9+
## Contributing
10+
Feel free to contribute to this project! See the [contribution guide](https://github.com/redhat-developer/intellij-common-ui-test-library/blob/main/CONTRIBUTING.md) for more details.
11+
12+
## Quick setup
13+
The setup of this library is easy - just extend the **build.gradle** file as described in the following steps and you are ready to write your first UI test.
14+
15+
### STEP #1: Adding repositories
16+
You need to add the following nexus and JetBrains repositories:
17+
```
18+
repositories {
19+
maven {
20+
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
21+
}
22+
maven {
23+
url 'https://repository.jboss.org/nexus/content/groups/public'
24+
}
25+
maven {
26+
url 'https://packages.jetbrains.team/maven/p/ij/intellij-dependencies'
27+
}
28+
}
29+
```
30+
31+
### STEP #2: Adding dependencies
32+
Add the following dependency:
33+
```
34+
dependencies {
35+
compile 'com.redhat.devtools.intellij:intellij-common-ui-test-library:0.0.3'
36+
}
37+
```
38+
39+
### STEP #3: Adding source sets
40+
The following source set is needed to define where in your project will be your UI tests and resources located. The following example displays the 'src/it/java' location for java code of UI tests and the 'src/it/resources' location for resources:
741
```
842
sourceSets {
943
integrationTest {
@@ -13,7 +47,10 @@ sourceSets {
1347
runtimeClasspath += output + compileClasspath
1448
}
1549
}
50+
```
1651

52+
### STEP #4: Adding tasks
53+
```
1754
task integrationTest(type: Test) {
1855
useJUnitPlatform()
1956
description = 'Runs the integration tests.'
@@ -24,32 +61,51 @@ task integrationTest(type: Test) {
2461
mustRunAfter test
2562
}
2663
27-
dependencies {
28-
compile 'com.redhat.devtools.intellij:intellij-common-ui-test-library:0.0.3-SNAPSHOT'
29-
}
30-
3164
runIdeForUiTests {
3265
systemProperty "robot-server.port", System.getProperty("robot-server.port")
3366
}
34-
35-
repositories {
36-
maven {
37-
url 'https://packages.jetbrains.team/maven/p/ij/intellij-dependencies'
38-
}
39-
}
4067
```
4168

42-
2) Run and close the IntelliJ Idea before and after all the UI tests
69+
## Start and quit IntelliJ IDEA
70+
Use the following code to start IntelliJ before running the first UI test. The runIde() method not only starts the IDE for UI tests, it also returns reference to the Remote-Robot instance which will be useful later to access UI elements such as buttons, inputs etc.
4371
```
4472
private static RemoteRobot robot;
4573
4674
@BeforeAll
4775
public static void runIdeForUiTests() {
48-
robot = UITestRunner.runIde("IC-2020.3", 8580);
76+
robot = UITestRunner.runIde(UITestRunner.IdeaVersion.V_2020_3, 8580);
4977
}
78+
```
5079

80+
After executing all the UI tests close the IDE by running the following command:
81+
```
5182
@AfterAll
5283
public static void closeIde() {
5384
UITestRunner.closeIde();
5485
}
5586
```
87+
88+
## What next? Implement your first UI test!
89+
After you manage to setup this library to your project and successfully start and quit IntelliJ IDEA, there is no more setup needed. Just start writing your UI tests! Here are some examples that will help you get started:
90+
91+
### Create your first fixture
92+
Create an instance of a FlatWelcomeFrame class which allows you to access the 'Welcome to IntelliJ IDEA' dialog's UI.
93+
```
94+
FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(10));
95+
```
96+
97+
### Use the fixture to access UI
98+
After you have the object, it can be used to access the UI - here is an example of clicking on the 'New Project' button:
99+
```
100+
flatWelcomeFrame.createNewProject();
101+
```
102+
103+
### Use utilities
104+
This library provides several static utility methods for common actions. Here is an example of one useful transformation method:
105+
```
106+
String contentListStr = TextUtils.listOfRemoteTextToString(contentList);
107+
```
108+
109+
### Use any tool provided by Remote-Robot framework
110+
Besides the fixtures and utilities provided by this library you can use any tool from the [Remote-Robot](https://github.com/JetBrains/intellij-ui-test-robot) framework itself.
111+

0 commit comments

Comments
 (0)