-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#835 added printing ios and android software versions
- Loading branch information
Piotr Adamczyk
committed
Jul 10, 2020
1 parent
d41729d
commit 938458b
Showing
17 changed files
with
232 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 15 additions & 15 deletions
30
test_runner/src/main/kotlin/ftl/environment/ListAndroidDevices.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
test_runner/src/main/kotlin/ftl/environment/ListAndroidSofwareVersions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ftl.environment | ||
|
||
import com.google.api.services.testing.model.AndroidVersion | ||
import ftl.reports.api.twoDigitString | ||
import ftl.util.applyColorsUsing | ||
import ftl.util.buildTable | ||
|
||
fun List<AndroidVersion>.asPrintableTable() = createTestEnvironmentInfo().createAndroidSoftwareVersionsTable() | ||
|
||
private fun List<AndroidVersion>.createTestEnvironmentInfo() = | ||
fold(mutableMapOf<String, MutableList<String>>()) { softwareInfo, softwareVersion -> | ||
softwareInfo.apply { | ||
getOrCreateList(OS_VERSION_ID).add(softwareVersion.id) | ||
getOrCreateList(VERSION).add(softwareVersion.versionString) | ||
getOrCreateList(CODE_NAME).add(softwareVersion.codeName) | ||
getOrCreateList(API_LEVEL).add(softwareVersion.apiLevel.toString()) | ||
getOrCreateList(RELEASE_DATE).add(with(softwareVersion.releaseDate) { "$year-${month.twoDigitString()}-${day.twoDigitString()}" }) | ||
getOrCreateList(TAGS).add(softwareVersion.tags.orEmpty().joinToString()) | ||
} | ||
} | ||
|
||
private fun TestEnvironmentInfo.createAndroidSoftwareVersionsTable() = buildTable( | ||
createTableColumnFor(OS_VERSION_ID), | ||
createTableColumnFor(VERSION), | ||
createTableColumnFor(CODE_NAME), | ||
createTableColumnFor(API_LEVEL), | ||
createTableColumnFor(RELEASE_DATE), | ||
createTableColumnFor(TAGS).applyColorsUsing(tagToSystemOutColorMapper) | ||
) | ||
|
||
const val VERSION = "VERSION" | ||
const val CODE_NAME = "CODE_NAME" | ||
const val API_LEVEL = "API_LEVEL" | ||
const val RELEASE_DATE = "RELEASE_DATE" |
26 changes: 13 additions & 13 deletions
26
test_runner/src/main/kotlin/ftl/environment/ListIOsDevices.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
test_runner/src/main/kotlin/ftl/environment/ListIOsSofwareVersions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package ftl.environment | ||
|
||
import com.google.api.services.testing.model.IosVersion | ||
import ftl.util.applyColorsUsing | ||
import ftl.util.buildTable | ||
|
||
fun List<IosVersion>.asPrintableTable() = createTestEnvironmentInfo().createIOsSoftwareVersionsTable() | ||
|
||
private fun List<IosVersion>.createTestEnvironmentInfo() = | ||
fold(mutableMapOf<String, MutableList<String>>()) { softwareInfo, softwareVersion -> | ||
softwareInfo.apply { | ||
getOrCreateList(OS_VERSION_ID).add(softwareVersion.id) | ||
getOrCreateList(MAJOR_VERSION).add(softwareVersion.majorVersion?.toString().orEmpty()) | ||
getOrCreateList(MINOR_VERSION).add(softwareVersion.minorVersion?.toString().orEmpty()) | ||
getOrCreateList(TAGS).add(softwareVersion.tags.orEmpty().joinToString()) | ||
getOrCreateList(SUPPORTED_XCODE_VERSION_IDS).add(softwareVersion.supportedXcodeVersionIds.joinToString()) | ||
} | ||
} | ||
|
||
private fun TestEnvironmentInfo.createIOsSoftwareVersionsTable() = buildTable( | ||
createTableColumnFor(OS_VERSION_ID), | ||
createTableColumnFor(MAJOR_VERSION), | ||
createTableColumnFor(MINOR_VERSION), | ||
createTableColumnFor(TAGS).applyColorsUsing(tagToSystemOutColorMapper), | ||
createTableColumnFor(SUPPORTED_XCODE_VERSION_IDS) | ||
) | ||
|
||
private const val MAJOR_VERSION = "MAJOR_VERSION" | ||
private const val MINOR_VERSION = "MINOR_VERSION" | ||
private const val SUPPORTED_XCODE_VERSION_IDS = "SUPPORTED_XCODE_VERSION_IDS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ftl.reports.api | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class UtilsTest { | ||
|
||
@Test | ||
fun `should add leading 0 to single digit integer`() { | ||
// given | ||
val expectedString = "05" | ||
|
||
// when | ||
val actual = 5.twoDigitString() | ||
|
||
// then | ||
assertEquals(expectedString, actual) | ||
} | ||
|
||
@Test | ||
fun `should not add leading 0 to two digits integer`() { | ||
// given | ||
val expectedString = "15" | ||
|
||
// when | ||
val actual = 15.twoDigitString() | ||
|
||
// then | ||
assertEquals(expectedString, actual) | ||
} | ||
} |