public void InsignificantRniWithClarificationRequestedToAcknowledged()
        {
            string RNITitle = "AutoTestRNI-" + DataGen.String(5);
            var InboxPage = new Inbox();
            var ActionsNav = new ActivitiesNav();
            var RNISmartformPage = new RNISmartform();
            var StudyWorkspacePage = new IRBWorkspace();
            var IRBSubmissionsPage = new IRBSubmissions();

            Store.LoginAsUser(Users.Irbc);

            InboxPage.ImgCreateNewRNI.Click();
            // Fill in just required info
            RNISmartformPage.TxtRNIShortTitle.Value = RNITitle;
            RNISmartformPage.TxtDateAware.Value = "03/02/2014";
            RNISmartformPage.TxtDescriptionOfProblem.Value = "This is a RNI test for " + RNITitle;
            RNISmartformPage.RdoIsIncreasedRiskNo.Click();
            RNISmartformPage.RdoNeedRevisionNo.Click();
            RNISmartformPage.RdoConsentRequiresRevisionkNo.Click();
            RNISmartformPage.BtnContinue.Click();
            RNISmartformPage.BtnFinish.Click();

            // verify in history tab, pre-submission
            Wait.Until(h => new Link(By.LinkText("Reportable Information Opened")).Exists);
            Assert.IsTrue(new Link(By.LinkText("Reportable Information Opened")).Exists, "'Reportable Information Opened' activity not found for:  " + RNITitle);

            // Grab the ID of the study, switch to submit RNI popup (move this functionality to page)
            string id = StudyWorkspacePage.GetStudyID();
            var SubmitRNIPopup = new ActivityPopup(id, "Submit RNI");

            // Submit the RNI
            ActionsNav.LnkSubmitRNI.Click();
            SubmitRNIPopup.SwitchTo();
            SubmitRNIPopup.BtnOk.Click();
            // change this to "confirm credentials page"
            SubmitRNIPopup.ConfirmCredentials(Users.Irbc.UserName, Users.Irbc.Password);

            // Switch back to main page
            PopUpWindow.SwitchTo(RNITitle);
            Wait.Until(h => new Link(By.LinkText("RNI Submitted")).Exists);

            ActionsNav.LnkAssignCoordinator.Click();
            var AssignCoordinatorPopup = new AssignCoordinator(id, "Assign Coordinator");
            AssignCoordinatorPopup.SwitchTo();
            AssignCoordinatorPopup.FirstUser.Click();
            AssignCoordinatorPopup.BtnOk.Click();
            AssignCoordinatorPopup.SwitchBackToParent();

            // Log in as IRBD
            Store.LoginAsUser(Users.Irbd);

            IRBSubmissionsPage.AllSubmissionsTab.NavigateTo();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.LnkAdvanced.Click();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.SetCriteria("Name",RNITitle);
            IRBSubmissionsPage.OpenSubmission(RNITitle);

            ActionsNav.LnkRequestPreReviewClarification.Click();
            var RequestPreReviewPopup = new RequestPreReviewClarificationPopup(id, "Request Pre-Review Clarification");
            RequestPreReviewPopup.SwitchTo();
            RequestPreReviewPopup.TxtInfo.Value = "Addition information required regarding RNI";
            RequestPreReviewPopup.BtnOk.Click();
            RequestPreReviewPopup.SwitchBackToParent();

            Wait.Until(h => new Link(By.LinkText("Clarification Requested")).Exists);
            Assert.IsTrue(new Link(By.LinkText("Clarification Requested")).Exists, "'Clarification Requested' activity not found for:  " + RNITitle);
            Assert.IsTrue(StudyWorkspacePage.GetStudyState() == "Clarification Requested (Pre-Review)");

            // Log in as IRBC
            Store.LoginAsUser(Users.Irbc);
            //InboxPage.OpenStudy(RNITitle);
            IRBSubmissionsPage.AllSubmissionsTab.NavigateTo();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.LnkAdvanced.Click();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.SetCriteria("Name", RNITitle);
            IRBSubmissionsPage.OpenSubmission(RNITitle);

            ActionsNav.LnkSubmitResponse.Click();
            var SubmitResponsePage = new SubmitResponsePopup(id, "Submit Response");
            SubmitResponsePage.SwitchTo();
            SubmitResponsePage.TxtInfo.Value = "I cleared this up with batman.  We are good.";
            SubmitResponsePage.BtnOk.Click();
            SubmitResponsePage.ConfirmCredentials(Users.Irbc.UserName, Users.Irbc.Password);

            PopUpWindow.SwitchTo(RNITitle, true);
            Wait.Until(h => new Link(By.LinkText("Response Submitted")).Exists);
            Assert.IsTrue(new Link(By.LinkText("Response Submitted")).Exists, "'Response Submitted' activity not found for:  " + RNITitle);
            Assert.IsTrue(StudyWorkspacePage.GetStudyState() == "Pre-Review");

            // Log in as IRBD
            Store.LoginAsUser(Users.Irbd);
            IRBSubmissionsPage.AllSubmissionsTab.NavigateTo();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.LnkAdvanced.Click();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.SetCriteria("Name", RNITitle);
            IRBSubmissionsPage.OpenSubmission(RNITitle);

            ActionsNav.LnkSubmitRNIPreReview.Click();
            var SubmitRNIPreReviewPopup = new SubmitRNIPreReview(id, "Submit RNI Pre-Review");
            SubmitRNIPreReviewPopup.SwitchTo();
            SubmitRNIPreReviewPopup.SelectDetermination(SubmitRNIPreReview.Determinations.NoneOfTheAbove);
            SubmitRNIPreReviewPopup.rdoSubmitPreviewYes.Click();
            SubmitRNIPreReviewPopup.BtnOk.Click();
            SubmitRNIPreReviewPopup.SwitchBackToParent();

            Wait.Until(h => new Link(By.LinkText("RNI Pre-Review Submitted")).Exists);
            Assert.IsTrue(new Link(By.LinkText("RNI Pre-Review Submitted")).Exists, "'RNI Pre-Review Submitted' activity not found for:  " + RNITitle);
            Assert.IsTrue(StudyWorkspacePage.GetStudyState() == "Acknowledged");
        }
        public void InsignificantRNIThroughAssignToMeetingThenWithdrawn()
        {
            // This test requires a meeting agenda created within next 60 days of current date
            string RNITitle = "AutoTestRNI-" + DataGen.String(5);
            var InboxPage = new Inbox();
            var ActivitiesNavPage = new ActivitiesNav();
            var RNISmartformPage = new RNISmartform();
            var StudyWorkspacePage = new IRBWorkspace();
            var IRBSubmissionsPage = new IRBSubmissions();

            Store.LoginAsUser(Users.Pi);
            InboxPage.ImgCreateNewRNI.Click();
            // Fill in just required info
            RNISmartformPage.TxtRNIShortTitle.Value = RNITitle;
            RNISmartformPage.TxtDateAware.Value = "03/02/2014";
            RNISmartformPage.TxtDescriptionOfProblem.Value = "This is a RNI test for " + RNITitle;
            RNISmartformPage.RdoIsIncreasedRiskNo.Click();
            RNISmartformPage.RdoNeedRevisionNo.Click();
            RNISmartformPage.RdoConsentRequiresRevisionkNo.Click();
            RNISmartformPage.BtnContinue.Click();
            RNISmartformPage.BtnFinish.Click();

            // verify in history tab, pre-submission
            Wait.Until(h => new Link(By.LinkText("Reportable Information Opened")).Exists);
            Assert.IsTrue(new Link(By.LinkText("Reportable Information Opened")).Exists, "'Reportable Information Opened' activity not found for:  " + RNITitle);
            Assert.IsTrue(StudyWorkspacePage.GetStudyState() == "Pre-Submission", "State expected not in 'Pre-Submission'.  State currently: " + StudyWorkspacePage.GetStudyState());

            // Grab the ID of the study, switch to submit RNI popup (move this functionality to page)
            string id = StudyWorkspacePage.GetStudyID();
            var SubmitRNIPopup = new ActivityPopup(id, "Submit RNI");

            // Submit the RNI
            ActivitiesNavPage.LnkSubmitRNI.Click();
            SubmitRNIPopup.SwitchTo();
            SubmitRNIPopup.BtnOk.Click();
            // change this to "confirm credentials page"
            SubmitRNIPopup.ConfirmCredentials(Users.Pi.UserName, Users.Pi.Password);
            SubmitRNIPopup.SwitchBackToParent();
            Wait.Until(h => new Link(By.LinkText("RNI Submitted")).Exists);

            // Log in as IRBC
            Store.LoginAsUser(Users.Irbc);
            IRBSubmissionsPage.AllSubmissionsTab.NavigateTo();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.LnkAdvanced.Click();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.SetCriteria("Name", RNITitle);
            IRBSubmissionsPage.OpenSubmission(RNITitle);

            // Assign coordinator as IRBC
            ActivitiesNavPage.LnkAssignCoordinator.Click();
            var AssignCoordinatorPopup = new AssignCoordinator(id, "Assign Coordinator");
            AssignCoordinatorPopup.SwitchTo();
            AssignCoordinatorPopup.FirstUser.Click();
            AssignCoordinatorPopup.BtnOk.Click();
            AssignCoordinatorPopup.SwitchBackToParent();

            // Submit RNI-Preview as IRBC
            ActivitiesNavPage.LnkSubmitRNIPreReview.Click();
            var SubmitRNIPreReviewPopup = new SubmitRNIPreReview(id, "Submit RNI Pre-Review");
            SubmitRNIPreReviewPopup.SwitchTo();
            SubmitRNIPreReviewPopup.SelectDetermination(SubmitRNIPreReview.Determinations.NoneOfTheAbove);
            SubmitRNIPreReviewPopup.SelectDetermination(SubmitRNIPreReview.Determinations.AdditionalReviewRequired);
            SubmitRNIPreReviewPopup.rdoSubmitPreviewYes.Click();
            SubmitRNIPreReviewPopup.BtnOk.Click();
            SubmitRNIPreReviewPopup.SwitchBackToParent();

            Wait.Until(h => new Link(By.LinkText("RNI Pre-Review Submitted")).Exists);
            Assert.IsTrue(new Link(By.LinkText("RNI Pre-Review Submitted")).Exists, "'RNI Pre-Review Submitted' activity not found for:  " + RNITitle);
            Assert.IsTrue(StudyWorkspacePage.GetStudyState() == "Pre-Review Completed");

            PopUpWindow.SwitchTo(RNITitle);
            // Assign to Meeting as IRBC
            ActivitiesNavPage.LnkAssignToMeeting.Click();

            var assignToMeetingPage = new AssignToMeetingPopup(id, "Assign to Meeting");
            assignToMeetingPage.SwitchTo();
            assignToMeetingPage.RdoFirstMeeting.Click();
            assignToMeetingPage.BtnOk.Click();
            assignToMeetingPage.SwitchBackToParent();

            Wait.Until(h => new Link(By.PartialLinkText("Assigned to Meeting:")).Exists);
            Assert.IsTrue(new Link(By.PartialLinkText("Assigned to Meeting:")).Exists, "'Assigned to Meeting' activity not found for:  " + RNITitle);
            Assert.IsTrue(StudyWorkspacePage.GetStudyState() == "Committee Review");

            // Withdraw as PI
            Store.LoginAsUser(Users.Pi);
            IRBSubmissionsPage.AllSubmissionsTab.NavigateTo();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.LnkAdvanced.Click();
            IRBSubmissionsPage.AllSubmissionsTab.ProjectsComponent.SetCriteria("Name", RNITitle);
            IRBSubmissionsPage.OpenSubmission(RNITitle);

            ActivitiesNavPage.LnkWithdraw.Click();
            var WithDrawPage = new WithdrawPopup(id, "Withdraw");
            WithDrawPage.SwitchTo();
            WithDrawPage.BtnOk.Click();
            WithDrawPage.SwitchBackToParent();

            Wait.Until(h => new Link(By.LinkText("Withdrawn")).Exists);
            Assert.IsTrue(new Link(By.LinkText("Withdrawn")).Exists, "'Withdrawn' activity not found for:  " + RNITitle);
            Assert.IsTrue(StudyWorkspacePage.GetStudyState() == "Pre-Submission");
        }