Code Monkey home page Code Monkey logo

Comments (3)

jimevanssfdc avatar jimevanssfdc commented on September 24, 2024

@alan-morey This seems like a reasonable feature request, and the UTAM team will take it under advisement for implementation in a future release. In the meantime, you can use your existing UtamLoader instance to set the length of the explicit wait timeout at runtime. Something like the following (N.B., code written from memory, and without the benefit of an IDE, so may not work exactly correctly, or even compile if copy-pasted directly into your project):

public class MyTests {

    private UtamLoader loader;

    @BeforeAll
    public void setup() {
        // Call your loader setup method, with a valid WebDriver instance.
        // Creation of WebDriver instance is omitted for brevity.
        loader = setupUtamLoader(driver);
    }

    @Test
    public void myTest() {
        // Load the root PO, which we will assume has the waitFor you'd like to configure
        MyPageObject pageObjectInstance = loader.load(MyPageObject.class);

        // Dynamically set the explicit timeout of the loader config
        loader.getConfig().setExplicitTimeout(Duration.ofSeconds(5));
        loader.resetContext();

        // Call the waitFor method on the appropriate element
        pageObjectInstance.getMyElement().waitFor(...);

        // Reset the loader config to the larger timeout setting
        loader.getConfig().setExplicitTimeout(Duration.ofSeconds(90));
        loader.resetContext();
    }
}

from utam-java.

lizaiv77 avatar lizaiv77 commented on September 24, 2024

@alan-morey Sorry for late response, feature was implemented in version 1.6.0
Docs https://utam.dev/grammar/explicit-waits

from utam-java.

alan-morey avatar alan-morey commented on September 24, 2024

@lizaiv77 Did you mean v1.1.6, I don't see v1.6.0 in github tags or a release under https://mvnrepository.com/artifact/com.salesforce.utam/utam-core

Correct me if I'm wrong but I don't think the feature I was requesting here was actually implemented based on the current dev branch.

While I can see a new signature was added to UtamBase to support a custom message argument:

/**
* polling wait that repeatedly applies expectations until truthy value is return (not null or
* boolean true)
*
* @param condition condition to wait for
* @param <T> return type
* @param errorMessage message used in the thrown timeout exception
* @return result of the applied expectations
*/
<T> T waitFor(Supplier<T> condition, String errorMessage);

It's still missing the signature to support a custom timeout duration, e.g.:

  <T> T waitFor(Supplier<T> condition, String errorMessage, Duration timeout);

It's the timeout duration I'm most interested in here not a custom message.

from utam-java.

Related Issues (5)

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.