Skip to content
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
wants to merge 29 commits into from
Closed

Smoke test for Skate Plugin #468

wants to merge 29 commits into from

Conversation

kateliu20
Copy link
Contributor

No description provided.

@kateliu20 kateliu20 added the skate 🛹 Anything related to the Skate IntelliJ plugin label Jul 17, 2023
@kateliu20 kateliu20 requested a review from ZacSweers July 17, 2023 21:06
@kateliu20 kateliu20 self-assigned this Jul 17, 2023
Copy link
Collaborator

@ZacSweers ZacSweers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice start! Do you think we can set up a test that does the following

  1. Writes a sample changelog file to the project dir (before opening the project)
  2. Writes the setting to the skate config
  3. Opens the project
  4. Asserts that the panel opened and showed the changelog


class SkatePluginInitializationTest : BasePlatformTestCase() {

fun `test Skate Plugin Service Initialization to ensure SkateProjectService is properly registered & initialized`() {
Copy link
Collaborator

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?


fun `test Skate Plugin Service Initialization to ensure SkateProjectService is properly registered & initialized`() {
val skateService = project.service<SkateProjectService>()
assertTrue(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use the Truth assertion APIs like we do in other unit tests?

service.showWhatsNewWindow()
}

fun `test Tool Window Exists`() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here re: @Test

Comment on lines 24 to 26
override fun tearDown() {
super.tearDown()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be implemented since we don't do anything extra?


val toolWindowRegistered = toolWindowManager.getToolWindow(toolWindowId)

TestCase.assertNotNull("Tool Window doesn't exist", toolWindowRegistered)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here re: using Truth

Katherine Liu added 2 commits July 17, 2023 17:19
…settings to the skate config, opens the project, and asserts the panel is open
@kateliu20
Copy link
Contributor Author

kateliu20 commented Jul 18, 2023

Nice start! Do you think we can set up a test that does the following

  1. Writes a sample changelog file to the project dir (before opening the project)
  2. Writes the setting to the skate config
  3. Opens the project
  4. Asserts that the panel opened and showed the changelog

I wrote a test in SkatePluginTest.kt that addresses these, and also wrote a test in SkatePluginInitializationTest.kt separating the settings configuration. The test in the initialization file pass, but it's stating that toolWindow is null when I test that the panel opens up. I am not sure if I am referring to the tool window wrong in my test?

Copy link
Collaborator

@ZacSweers ZacSweers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote a test in SkatePluginTest.kt that addresses these, and also wrote a test in SkatePluginInitializationTest.kt separating the settings configuration. The test in the initialization file pass, but it's stating that toolWindow is null when I test that the panel opens up. I am not sure if I am referring to the tool window wrong in my test?

Not sure, you'll need to figure it out :). I suspect it's running headlessly so there's no window open, so we'd need to see how to test it with UI

settings.whatsNewFilePath = changelogFile.absolutePath

val skateService = project.service<SkateProjectService>()
skateService.showWhatsNewWindow()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin should do thus automatically when we open the project, right? Otherwise our test is implementing what we're trying to test

val skateService = project.service<SkateProjectService>()
skateService.showWhatsNewWindow()

// account for async functions?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this referencing?

@ZacSweers
Copy link
Collaborator

Gonna close this out for now and we'll revisit in the future!

@ZacSweers ZacSweers closed this Sep 20, 2023
@ZacSweers ZacSweers deleted the kl/smoke_test branch September 20, 2023 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skate 🛹 Anything related to the Skate IntelliJ plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants