Giter Site home page Giter Site logo

Comments (2)

EvgenyMeltsaykin avatar EvgenyMeltsaykin commented on May 19, 2024 2

Hi!

You can override the KNode constructor like in this issue

@Vacxe Can you explain why the useUnmergedTree flag has a default value of false? Perhaps it's worth pointing this out in the documentation and workaround examples?

from compose.

Vacxe avatar Vacxe commented on May 19, 2024 2

@EvgenyMeltsaykin sure mate, actually the answer is quite simple:
Kakao/KakaoCompose it's a DSL wrapper over Espresso library, with amount of extra custom matchers and assertions. We trying DO NOT change any default Espresso behavior. So, lets jump in to Espresso code

androidx.compose.ui.test.SemanticsNodeInteractionsProvider

package androidx.compose.ui.test

import androidx.compose.ui.test.internal.JvmDefaultWithCompatibility

/**
 * Provides the main entry point into testing.
 *
 * Typically implemented by a test rule.
 */
@JvmDefaultWithCompatibility
interface SemanticsNodeInteractionsProvider {
    /**
     * Finds a semantics node that matches the given condition.
     *
     * Any subsequent operation on its result will expect exactly one element found (unless
     * [SemanticsNodeInteraction.assertDoesNotExist] is used) and will throw [AssertionError] if
     * none or more than one element is found.
     *
     * For usage patterns and semantics concepts see [SemanticsNodeInteraction]
     *
     * @param matcher Matcher used for filtering
     * @param useUnmergedTree Find within merged composables like Buttons.
     * @see onAllNodes to work with multiple elements
     */
    fun onNode(
        matcher: SemanticsMatcher,
        useUnmergedTree: Boolean = false
    ): SemanticsNodeInteraction

    /**
     * Finds all semantics nodes that match the given condition.
     *
     * If you are working with elements that are not supposed to occur multiple times use [onNode]
     * instead.
     *
     * For usage patterns and semantics concepts see [SemanticsNodeInteraction]
     *
     * @param matcher Matcher used for filtering.
     * @param useUnmergedTree Find within merged composables like Buttons.
     * @see onNode
     */
    fun onAllNodes(
        matcher: SemanticsMatcher,
        useUnmergedTree: Boolean = false
    ): SemanticsNodeInteractionCollection
}

useUnmergedTree: Boolean = false - default Espresso behavior

from compose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.