Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

IOS tests and info.plist #2426

Closed
Dkhusainov opened this issue Nov 28, 2018 · 6 comments
Closed

IOS tests and info.plist #2426

Dkhusainov opened this issue Nov 28, 2018 · 6 comments

Comments

@Dkhusainov
Copy link

Dkhusainov commented Nov 28, 2018

Currently when running ios test with command xcrun simctl spawn iPhone 8 text.kexe generated test.kexe.DYSM/Contents/info.plist desn't affect the test environment in any way. Is it supposed to work or do we have to find some other way to run tests with modified info.plist?

@SvyatoslavScherbina
Copy link
Collaborator

Could you provide an example of test.kexe.DYSM/Contents/Info.plist property that should affect the test environment? This is .plist file for debug symbols bundle, not for the binary itself.

@Dkhusainov
Copy link
Author

<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>

I'm trying to do a test with netowrk, and it fails because by default IOS doesn't allow unsecure(or old ssl vertions, or not trusted cert) connnections. I'm not expert at IOS, maybe there is some other way to bypass it

@SvyatoslavScherbina
Copy link
Collaborator

NSAppTransportSecurity looks like a key that should be included into Info.plist of the binary itself. What happens if you create a bundle with text.kexe and proper Info.plist, and then run the binary from this bundle with xcrun simctl spawn?

@Dkhusainov
Copy link
Author

Okay. I'll try this some time later when I have the time. Don't close the issue for now

@SvyatoslavScherbina
Copy link
Collaborator

You can try this Gradle task proposed by Aleks Nestserau:

task iosTest {
    def device = project.findProperty("iosDevice")?.toString() ?: "iPhone 8"
    dependsOn 'linkTestDebugExecutableIos'
    group = JavaBasePlugin.VERIFICATION_GROUP
    description = "Runs tests for target 'ios' on an iOS simulator"

    doLast {
        def binary = kotlin.targets.ios.compilations.test.getBinary('EXECUTABLE', 'DEBUG')
        def infoPlistSrc = file("$rootProject.projectDir/src/iosTest/resources/Info.plist")
        def infoPlistDest = file("$binary.parentFile/Info.plist")

        Files.copy(infoPlistSrc.toPath(), infoPlistDest.toPath(), StandardCopyOption.REPLACE_EXISTING)

        exec {
            commandLine 'export', 'SIMCTL_CHILD_CFNETWORK_DIAGNOSTICS=3'
            commandLine 'xcrun', 'simctl', 'spawn', device, binary.absolutePath
        }
    }
}

@ilmat192
Copy link
Contributor

According to migrating issue tracking to YouTrack, closing this issue in favour of KT-37818 which describes test resources as a more general feature.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants