示例#1
0
        [Test] public void TM_Config_TM_Security__Show_Content_Rules()
        {
            var texts_WithLoginForm = new [] { "Login required", "If you have a valid account", "if not, please sign up for an account to gain access" };
            var texts_LibraryView   = new [] { "Guidance Libraries", "Technology", "Phase", "Type" };

            //Mode 1: Anonymous users cannot see library and content (just a login form)
            tmConfig.TMSecurity.Show_ContentToAnonymousUsers = false;
            tmConfig.TMSecurity.Show_LibraryToAnonymousUsers = false;
            ieTeamMentor.page_Home();

            ie.html().assert_Contains(texts_WithLoginForm);
            ie.html().assert_Not_Contains(texts_LibraryView);

            //Mode 2: Anonymous users can see library but no content (still asked to login using Form)
            tmConfig.TMSecurity.Show_ContentToAnonymousUsers = false;
            tmConfig.TMSecurity.Show_LibraryToAnonymousUsers = true;
            ieTeamMentor.page_Home();
            ie.waitForField("ctl00_ContentPlaceHolder1_UsernameBox");       // wait for the right hand ajax page to load

            ie.html().assert_Contains(texts_WithLoginForm);
            ie.html().assert_Contains(texts_LibraryView);

            //Mode 3: Anonymous users can see library and content
            tmConfig.TMSecurity.Show_ContentToAnonymousUsers = true;
            tmConfig.TMSecurity.Show_LibraryToAnonymousUsers = true;
            ieTeamMentor.page_Home();

            ie.waitForField("ctl00_ContentPlaceHolder1_UsernameBox", 150, 10);      // will fail to find it

            ie.html().assert_Not_Contains(texts_WithLoginForm);
            ie.html().assert_Contains(texts_LibraryView);
        }
示例#2
0
        [Test] public void Issue_681__Navigating_libraries_views_folders__Clicking_the_icon_doesnt_work()
        {
            var tmWebServices = new TM_WebServices();

            Func <string, string> clickOnNodeUsingJQuerySelector =
                (jQuerySelector) =>
            {
                ie.invokeEval("TM.Gui.selectedGuidanceTitle=undefined");
                ie.invokeEval("$('#{0}').click()".format(jQuerySelector));
                ie.waitForJsVariable("TM.Gui.selectedGuidanceTitle");
                return(ie.getJsObject <string>("TM.Gui.selectedGuidanceTitle"));
            };

            if (tmProxy.libraries().notEmpty())
            {
                "Ensuring the the only library that is there is the TM Documentation".info();
                foreach (var library in tmProxy.libraries())
                {
                    if (library.Caption != "TM Documentation")
                    {
                        "deleting library: {0}".debug(library.Caption);
                        tmProxy.library_Delete(library.Caption);
                    }
                }
            }

            UserRole.Admin.assert();

            tmProxy.library_Install_Lib_Docs();
            tmProxy.cache_Reload__Data();
            tmProxy.show_ContentToAnonymousUsers(true);

            ieTeamMentor.page_Home();
            //tmWebServices.script_Me_WaitForClose();;
            //ieTeamMentor.script_IE_WaitForComplete();

            ie.waitForJsVariable("TM.Gui.selectedGuidanceTitle");

            var _jsTree   = tmWebServices.JsTreeWithFolders();
            var viewNodes = _jsTree.data[0].children;                           // hard coding to the first library
            var view1_Id  = viewNodes[0].attr.id;
            var view5_Id  = viewNodes[4].attr.id;


            var click_View_1_Using_A    = clickOnNodeUsingJQuerySelector(view1_Id + " a");
            var click_View_5_Using_A    = clickOnNodeUsingJQuerySelector(view5_Id + " a");
            var click_View_1_Using_Icon = clickOnNodeUsingJQuerySelector(view1_Id + " ins");
            var click_View_5_Using_Icon = clickOnNodeUsingJQuerySelector(view5_Id + " ins");


            (click_View_1_Using_A != click_View_5_Using_A).assert_True();

            (click_View_5_Using_A == click_View_1_Using_Icon).assert_False(); // (Issue 681) this was true since the view was not updating
            (click_View_5_Using_A == click_View_5_Using_Icon).assert_True();
        }