Exemplo n.º 1
0
        public void TestTabs()
        {
            Browser.ImplicitWait = 10;
            var name = "Tab " + new Random().Next(int.MaxValue);

            // Create a tab.
            Browser.MouseOver(_c, "sidebar.fdict.self")
                .Click(_c, "sidebar.fdict.tabs")
                .Click(Common, "create-button")
                .FillForm(_c, "tab-name", name)
                .Click(Common, "save-button");

            Assert.AreEqual("Tab Created Successfully",
                Browser.FindElement(Common, "flash-message").Text);

            // Open new browser in client page and see if tab is there.
            _client = Pegasus.LoginCom("seloffice");
            _client.Click(Common, "sidebar.clients")
                .Click(_c, "first-client");

            Assert.IsTrue(_client.ElementsVisible(_c.Get("tab-name", name)));

            // Edit a tab.
            var newName = name + " Edited";
            Browser.Click(_c.Get("edit-tab", name))
                .FillFormReplace(_c, "edit-tab-name", newName);
            Browser.FindElements(Common, "save-button")[1].Click();
            Thread.Sleep(1000);
            Assert.AreEqual("Tab Updated Successfully",
                Browser.FindElement(Common, "flash-message").Text);

            // Refresh client and see if change is made.
            _client.Refresh();
            Assert.IsTrue(_client.ElementsVisible(_c.Get("tab-name", newName)));

            // Delete tab.
            Browser.Click(_c.Get("delete-tab", newName))
                .AlertAccept();
            Thread.Sleep(1000);
            Assert.AreEqual("Tab Deleted Sucessfully.",
                Browser.FindElement(Common, "flash-message").Text);

            // Refresh client and verify tab is gone.
            _client.Refresh();
            Assert.IsFalse(_client.ElementsVisible(_c.Get("tab-name", newName)));
        }
Exemplo n.º 2
0
        public void TestSections()
        {
            Browser.MouseOver(_c, "sidebar.fdict.self")
                .Click(_c, "sidebar.fdict.sections");

            // Create a new section.
            var name = "Section " + new Random().Next(int.MaxValue);
            Browser.Click(Common, "create-button")
                .FillForm(_c, "section-name", name);
            Thread.Sleep(1000);
            Browser.Click(Common, "save-button");
            Thread.Sleep(2000);
            Assert.AreEqual("Section Created Successfully", Browser.AlertText);
            Browser.AlertAccept();

            // Check if section appears for client.
            _client = Pegasus.LoginCom("seloffice");
            _client.Click(Common, "sidebar.clients")
                .Click(_c, "first-client");
            Assert.IsTrue(_client.TextExists(name));

            // Edit a section.
            var newName = name + " Edited";
            Browser.Click(_c.Get("edit-section", name))
                .FillFormReplace(_c, "edit-section-name", newName);
            Browser.FindElements(Common, "save-button")[1].Click();
            Thread.Sleep(2000);
            Browser.AlertAccept();
            Assert.IsTrue(Browser.TextExists(newName));

            // Test if change is reflected on client.
            _client.Refresh();
            Assert.IsTrue(_client.TextExists(newName));

            // Delete a section.
            Browser.Click(_c.Get("delete-section", newName))
                .AlertAccept();
            Thread.Sleep(1000);
            Assert.AreEqual("Section Deleted Sucessfully.",
                Browser.FindElement(Common, "flash-message").Text);

            _client.Refresh();
            Assert.IsFalse(_client.TextExists(newName));
        }