Beispiel #1
0
 public static Isotope <Unit> waitUntilClickable(IWebElement el, TimeSpan timeout) =>
 from _ in Isotope.waitUntil(
     from _1a in info($"Checking clickability " + prettyPrint(el))
     from d in displayed(el)
     from e in enabled(el)
     from o in obscured(el)
     from _2a in info($"Displayed: {d}, Enabled: {e}, Obscured: {o}")
     select d&& e && (!o),
     identity)
 select unit;
Beispiel #2
0
        /// <summary>
        /// Repeatedly runs an Isotope function and checks whether the condition is met
        /// </summary>
        public static Isotope <A> waitUntil <A>(
            Isotope <A> iso,
            Func <A, bool> condition,
            TimeSpan interval,
            TimeSpan wait,
            DateTime started)
        {
            return(go().Bind(o => o.Match(Some: pure, None: fail("Timed out"))));

            // NOTE: This will probably have to stop being recursive
            Isotope <Option <A> > go() =>
            DateTime.UtcNow - started >= wait
                    ? pure <Option <A> >(None)
                    : (from x in iso
                       from r in condition(x)
                                     ? pure(x)
                                     : fail("Condition failed")
                       select Some(r)) |
            (from _ in pause(interval)
             from r in go()
             select r);
        }
Beispiel #3
0
 /// <summary>
 /// Run the test computation - returning an optional error.
 /// The computation succeeds if result.IsNone is true
 /// </summary>
 /// <param name="ma">Test computation</param>
 public static (IsotopeState state, A value) Run <A>(this Isotope <A> ma, IsotopeSettings settings = null)
 {
Beispiel #4
0
 public static Isotope <Unit> assert(Isotope <bool> fact, string label) =>
 from f in fact
 from _ in assert(f, label)
 select unit;