Skip to content

Commit eeda387

Browse files
committed
switched to 243
1 parent c2f151b commit eeda387

File tree

3 files changed

+104
-7
lines changed

3 files changed

+104
-7
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
package software.aws.toolkits.jetbrains.uitests
4+
5+
import com.intellij.driver.sdk.openFile
6+
import com.intellij.driver.sdk.ui.ui
7+
import com.intellij.driver.sdk.waitForProjectOpen
8+
import com.intellij.ide.starter.ci.CIServer
9+
import com.intellij.ide.starter.di.di
10+
import com.intellij.ide.starter.driver.engine.runIdeWithDriver
11+
import com.intellij.ide.starter.ide.IdeProductProvider
12+
import com.intellij.ide.starter.junit5.hyphenateWithClass
13+
import com.intellij.ide.starter.models.TestCase
14+
import com.intellij.ide.starter.project.LocalProjectInfo
15+
import com.intellij.ide.starter.runner.CurrentTestMethod
16+
import com.intellij.ide.starter.runner.Starter
17+
import org.junit.jupiter.api.Test
18+
import org.junit.jupiter.api.condition.DisabledIfSystemProperty
19+
import org.kodein.di.DI
20+
import org.kodein.di.bindSingleton
21+
import java.io.File
22+
import java.nio.file.Path
23+
import java.nio.file.Paths
24+
import kotlin.io.path.createParentDirectories
25+
import kotlin.io.path.writeText
26+
27+
@DisabledIfSystemProperty(named = "org.gradle.project.ideProfileName", matches = "2024.2", disabledReason = "Logging API not present for 242")
28+
class OfflineAmazonQInlineCompletionTest {
29+
init {
30+
di = DI {
31+
extend(di)
32+
bindSingleton<CIServer>(overrides = true) { TestCIServer }
33+
}
34+
}
35+
36+
@Test
37+
fun `completion request with expired credentials does not freeze EDT`() {
38+
val testCase = TestCase(
39+
IdeProductProvider.IC,
40+
LocalProjectInfo(
41+
Paths.get("tstData", "Hello")
42+
)
43+
).useRelease("2024.2")
44+
Paths.get(System.getProperty("user.home"), ".aws", "sso", "cache", "ee1d2538cb8d358377d7661466c866af747a8a3f.json")
45+
.createParentDirectories()
46+
.writeText(
47+
"""
48+
{
49+
"clientId": "DummyId",
50+
"clientSecret": "DummySecret",
51+
"expiresAt": "3070-01-01T00:00:00Z",
52+
"scopes": [
53+
"scope1",
54+
"scope2"
55+
],
56+
"issuerUrl": "1",
57+
"region": "2",
58+
"clientType": "public",
59+
"grantTypes": [
60+
"authorization_code",
61+
"refresh_token"
62+
],
63+
"redirectUris": [
64+
"http://127.0.0.1/oauth/callback"
65+
]
66+
}
67+
""".trimIndent()
68+
)
69+
Paths.get(System.getProperty("user.home"), ".aws", "sso", "cache", "d3b447f809607422aac1470dd17fbb32e358cdb3.json")
70+
.writeText(
71+
"""
72+
{
73+
"issuerUrl": "https://example.awsapps.com/start",
74+
"region": "us-east-1",
75+
"accessToken": "DummyAccessToken",
76+
"refreshToken": "RefreshToken",
77+
"createdAt": "1970-01-01T00:00:00Z",
78+
"expiresAt": "1970-01-01T00:00:00Z"
79+
}
80+
""".trimIndent()
81+
)
82+
Starter.newContext(CurrentTestMethod.hyphenateWithClass(), testCase).apply {
83+
System.getProperty("ui.test.plugins").split(File.pathSeparator).forEach { path ->
84+
pluginConfigurator.installPluginFromPath(
85+
Path.of(path)
86+
)
87+
}
88+
89+
copyExistingConfig(Paths.get("tstData", "config"))
90+
updateGeneralSettings()
91+
}.runIdeWithDriver()
92+
.useDriverAndCloseIde {
93+
waitForProjectOpen()
94+
openFile("Example.java")
95+
ui.keyboard {
96+
// left meta + c
97+
repeat(5) { hotKey(18, 67) }
98+
}
99+
}
100+
}
101+
}

ui-tests-starter/tst/software/aws/toolkits/jetbrains/uitests/OfflineAmazonQInlineCompletionTest.kt renamed to ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/OfflineAmazonQInlineCompletionTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
package software.aws.toolkits.jetbrains.uitests
44

@@ -41,7 +41,7 @@ class OfflineAmazonQInlineCompletionTest {
4141
LocalProjectInfo(
4242
Paths.get("tstData", "Hello")
4343
)
44-
).useRelease("2024.3")
44+
).useRelease("2024.2")
4545
Paths.get(System.getProperty("user.home"), ".aws", "sso", "cache", "ee1d2538cb8d358377d7661466c866af747a8a3f.json")
4646
.createParentDirectories()
4747
.writeText(

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
package software.aws.toolkits.jetbrains.uitests
55

66
import com.intellij.ide.starter.ci.CIServer
7-
import com.intellij.ide.starter.config.ConfigurationStorage
8-
import com.intellij.ide.starter.junit5.config.LogEnvironmentVariables
97
import java.nio.file.Path
108

119
object TestCIServer : CIServer {
12-
override val isBuildRunningOnCI: Boolean = System.getenv("CI").toBoolean()
10+
override val isBuildRunningOnCI: Boolean = System.getenv("CI").toBoolean() == true
1311
override val buildNumber: String = ""
1412
override val branchName: String = ""
1513
override val buildParams: Map<String, String> = mapOf()
@@ -29,5 +27,3 @@ object TestCIServer : CIServer {
2927

3028
override fun isTestFailureShouldBeIgnored(message: String) = false
3129
}
32-
33-

0 commit comments

Comments
 (0)