-
Notifications
You must be signed in to change notification settings - Fork 20
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
Smoke test for Skate Plugin #468
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
a0ec785
Initial copy paste of SqlDelightErrorHandler
52f6983
Added libs.bugsnag to the build.gradle.kts and added sdk as a dependency
0613136
Documentation added
5687d4d
Change order of dependency implementations
267ae32
Adjust names to be Skate
c27e74d
Remove unnecessary space with plugin.xml
36c089b
Restore copyright header
9cfcad8
Running spotlessApply
512300b
Added link to original source
a224cd2
Initial addition of tool Window test
ae4058a
Skate plugin initialization test
d088b29
merge conflicts
ed58373
Add initialization for skate config settings
2441899
write test that writes a sample changelog file to the project, write …
fb23450
Remove todos and fix configuration settings
4b3b396
reset skate plugin test
be80063
integrating remote robot and creating an instance
2a378fe
Add comments and account for tool Window
3acf967
Merge branch 'main' of github.com:slackhq/slack-gradle-plugin into kl…
129a0d0
Add dependencies
349c7ca
Copy remote robot repo files
9930a77
Implement custom ToolWindowFixture
c81b6f4
Modify testing
e5bfa6e
Fixes
ZacSweers 404ba35
Initial creation of test fixture project
b134b07
Modifying build.gradle.kts to match skate-plugin
d2d5fc8
Deleting test fixture plugin project
602dcb4
creation of test fixture project within skate-plugin tests
c8dc4a6
deletion of test-fixture plugin
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
skate-plugin/src/test/kotlin/com/slack/sgp/intellij/SkatePluginInitializationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.slack.sgp.intellij | ||
|
||
import com.google.common.truth.Truth.assertThat | ||
import com.intellij.openapi.components.service | ||
import com.intellij.testFramework.fixtures.BasePlatformTestCase | ||
|
||
class SkatePluginInitializationTest : BasePlatformTestCase() { | ||
|
||
fun `test Skate Plugin Service Initialization to ensure SkateProjectService is properly registered & initialized`() { | ||
val skateService = project.service<SkateProjectService>() | ||
|
||
// Service should be an instance of SkateProjectServiceImpl | ||
assertThat(skateService).isInstanceOf(SkateProjectServiceImpl::class.java) | ||
} | ||
|
||
fun `test Skate Plugin Settings Initialization`() { | ||
val settings = project.service<SkatePluginSettings>() | ||
|
||
// Assert that settings is not null | ||
assertThat(settings).isNotNull() | ||
|
||
// Check the default values | ||
assertThat(settings.whatsNewFilePath).isEqualTo("CHANGELOG.md") | ||
assertThat(settings.isWhatsNewEnabled).isTrue() | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
skate-plugin/src/test/kotlin/com/slack/sgp/intellij/SkatePluginTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.slack.sgp.intellij | ||
|
||
import com.google.common.truth.Truth.assertThat | ||
import com.intellij.remoterobot.RemoteRobot | ||
import com.intellij.remoterobot.utils.keyboard | ||
import com.intellij.remoterobot.utils.waitForIgnoringError | ||
import com.slack.sgp.intellij.pages.ToolWindowFixture | ||
import com.slack.sgp.intellij.pages.idea | ||
import com.slack.sgp.intellij.utils.RemoteRobotExtension | ||
import com.slack.sgp.intellij.utils.StepsLogger | ||
import java.awt.event.KeyEvent.VK_A | ||
import java.awt.event.KeyEvent.VK_META | ||
import java.awt.event.KeyEvent.VK_SHIFT | ||
import java.time.Duration.ofSeconds | ||
import org.junit.jupiter.api.AfterEach | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
|
||
// TODO: | ||
// Writes a sample changelog file to the project dir (before opening the project) | ||
// Writes the setting to the skate config | ||
// Opens the project | ||
// Asserts that the panel opened and showed the changelog | ||
|
||
@ExtendWith(RemoteRobotExtension::class) | ||
class SkatePluginTest { | ||
|
||
init { | ||
StepsLogger.init() | ||
} | ||
|
||
@BeforeEach | ||
fun waitForIde(remoteRobot: RemoteRobot) { | ||
waitForIgnoringError( | ||
ofSeconds(10), | ||
ofSeconds(2), | ||
"Wait for Ide started", | ||
"Ide is not started" | ||
) { | ||
remoteRobot.callJs("true") | ||
} | ||
} | ||
|
||
@AfterEach | ||
fun closeProject(remoteRobot: RemoteRobot) = | ||
with(remoteRobot) { | ||
idea { | ||
if (remoteRobot.isMac()) { | ||
keyboard { | ||
hotKey(VK_SHIFT, VK_META, VK_A) | ||
enterText("Close Project") | ||
enter() | ||
} | ||
} else { | ||
menuBar.select("File", "Close Project") | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
// @Video | ||
fun checkToolWindow(remoteRobot: RemoteRobot) { | ||
with(remoteRobot) { | ||
val toolWindow = find(ToolWindowFixture::class.java, timeout = ofSeconds(10)) | ||
assertThat(toolWindow.window.isShowing).isTrue() | ||
} | ||
} | ||
|
||
// @Test | ||
// fun testToolWindowExists() { | ||
// val robot = RemoteRobot("http://127.0.0.1:8082") | ||
// checkToolWindow(robot) | ||
// } | ||
// @Test | ||
// fun checkToolWindow() { | ||
// // Create a RemoteRobot instance with the default URL (localhost:8082) | ||
// val robot = RemoteRobot("http://127.0.0.1:8082") | ||
// | ||
// // See if Tool Window has the same name it's supposed to | ||
// val toolWindow = | ||
// robot.find( | ||
// ComponentFixture::class.java, | ||
// byXpath("//div[@accessibilityName=\"What's New in Slack!\"]") | ||
// ) | ||
// | ||
// // Check if the Tool Window is showing | ||
// assertThat(toolWindow.isShowing).isTrue() | ||
// } | ||
} |
65 changes: 65 additions & 0 deletions
65
skate-plugin/src/test/kotlin/com/slack/sgp/intellij/pages/IdeaFrame.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 | ||
// license that can be found in the LICENSE file. | ||
|
||
package com.slack.sgp.intellij.pages | ||
|
||
import com.intellij.remoterobot.RemoteRobot | ||
import com.intellij.remoterobot.data.RemoteComponent | ||
import com.intellij.remoterobot.fixtures.* | ||
import com.intellij.remoterobot.search.locators.byXpath | ||
import com.intellij.remoterobot.stepsProcessing.step | ||
import com.intellij.remoterobot.utils.waitFor | ||
import java.time.Duration | ||
|
||
fun RemoteRobot.idea(function: IdeaFrame.() -> Unit) { | ||
find<IdeaFrame>(timeout = Duration.ofSeconds(10)).apply(function) | ||
} | ||
|
||
@FixtureName("Idea frame") | ||
@DefaultXpath("IdeFrameImpl type", "//div[@class='IdeFrameImpl']") | ||
class IdeaFrame(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent) : | ||
CommonContainerFixture(remoteRobot, remoteComponent) { | ||
|
||
val projectViewTree | ||
get() = find<ContainerFixture>(byXpath("ProjectViewTree", "//div[@class='ProjectViewTree']")) | ||
|
||
val projectName | ||
get() = | ||
step("Get project name") { | ||
return@step callJs<String>("component.getProject().getName()") | ||
} | ||
|
||
val menuBar: JMenuBarFixture | ||
get() = | ||
step("Menu...") { | ||
return@step remoteRobot.find(JMenuBarFixture::class.java, JMenuBarFixture.byType()) | ||
} | ||
|
||
@JvmOverloads | ||
fun dumbAware(timeout: Duration = Duration.ofMinutes(5), function: () -> Unit) { | ||
step("Wait for smart mode") { | ||
waitFor(duration = timeout, interval = Duration.ofSeconds(5)) { | ||
runCatching { isDumbMode().not() }.getOrDefault(false) | ||
} | ||
function() | ||
step("..wait for smart mode again") { | ||
waitFor(duration = timeout, interval = Duration.ofSeconds(5)) { isDumbMode().not() } | ||
} | ||
} | ||
} | ||
|
||
fun isDumbMode(): Boolean { | ||
return callJs( | ||
""" | ||
const frameHelper = com.intellij.openapi.wm.impl.ProjectFrameHelper.getFrameHelper(component) | ||
if (frameHelper) { | ||
const project = frameHelper.getProject() | ||
project ? com.intellij.openapi.project.DumbService.isDumb(project) : true | ||
} else { | ||
true | ||
} | ||
""", | ||
true | ||
) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
skate-plugin/src/test/kotlin/com/slack/sgp/intellij/pages/ToolWindowFixture.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.slack.sgp.intellij.pages | ||
|
||
import com.intellij.remoterobot.RemoteRobot | ||
import com.intellij.remoterobot.data.RemoteComponent | ||
import com.intellij.remoterobot.fixtures.CommonContainerFixture | ||
import com.intellij.remoterobot.fixtures.ComponentFixture | ||
import com.intellij.remoterobot.fixtures.DefaultXpath | ||
import com.intellij.remoterobot.fixtures.FixtureName | ||
import com.intellij.remoterobot.search.locators.byXpath | ||
import java.time.Duration | ||
|
||
fun RemoteRobot.toolWindow(function: ToolWindowFixture.() -> Unit) { | ||
find(ToolWindowFixture::class.java, Duration.ofSeconds(10)).apply(function) | ||
} | ||
|
||
@FixtureName("Tool Window") | ||
@DefaultXpath("type", "//div[@accessibilityName=\"What's New in Slack!\"]") | ||
class ToolWindowFixture(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent) : | ||
CommonContainerFixture(remoteRobot, remoteComponent) { | ||
val window | ||
get() = | ||
find( | ||
ComponentFixture::class.java, | ||
byXpath("//div[@accessibilityName=\"What's New in Slack!\"]") | ||
) | ||
} |
34 changes: 34 additions & 0 deletions
34
skate-plugin/src/test/kotlin/com/slack/sgp/intellij/pages/WelcomeFrame.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 | ||
// license that can be found in the LICENSE file. | ||
|
||
package com.slack.sgp.intellij.pages | ||
|
||
import com.intellij.remoterobot.RemoteRobot | ||
import com.intellij.remoterobot.data.RemoteComponent | ||
import com.intellij.remoterobot.fixtures.* | ||
import com.intellij.remoterobot.search.locators.byXpath | ||
import java.time.Duration | ||
|
||
fun RemoteRobot.welcomeFrame(function: WelcomeFrame.() -> Unit) { | ||
find(WelcomeFrame::class.java, Duration.ofSeconds(10)).apply(function) | ||
} | ||
|
||
@FixtureName("Welcome Frame") | ||
@DefaultXpath("type", "//div[@class='FlatWelcomeFrame']") | ||
class WelcomeFrame(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent) : | ||
CommonContainerFixture(remoteRobot, remoteComponent) { | ||
val createNewProjectLink | ||
get() = | ||
actionLink( | ||
byXpath( | ||
"New Project", | ||
"//div[(@class='MainButton' and @text='New Project') or (@accessiblename='New Project' and @class='JButton')]" | ||
) | ||
) | ||
val moreActions | ||
get() = button(byXpath("More Action", "//div[@accessiblename='More Actions']")) | ||
|
||
val heavyWeightPopup | ||
get() = | ||
remoteRobot.find(ComponentFixture::class.java, byXpath("//div[@class='HeavyWeightWindow']")) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does this test run without
@Test
on it?