Tester for System.Web.UI.HtmlControls.HtmlTable
Inheritance: HtmlControlTester
Example #1
0
        public void Test02MemberListPageWithUserID()
        {
            Console.WriteLine("Before Test02MemberListPageWithUserID");
            _dnarequest.SetCurrentUserEditor();
            _dnarequest.UseEditorAuthentication = true;
            string relativePath = @"/dna/haveyoursay/MemberList?userid=" + testSuperUserID.ToString();
            _dnarequest.RequestNUnitASPPage(relativePath, Browser);

            HtmlTableTester table = new HtmlTableTester("tblResults");

            bool found = false;
            HtmlTagTester htmltag = (HtmlTagTester) table.Rows[1].Children("td").GetValue(1);
            string userID = htmltag.InnerHtml;

            if (userID == testSuperUserID.ToString())
            {
                found = true;
            }
                /*string[] cells = row.TrimmedCells;
                if (cells[1] == userID)
                {
                    //List Created OK 
                    found = true;
                    break;
                }*/

            Assert.IsTrue(!found, "User " + testSuperUserID.ToString() + ": Not returned and displayed in Member List Page.");
            Console.WriteLine("After Test02MemberListPageWithUserID");
        }
Example #2
0
        public void Test05MemberListSearchByEmailPage()
        {
            Console.WriteLine("Before Test05MemberListSearchByEmailPage");
            _dnarequest.SetCurrentUserEditor();
            
            _dnarequest.UseEditorAuthentication = true;
            string relativePath = @"/dna/haveyoursay/MemberList";
            _dnarequest.RequestNUnitASPPage(relativePath, Browser);
            CurrentWebForm.Variables.Add("d_identityuserid", "dotneteditor");

            TextBoxTester entry = new TextBoxTester("txtEntry", CurrentWebForm);
            Assert.AreEqual(entry.Visible, true);
            entry.Text = "*****@*****.**";

            RadioButtonListTester radiolist = new RadioButtonListTester("rdSearchType", CurrentWebForm);
            Assert.AreEqual(radiolist.Visible, true);
            
            int index = GetSelectedIndex(radiolist, "Email");

            radiolist.SelectedIndex = index;

            ButtonTester search = new ButtonTester("Search", CurrentWebForm);
            search.Click();

            HtmlTableTester table = new HtmlTableTester("tblResults");

            bool found = false;
            if (table.BodyNoTags != "No data for those details")
            {
                for (int i = 1; i < table.Rows.Length; i++)
                {
                    HtmlTagTester htmltag = (HtmlTagTester)table.Rows[i].Children("td").GetValue(1);
                    string userID = htmltag.InnerHtml;

                    string testSuperUserIDLink = "<a href=\"/dna/moderation/MemberDetails?userid=" + testSuperUserID.ToString() + "\">U" + testSuperUserID.ToString() + "</a>";

                    if (userID == testSuperUserIDLink)
                    {
                        found = true;
                    }
                }
                Assert.IsTrue(found, "User " + testSuperUserID.ToString() + ": Not returned and displayed in Member List Page.");
            }
            else
            {
                Assert.IsTrue(false, "Error no results returned.");
            }
 
            Console.WriteLine("After Test05MemberListSearchByEmailPage");
        }
Example #3
0
        public void Test03MemberListPageWithWrongUserID()
        {
            Console.WriteLine("Before Test03MemberListPageWithWrongUserID");
            _dnarequest.SetCurrentUserEditor();
            _dnarequest.UseEditorAuthentication = true;
            string relativePath = @"/dna/haveyoursay/MemberList?userid=" + testWrongUserID.ToString();
            _dnarequest.RequestNUnitASPPage(relativePath, Browser);

            HtmlTableTester table = new HtmlTableTester("tblResults");

            bool nodata = false;
            if (table.BodyNoTags == "No data for those details")
            {
                nodata = true;
            }

            Assert.IsTrue(nodata, "User " + testWrongUserID.ToString() + ": Is returned and displayed in Member List Page when it shouldn't be.");
            Console.WriteLine("After Test03MemberListPageWithWrongUserID");
        }
Example #4
0
        protected override void SetUp()
        {
            table = new HtmlTableTester("table");
            emptyTable = new HtmlTableTester("emptyTable");
            malformedTable = new HtmlTableTester("malformed");
            outerNestedTable = new HtmlTableTester("outerNestedTable");
            headerTags = new HtmlTableTester("headerTags");

            Browser.GetPage(BaseUrl + "/HtmlTester/HtmlTableTestPage.aspx");
        }
        public void Test05RestrictedUsersListSearchByMostRecentPage()
        {
            try
            {
                DnaTestURLRequest dnaRequest = new DnaTestURLRequest("haveyoursay");
                Console.WriteLine("Before Test05RestrictedUsersListSearchByMostRecentPage");
                dnaRequest.SetCurrentUserEditor();
                dnaRequest.UseEditorAuthentication = true;
                string relativePath = @"/dna/haveyoursay/RestrictedUsers";
                dnaRequest.RequestNUnitASPPage(relativePath, Browser);

                ButtonTester mostRecent = new ButtonTester("btnMostRecent", CurrentWebForm);
                mostRecent.Click();

                HtmlTableTester table = new HtmlTableTester("tblResults");

                bool isdata = true;
                if (table.BodyNoTags != "No data for those details")
                {
                    isdata = false;
                }

                Assert.IsTrue(isdata, "No data for Most Recent accounts is returned when there should be at least one.");

                Console.WriteLine("After Test05RestrictedUsersListSearchByMostRecentPage");
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION");
                Console.WriteLine(ex.Message);
            }
        }
        public void Test04RestrictedUserListPageSearchByBeginsWithLetterTest()
        {
            try
            {
                DnaTestURLRequest dnaRequest = new DnaTestURLRequest("h2g2");
                Console.WriteLine("Before Test04RestrictedUserListPageSearchByBeginsWithLetterTest");
                dnaRequest.SetCurrentUserEditor();
                dnaRequest.UseEditorAuthentication = true;
                string relativePath = @"/dna/h2g2/RestrictedUsers";
                dnaRequest.RequestNUnitASPPage(relativePath, Browser);

                System.Threading.Thread.Sleep(2000);

                DropDownListTester siteList = new DropDownListTester("SiteList");
                Assert.AreEqual(siteList.Visible, true);
                siteList.Items.FindByText("All").Selected = true;

                DropDownListTester userStatusTypes = new DropDownListTester("UserStatusTypes");
                Assert.AreEqual(userStatusTypes.Visible, true);
                userStatusTypes.Items.FindByText("Both").Selected = true;

                Console.WriteLine("Before Button creation");
                ButtonTester btnD = new ButtonTester("btnD", CurrentWebForm);
                Console.WriteLine("Before Button click");
                btnD.Click();

                System.Threading.Thread.Sleep(2000);

                Console.WriteLine("Before get table");

                HtmlTableTester table = new HtmlTableTester("tblResults");

                bool isdata = true;
                if (table.BodyNoTags != "No data for those details")
                {
                    isdata = false;
                }

                Console.WriteLine("After get table");

                Assert.IsTrue(isdata, "No data for All accounts is returned when there should be at least one.");

                Console.WriteLine("After Test04RestrictedUserListPageSearchByBeginsWithLetterTest");
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION");
                Console.WriteLine(ex.Message);
            }
        }