4
4
package software.aws.toolkits.jetbrains.uitests.tests
5
5
6
6
import com.intellij.remoterobot.fixtures.ComboBoxFixture
7
+ import com.intellij.remoterobot.fixtures.ComponentFixture
7
8
import com.intellij.remoterobot.fixtures.ContainerFixture
8
9
import com.intellij.remoterobot.fixtures.JListFixture
9
10
import com.intellij.remoterobot.search.locators.byXpath
@@ -53,7 +54,7 @@ class SamRunConfigTest {
53
54
54
55
idea {
55
56
waitForBackgroundTasks()
56
- findAndClick(" //div[@accessiblename= 'Add Configuration...' ]" )
57
+ findAndClick(" //div[contains( @accessiblename, 'Add Configuration') ]" )
57
58
step(" Create and populate template based run configuration" ) {
58
59
addRunConfig()
59
60
step(" Populate run configuration" ) {
@@ -75,7 +76,7 @@ class SamRunConfigTest {
75
76
step(" Validate template run configuration was saved and loads properly" ) {
76
77
step(" Reopen the run configuration" ) {
77
78
findAndClick(" //div[@accessiblename='[Local] SomeFunction']" )
78
- find<JListFixture >(byXpath(" //div[@class='MyList']" )).clickItem(" Edit Configurations... " )
79
+ find<JListFixture >(byXpath(" //div[@class='MyList']" )).clickItem(" Edit Configurations" , fullMatch = false )
79
80
}
80
81
step(" Assert the same function is selected" ) {
81
82
assertThat(functionModel().selectedText()).isEqualTo(" SomeFunction" )
@@ -94,10 +95,13 @@ class SamRunConfigTest {
94
95
step(" Setup handler based run configuration" ) {
95
96
step(" Reopen the run configuration menu" ) {
96
97
findAndClick(" //div[@accessiblename='[Local] SomeFunction']" )
97
- find<JListFixture >(byXpath(" //div[@class='MyList']" )).clickItem(" Edit Configurations... " )
98
+ find<JListFixture >(byXpath(" //div[@class='MyList']" )).clickItem(" Edit Configurations" , fullMatch = false )
98
99
}
99
100
addRunConfig()
100
- find<ComboBoxFixture >(byXpath(" (//div[@text='Runtime:']/following-sibling::div[@class='ComboBox'])[1]" )).selectItem(" java11" )
101
+ find<ComboBoxFixture >(
102
+ byXpath(" (//div[@text='Runtime:']/following-sibling::div[@class='ComboBox'])[1]" ),
103
+ Duration .ofSeconds(10 )
104
+ ).selectItem(" java11" )
101
105
findAndClick(" //div[@class='HandlerPanel']" )
102
106
keyboard { enterText(" helloworld.App::handleRequest" ) }
103
107
findAndClick(" //div[@class='MyEditorTextField']" )
@@ -107,10 +111,11 @@ class SamRunConfigTest {
107
111
step(" Validate handler run configuration was saved and loads properly" ) {
108
112
step(" Reopen the run configuration" ) {
109
113
findAndClick(" //div[@accessiblename='[Local] App.handleRequest']" )
110
- find<JListFixture >(byXpath(" //div[@class='MyList']" )).clickItem(" Edit Configurations..." )
114
+ find<JListFixture >(byXpath(" //div[@class='MyList']" )).clickItem(" Edit Configurations" , fullMatch = false )
115
+ waitForConfigurationLoad()
111
116
}
112
117
step(" Assert the same handler is selected" ) {
113
- val fixture = findRunDialog(). find<ContainerFixture >(byXpath(" //div[@class='HandlerPanel']" ))
118
+ val fixture = find<ContainerFixture >(byXpath(" //div[@class='HandlerPanel']" ))
114
119
assertThat(fixture.findAllText().joinToString(" " ) { it.text }).isEqualTo(" helloworld.App::handleRequest" )
115
120
}
116
121
// We might want to assert no errors here in the future. However, since we do not import the project, we don't
@@ -121,15 +126,21 @@ class SamRunConfigTest {
121
126
}
122
127
}
123
128
124
- private fun ContainerFixture.functionModel (): ComboBoxFixture =
125
- find(byXpath(" //div[@class='TextFieldWithBrowseButton']/following-sibling::div[@class='ComboBox']" ))
129
+ private fun ContainerFixture.waitForConfigurationLoad () = find<ComponentFixture >(byXpath(" //div[@text='Configuration']" ), Duration .ofSeconds(10 ))
126
130
127
- private fun ContainerFixture.findRunDialog () = find<DialogFixture >(DialogFixture .byTitleContains(" Run" ), Duration .ofSeconds(5 ))
131
+ private fun ContainerFixture.functionModel (): ComboBoxFixture {
132
+ waitForConfigurationLoad()
133
+ return find(byXpath(" //div[@class='TextFieldWithBrowseButton']/following-sibling::div[@class='ComboBox']" ))
134
+ }
135
+
136
+ private fun ContainerFixture.findRunDialog () = find<DialogFixture >(DialogFixture .byTitleContains(" Run" ), Duration .ofSeconds(10 ))
128
137
129
138
private fun ContainerFixture.addRunConfig () {
130
139
step(" Add a local run configuration" ) {
131
140
findRunDialog().findAndClick(" //div[@accessiblename='Add New Configuration']" )
132
141
find<JTreeFixture >(byXpath(" //div[@accessiblename='WizardTree' and @class='MyTree']" )).clickPath(" AWS Lambda" , " Local" )
142
+ // wait for run config panel to render
143
+ waitForConfigurationLoad()
133
144
}
134
145
}
135
146
}
0 commit comments