Add testing for karma use puppeteer for downloading chrome

This commit is contained in:
Ilya Goncharov
2019-09-06 11:37:06 +03:00
parent 18f2ba889e
commit 49391e64d6
7 changed files with 103 additions and 0 deletions
@@ -396,4 +396,25 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
assertTestResults("testProject/kotlin-js-plugin-project/tests.xml", "nodeTest")
}
}
@Test
fun testKotlinJsKarmaDownloadChrome() = with(Project("kotlin-js-karma-download-chrome", GradleVersionRequired.AtLeast("4.10.2"))) {
setupWorkingDir()
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
gradleSettingsScript().modify(::transformBuildScriptWithPluginsDsl)
build("test") {
assertFailed()
assertTasksExecuted(
":kotlinNpmInstall",
":compileKotlinJs",
":compileTestKotlinJs"
)
assertFileExists("build/js/node_modules/puppeteer/.local-chromium")
assertTestResults("testProject/kotlin-js-karma-download-chrome/tests.xml", "browserTest")
}
}
}
@@ -0,0 +1,31 @@
plugins {
kotlin("js") version "<pluginMarkerVersion>"
}
group = "com.example"
version = "1.0"
repositories {
mavenLocal()
jcenter()
}
kotlin {
target {
browser()
}
sourceSets {
getByName("main") {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
getByName("test") {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
rootProject.name = "kotlin-js-karma-download-chrome"
@@ -0,0 +1,8 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package com.example
fun value() = "value"
@@ -0,0 +1,21 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package com.example
import kotlin.test.Test
import kotlin.test.assertEquals
class ServiceTest {
@Test
fun serviceTest() {
assertEquals("value", value())
}
@Test
fun serviceFailTest() {
assertEquals("value12", value())
}
}
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<results>
<testsuite name="com.example.ServiceTest" tests="2" skipped="0" failures="1" errors="0" timestamp="..." hostname="..." time="...">
<properties/>
<testcase name="serviceTest" classname="com.example.ServiceTest" time="..."/>
<testcase name="serviceFailTest" classname="com.example.ServiceTest" time="...">
<failure message="..." type="AssertionError">...</failure>
</testcase>
<system-out/>
<system-err/>
</testsuite>
</results>