Skip to content

Commit f43d438

Browse files
committed
detekt
1 parent 7b7ab86 commit f43d438

File tree

3 files changed

+30
-34
lines changed

3 files changed

+30
-34
lines changed

ui-tests-starter/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ tasks.register<Test>("uiTest") {
111111
dependsOn(prepareAmazonQTest)
112112
dependsOn(testPlugins)
113113
dependsOn("npmInstall") // Ensure npm dependencies are installed
114-
114+
115115
systemProperty("ui.test.plugins", testPlugins.get().asPath)
116116
systemProperty("org.gradle.project.ideProfileName", ideProfile.name)
117117
val testSuite = System.getenv("TEST_DIR") ?: ""

ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/profileTests/QProfileSelectionTest.kt

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
package software.aws.toolkits.jetbrains.uitests.profileTests
55

66
import com.intellij.driver.client.Driver
7+
import com.intellij.driver.sdk.openFile
78
import com.intellij.driver.sdk.ui.components.common.editor
8-
import com.intellij.driver.sdk.waitForProjectOpen
99
import com.intellij.driver.sdk.ui.components.common.ideFrame
10-
import com.intellij.driver.sdk.openFile
1110
import com.intellij.driver.sdk.ui.ui
1211
import com.intellij.driver.sdk.ui.xQuery
13-
import java.awt.event.KeyEvent
12+
import com.intellij.driver.sdk.waitForProjectOpen
1413
import com.intellij.ide.starter.ci.CIServer
1514
import com.intellij.ide.starter.config.ConfigurationStorage
1615
import com.intellij.ide.starter.di.di
@@ -38,7 +37,7 @@ import software.aws.toolkits.jetbrains.uitests.setupMultipleProfilesForTest
3837
import software.aws.toolkits.jetbrains.uitests.setupMultipleProfilesWithSelectionForTest
3938
import software.aws.toolkits.jetbrains.uitests.setupTestEnvironment
4039
import software.aws.toolkits.jetbrains.uitests.useExistingConnectionForTest
41-
import software.aws.toolkits.jetbrains.uitests.writeToAwsXml
40+
import java.awt.event.KeyEvent
4241
import java.io.File
4342
import java.nio.file.Files
4443
import java.nio.file.Path
@@ -58,8 +57,6 @@ class QProfileSelectionTest {
5857
5958
}"""
6059

61-
62-
6360
init {
6461
di = DI {
6562
extend(di)
@@ -165,24 +162,23 @@ class QProfileSelectionTest {
165162
assertThat(result).contains("Profile selector is shown")
166163
}
167164

168-
step("Q services not triggered when no profile selected"){
165+
step("Q services not triggered when no profile selected") {
169166
triggerDevFeatures(this, false)
170167
}
171168

172-
step("Switching profile notifies and shows chat"){
169+
step("Switching profile notifies and shows chat") {
173170
changeProfileAndVerify(this, true)
174171
val result = executePuppeteerScript(testActiveToolWindowPage)
175172
assertThat(result).contains("Chat is shown")
176173
}
177174

178-
step("Q features work with selected profile"){
175+
step("Q features work with selected profile") {
179176
triggerDevFeatures(this, true)
180177
}
181178

182179
step("Changing profile A -> A does nothing") {
183180
changeProfileAndVerify(this, false)
184181
}
185-
186182
}
187183
}
188184

@@ -243,9 +239,11 @@ class QProfileSelectionTest {
243239
private fun changeProfileAndVerify(driver: Driver, switchingProfiles: Boolean) =
244240
driver.ideFrame {
245241
// Click Amazon Q button in status bar
246-
x(xQuery {
247-
byAccessibleName("Amazon Q") and byJavaClass("com.intellij.openapi.wm.impl.status.MultipleTextValues")
248-
}).click()
242+
x(
243+
xQuery {
244+
byAccessibleName("Amazon Q") and byJavaClass("com.intellij.openapi.wm.impl.status.MultipleTextValues")
245+
}
246+
).click()
249247
Thread.sleep(100)
250248

251249
driver.ui.keyboard {
@@ -254,12 +252,12 @@ class QProfileSelectionTest {
254252
key(KeyEvent.VK_UP)
255253
key(KeyEvent.VK_ENTER)
256254

257-
//wait for list to load
255+
// wait for list to load
258256
Thread.sleep(3000)
259257

260258
// profile combobox selection and select connection
261259
key(KeyEvent.VK_TAB)
262-
if(switchingProfiles){
260+
if (switchingProfiles) {
263261
// navigate past (current)
264262
key(KeyEvent.VK_DOWN)
265263
}
@@ -273,16 +271,15 @@ class QProfileSelectionTest {
273271
// Verify notification behavior
274272
Thread.sleep(100)
275273
val notification = x(xQuery { byVisibleText("You changed your profile") })
276-
if(switchingProfiles){
274+
if (switchingProfiles) {
277275
assertTrue { notification.present() }
278276
} else {
279277
assertTrue { notification.notPresent() }
280278
}
281279
}
282280

283281
private fun triggerDevFeatures(driver: Driver, isProfileSelected: Boolean) {
284-
285-
//trigger inline completion
282+
// trigger inline completion
286283
var originalText: String? = null
287284
var afterSuggestion: String? = null
288285
driver.ideFrame {
@@ -299,10 +296,9 @@ class QProfileSelectionTest {
299296
Thread.sleep(2000)
300297

301298
val hintExists = editor.getInlayModel().getInlineElementsInRange(0, text.length).isNotEmpty()
302-
if(isProfileSelected) {
299+
if (isProfileSelected) {
303300
assertThat(hintExists).isTrue()
304-
}
305-
else {
301+
} else {
306302
assertThat(hintExists).isFalse()
307303
}
308304
driver.ui.keyboard {
@@ -312,16 +308,15 @@ class QProfileSelectionTest {
312308
text = setupContent
313309
}
314310
}
315-
if(isProfileSelected) {
311+
if (isProfileSelected) {
316312
assertThat(afterSuggestion?.replace(Regex("\\s+"), " ")?.trim())
317313
.isNotEqualTo(originalText?.replace(Regex("\\s+"), " ")?.trim())
318-
}
319-
else {
314+
} else {
320315
assertThat(afterSuggestion?.replace(Regex("\\s+"), " ")?.trim())
321316
.isEqualTo(originalText?.replace(Regex("\\s+"), " ")?.trim())
322317
}
323318

324-
//check q features
319+
// check q features
325320
driver.ideFrame {
326321
val editor = x(xQuery { byClass("EditorComponentImpl") })
327322
editor.click()
@@ -331,13 +326,14 @@ class QProfileSelectionTest {
331326
Thread.sleep(100)
332327

333328
// Check if "Amazon Q" option is present
334-
val amazonQInMenu = x(xQuery {
335-
byVisibleText("Amazon Q") and byJavaClass("com.intellij.openapi.actionSystem.impl.ActionMenu")
336-
})
337-
if(isProfileSelected) {
329+
val amazonQInMenu = x(
330+
xQuery {
331+
byVisibleText("Amazon Q") and byJavaClass("com.intellij.openapi.actionSystem.impl.ActionMenu")
332+
}
333+
)
334+
if (isProfileSelected) {
338335
assertTrue { amazonQInMenu.present() }
339-
}
340-
else {
336+
} else {
341337
assertTrue { amazonQInMenu.notPresent() }
342338
}
343339
}

ui-tests-starter/tst/software/aws/toolkits/jetbrains/uitests/TestUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fun setupMultipleProfilesForTest() {
117117
<option name="shouldDisplayPage" value="false" />
118118
</component>
119119
</application>
120-
""".trimIndent()
120+
""".trimIndent()
121121
writeToAwsXml(configContent)
122122
}
123123

@@ -189,7 +189,7 @@ fun setupMultipleProfilesWithSelectionForTest() {
189189
</option>
190190
</component>
191191
</application>
192-
""".trimIndent()
192+
""".trimIndent()
193193
writeToAwsXml(configContent)
194194
}
195195

0 commit comments

Comments
 (0)