private static Engine CreateEngine(string html) { var resources = Mocks.ResourceProvider("http://localhost", html); var engine = TestingEngine.BuildJintCss(resources); return(engine); }
public static void GetComputedStyle() { var console = new TestingConsole(); var resourceProvider = Mock.Of <IResourceProvider>() .Resource("http://localhost", "<html><head><script src='test.js' defer/></head><body><div id=d></div></body></html>") .Resource("http://localhost/test.js", "console.log(window.getComputedStyle(document.getElementById('d')).getPropertyValue('display'));" + "console.log(getComputedStyle(document.getElementById('d')).getPropertyValue('display'));"); var engine = TestingEngine.BuildJintCss(resourceProvider, console); engine.OpenUrl("http://localhost").Wait(); CollectionAssert.AreEqual(new[] { "block", "block" }, console.LogHistory); }
public void GetComputedStyleTest() { var styles = @"strong {font-family:""Arial""} .a string {font-family:""Curier New""}"; var html = "<div class a><span><strong id=test></strong><span></div>"; var resourceProvider = Mocks.ResourceProvider("http://localhost", "<head><style>" + styles + "</style></head><body>" + html + "</body>"); var engine = TestingEngine.BuildJintCss(resourceProvider); var doc = engine.Document; var elt = doc.GetElementById("test"); elt.GetComputedStyle().GetPropertyValue("font-family"); _counter.Increment(); }
public void LogonToKwinto() { var engine = TestingEngine.BuildJintCss(); engine.LogEvents(); engine.OpenUrl("http://chi.todosoft.org").Wait(timeout); var logonButton = engine.WaitId("logon") as HtmlElement; var userName = engine.WaitId("UserName") as HtmlInputElement; var password = engine.WaitId("Password") as HtmlInputElement; Assert.IsNotNull(logonButton, "LogonButton"); Assert.IsNotNull(userName, "UserName"); Assert.IsNotNull(password, "Password"); userName.EnterText("admin"); password.EnterText("admin"); logonButton.Click(); var error = engine.WaitId("logout"); Assert.IsNotNull(error, "logout"); }