Skip to content

Commit

Permalink
Setup running a UI test project via Gradle integration tests infrastr…
Browse files Browse the repository at this point in the history
…ucture (#3583)
  • Loading branch information
whyoleg authored Apr 29, 2024
1 parent 194efe6 commit 4ba3291
Show file tree
Hide file tree
Showing 75 changed files with 98 additions and 464 deletions.
1 change: 1 addition & 0 deletions dokka-integration-tests/gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 183,7 @@ testing {
}
}
}
registerTestProjectSuite("testUiShowcaseProject", "ui-showcase")
}
}

Expand Down
Original file line number Diff line number Diff line change
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
```
Original file line number Diff line number Diff line change
@@ -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")
}
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 3,5 @@
*/

plugins {
id("uitest.base")
id("uitest.dokka")
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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")
Original file line number Diff line number Diff line change
@@ -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.

Loading

0 comments on commit 4ba3291

Please sign in to comment.