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

Setup running a UI test project via Gradle integration tests infrastructure #3583

Merged
merged 3 commits into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions dokka-integration-tests/gradle/build.gradle.kts
Expand Up @@ -183,6 +183,7 @@ testing {
}
}
}
registerTestProjectSuite("testUiShowcaseProject", "ui-showcase")
}
}

Expand Down
Expand Up @@ -5,16 +5,9 @@ This is a Dokka test project for UI e2e tests.
The goal is to have as much variety of UI elements in one project as possible, so that during refactorings
we can compare the outputs between different versions of Dokka and make sure we didn't break any corner cases.

## How To

### Change Dokka version

The used Dokka version can be changed in [gradle/libs.versions.toml](gradle/libs.versions.toml).

Currently, this project works with release, `-dev`, `-test` and `-SNAPSHOT` versions.

### Run
### Run from root of the project

```bash
./gradlew dokkaHtmlMultiModule
export DOKKA_TEST_OUTPUT_PATH="build/ui-showcase-result"
./gradlew :dokka-integration-tests:gradle:testUiShowcaseProject
```
@@ -0,0 +1,15 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
`kotlin-dsl`
}

val dokka_it_kotlin_version: String by project
val dokka_it_dokka_version: String by project

dependencies {
implementation("org.jetbrains.dokka:dokka-gradle-plugin:$dokka_it_dokka_version")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$dokka_it_kotlin_version")
}
@@ -0,0 +1,6 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

apply(from = "../template.settings.gradle.kts")
rootProject.name = "build-logic"
@@ -1,12 +1,14 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

import org.intellij.lang.annotations.Language
import org.jetbrains.dokka.gradle.AbstractDokkaTask

plugins {
id("uitest.base")
id("org.jetbrains.dokka")
}


tasks.withType<AbstractDokkaTask>().configureEach {
@Language("JSON")
val dokkaBaseConfiguration = """
Expand Down
Expand Up @@ -3,6 +3,5 @@
*/

plugins {
id("uitest.base")
id("uitest.dokka")
}
@@ -1,4 +1,6 @@
import java.net.URL
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
id("uitest.dokka")
Expand All @@ -16,7 +18,7 @@ tasks.dokkaHtmlPartial {

sourceLink {
localDirectory.set(projectDir.resolve("src"))
remoteUrl.set(URL("https://github.com/kotlin/dokka/dokka-integration-tests/ui/test-project/jvm/src"))
remoteUrl.set(uri("https://github.com/kotlin/dokka/dokka-integration-tests/ui/test-project/jvm/src").toURL())
remoteLineSuffix.set("#L")
}
}
Expand Down
@@ -1,3 +1,7 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
id("uitest.dokka")

Expand All @@ -8,11 +12,13 @@ kotlin {
jvm()
linuxX64()
macosX64()
js()
js {
nodejs()
}

sourceSets {
commonMain.dependencies {
implementation(libs.kotlinx.coroutines)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0")
}
}
}
Expand Down
@@ -0,0 +1,13 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

apply(from = "template.settings.gradle.kts")

pluginManagement {
includeBuild("build-logic")
}

rootProject.name = "ui-showcase"
include(":jvm")
include(":kmp")
@@ -0,0 +1,44 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package org.jetbrains.dokka.it.gradle

import org.gradle.testkit.runner.TaskOutcome
import org.jetbrains.dokka.it.TestOutputCopier
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ArgumentsSource
import java.io.File
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue

class UiShowcaseIntegrationTest : AbstractGradleIntegrationTest(), TestOutputCopier {
override val projectOutputLocation: File by lazy { File(projectDir, "build/dokka/htmlMultiModule") }

@OnlyDescriptors("CPointer is not resolved in K2")
@ParameterizedTest(name = "{0}")
@ArgumentsSource(LatestTestedVersionsArgumentsProvider::class)
fun execute(buildVersions: BuildVersions) {
val result = createGradleRunner(
buildVersions,
"dokkaHtmlMultiModule",
"-i",
"-s"
).buildRelaxed()

assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtmlMultiModule")).outcome)
assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":jvm:dokkaHtmlPartial")).outcome)
assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":kmp:dokkaHtmlPartial")).outcome)

assertTrue(projectOutputLocation.isDirectory, "Missing dokka output directory")

projectOutputLocation.allHtmlFiles().forEach { file ->
assertContainsNoErrorClass(file)
assertNoUnresolvedLinks(file)
assertNoHrefToMissingLocalFileOrDirectory(file)
assertNoEmptyLinks(file)
assertNoEmptySpans(file)
}
}
}
3 changes: 0 additions & 3 deletions dokka-integration-tests/ui/test-project/.gitignore

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions dokka-integration-tests/ui/test-project/gradle.properties

This file was deleted.

13 changes: 0 additions & 13 deletions dokka-integration-tests/ui/test-project/gradle/libs.versions.toml

This file was deleted.

Binary file not shown.

This file was deleted.