Esempio n. 1
0
        public void TestFieldAccessInOpera()
        {
            //_GenericFieldAssertions(Browsers.Opera.String);

            using (IJavaSelenium javaSelenium = _GetJavaSelenium(Browsers.Opera.String, FIELD_ACCESS_OBJECT_ID))
            {
                javaSelenium.Selenium.Start();
                javaSelenium.Selenium.Open(URL);

                Assert.AreEqual("5", javaSelenium.GetField("intField"));
                javaSelenium.SetField("intField", 6);
                Assert.AreEqual("6", javaSelenium.GetField("intField"));

                // BUG: It seems that return values that are strings are affected
                //Assert.AreEqual("Hello", javaSelenium.GetField("stringField"));
                //javaSelenium.SetField("stringField", "Goodbye");
                //Assert.AreEqual("Goodbye", javaSelenium.GetField("stringField"));

                Assert.AreEqual("6", javaSelenium.GetField("otherField.intField"));
                javaSelenium.SetField("otherField.intField", 7);
                Assert.AreEqual("7", javaSelenium.GetField("otherField.intField"));

                // BUG: It seems that return values that are strings are affected
                //Assert.AreEqual("Testing", javaSelenium.GetField("otherField.stringField"));
                //javaSelenium.SetField("otherField.stringField", "1, 2, 3");
                //Assert.AreEqual("1, 2, 3", javaSelenium.GetField("otherField.stringField"));
            }
        }
Esempio n. 2
0
        private static void _GenericNonExistentMethodAssertions(string pBrowser)
        {
            using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowser, METHOD_INVOCATION_OBJECT_ID))
            {
                javaSelenium.Selenium.Open(URL);

                Assert.Fail(javaSelenium.InvokeMethod("methodDoesNotExist"));
            }
        }
Esempio n. 3
0
        private static void _GenericAppletAssertions(string pBrowserString)
        {
            using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowserString, APPLET_URL, APPLET_OBJECT_ID))
            {
                javaSelenium.Selenium.Open(APPLET_URL);

                javaSelenium.InvokeMethod("init");
            }
        }
Esempio n. 4
0
        private static void _GenericPackageAssertions(string pBrowser)
        {
            using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowser, PACKAGE_ACCESS_OBJECT_ID))
            {
                javaSelenium.Selenium.Open(URL);

                Assert.AreEqual("5", javaSelenium.GetField("Packages.com.mycompany.MyClass.staticField"));
                javaSelenium.SetField("Packages.com.mycompany.MyClass.staticField", 6);
                Assert.AreEqual("6", javaSelenium.GetField("Packages.com.mycompany.MyClass.staticField"));

                javaSelenium.InvokeMethod("Packages.com.mycompany.MyClass.staticMethod");
            }
        }
Esempio n. 5
0
        private static void _GenericNonExistentFieldAssertions(string pBrowser)
        {
            using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowser, FIELD_ACCESS_OBJECT_ID))
            {
                javaSelenium.Selenium.Open(URL);

                //////////////////////////////////////////////////////////////////////////
                // WARNING : Unlike calling an non-existent method, calling a non-existent
                //           field returns "null"
                //////////////////////////////////////////////////////////////////////////

                Assert.AreEqual("null", javaSelenium.GetField("nonExistentField"));
            }
        }
Esempio n. 6
0
        private static void _GenericArrayAssertions(string pBrowser)
        {
            using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowser, ARRAY_ACCESS_OBJECT_ID))
            {
                javaSelenium.Selenium.Open(URL);

                Assert.AreEqual("1,2,3", javaSelenium.InvokeMethod("returns123"));

                // Note: This will work in Opera; it seems if the return value is a String [] then all is good
                Assert.AreEqual("Hello,world", javaSelenium.InvokeMethod("returnsHelloWorld"));

                // Bug: Multi-dimensonal arrays are broken - looks like they return an array of pointers
                //Assert.AreEqual("[[1, 2, 3][4, 5, 6][7, 8, 9]]", javaSelenium.InvokeMethod("returns1Through9"));
            }
        }
Esempio n. 7
0
        private static void _GenericMethodAssertions(string pBrowser)
        {
            using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowser, METHOD_INVOCATION_OBJECT_ID))
            {
                javaSelenium.Selenium.Open(URL);

                javaSelenium.InvokeMethod("noArgMethod");

                javaSelenium.InvokeMethod("someMethod", 5);
                javaSelenium.InvokeMethod("someMethod", "Hello");

                Assert.AreEqual("5", javaSelenium.InvokeMethod("methodReturningInt"));
                Assert.AreEqual("Hello", javaSelenium.InvokeMethod("methodReturningString"));

                javaSelenium.InvokeMethod("methodReturningObject().anotherMethod");
            }
        }
Esempio n. 8
0
        public void TestMethodsInOpera()
        {
            //_GenericMethodAssertions(Browsers.Opera.String);
            using (IJavaSelenium javaSelenium = _GetJavaSelenium(Browsers.Opera.String, METHOD_INVOCATION_OBJECT_ID))
            {
                javaSelenium.Selenium.Start();
                javaSelenium.Selenium.Open(URL);

                javaSelenium.InvokeMethod("noArgMethod");

                javaSelenium.InvokeMethod("someMethod", 5);
                javaSelenium.InvokeMethod("someMethod", "Hello");

                Assert.AreEqual("5", javaSelenium.InvokeMethod("methodReturningInt"));

                // BUG: For some strange reason, this method does not work
                //Assert.AreEqual("Hello", javaSelenium.InvokeMethod("methodReturningString"));

                javaSelenium.InvokeMethod("methodReturningObject().anotherMethod");
            }
        }
Esempio n. 9
0
        private static void _GenericFieldAssertions(string pBrowser)
        {
            using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowser, FIELD_ACCESS_OBJECT_ID))
            {
                javaSelenium.Selenium.Open(URL);

                Assert.AreEqual("5", javaSelenium.GetField("intField"));
                javaSelenium.SetField("intField", 6);
                Assert.AreEqual("6", javaSelenium.GetField("intField"));

                Assert.AreEqual("Hello", javaSelenium.GetField("stringField"));
                javaSelenium.SetField("stringField", "Goodbye");
                Assert.AreEqual("Goodbye", javaSelenium.GetField("stringField"));

                Assert.AreEqual("6", javaSelenium.GetField("otherField.intField"));
                javaSelenium.SetField("otherField.intField", 7);
                Assert.AreEqual("7", javaSelenium.GetField("otherField.intField"));

                Assert.AreEqual("Testing", javaSelenium.GetField("otherField.stringField"));
                javaSelenium.SetField("otherField.stringField", "1, 2, 3");
                Assert.AreEqual("1, 2, 3", javaSelenium.GetField("otherField.stringField"));
            }
        }
Esempio n. 10
0
 private void _OpenPage(IJavaSelenium javaSelenium)
 {
     javaSelenium.Selenium.Open(URL);
     javaSelenium.Selenium.WaitForPageToLoad("10000");
     javaSelenium.Selenium.WindowMaximize();
 }