Add testing for karma use puppeteer for downloading chrome
This commit is contained in:
+21
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+31
@@ -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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
kotlin.tests.individualTaskReports=true
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "kotlin-js-karma-download-chrome"
|
||||
+8
@@ -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"
|
||||
+21
@@ -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())
|
||||
}
|
||||
}
|
||||
+13
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user