public void SetUp()
 {
     mainPage  = new MainPage(WebDriver);
     loginPage = new LoginPage(WebDriver);
     mailIncomingMessagesPage = new MailPage(WebDriver);
 }
示例#2
0
        protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
        {
            var autoreplyDaysInterval = Convert.ToInt32(ConfigurationManagerExtension.AppSettings["mail.autoreply-days-interval"] ?? "1");

            return(new List <KeyValuePair <string, object> >(6)
            {
                RegisterResourceSet("MailResource", MailResource.ResourceManager),
                RegisterResourceSet("MailScriptResource", MailScriptResource.ResourceManager),
                RegisterResourceSet("MailAttachmentsResource", MailAttachmentsResource.ResourceManager),
                RegisterResourceSet("MailActionCompleteResource", MailActionCompleteResource.ResourceManager),
                RegisterResourceSet("MailAdministrationResource", MailAdministrationResource.ResourceManager),
                RegisterResourceSet("MailApiErrorsResource", MailApiErrorsResource.ResourceManager),
                RegisterResourceSet("MailApiResource", MailApiResource.ResourceManager),
                RegisterObject(new
                {
                    ErrorOpenMessageHelp = string.Format(MailScriptResource.ErrorOpenMessageHelp.HtmlEncode(), "<a href=\"" + MailPage.GetMailSupportUri() + "\" target=\"_blank\">", "</a>"),
                    ErrorParseMessageHelp = string.Format(MailScriptResource.ErrorParseMessageHelp.HtmlEncode(), "<a href=\"" + MailPage.GetMailSupportUri() + "\" target=\"_blank\">", "</a>"),
                    FilesCannotBeAttachedAsLinks = string.Format(MailResource.FilesCannotBeAttachedAsLinks_Body, "<br/>"),
                    Autoreply = string.Format(MailResource.AutoreplyInformationText, string.Format(GrammaticalHelper.ChooseNumeralCase(autoreplyDaysInterval, Resource.DrnAgoDaysI, Resource.DrnAgoDaysR1, Resource.DrnAgoDaysRm), autoreplyDaysInterval)),
                    Resource.ErrorPasswordMessage,
                    Resource.ErrorPasswordLength,
                    Resource.ErrorPasswordNoDigits,
                    Resource.ErrorPasswordNoUpperCase,
                    Resource.ErrorPasswordNoSpecialSymbols,
                    Resource.CopyEmailAndPassword,
                    Resource.EmailAndPasswordCopiedToClipboard,
                    Resource.ChangePasswordSuccess,
                    Resource.ErrorPasswordOnlyLatinLetters,
                    Resource.ErrorPasswordNoSpaces
                })
            });
        }
 protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
 {
     return(new List <KeyValuePair <string, object> >(1)
     {
         RegisterObject(new
         {
             file_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_21.png"),
             file_archive_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_archive_21.png"),
             file_avi_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_avi_21.png"),
             file_cal_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_cal_21.png"),
             file_csv_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_csv_21.png"),
             file_djvu_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_djvu_21.png"),
             file_doc_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_doc_21.png"),
             file_doct_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_doct_21.png"),
             file_docx_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_docx_21.png"),
             file_dvd_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_dvd_21.png"),
             file_ebook_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_ebook_21.png"),
             file_flv_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_flv_21.png"),
             file_gdoc_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_gdoc_21.png"),
             file_gsheet_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_gsheet_21.png"),
             file_gslides_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_gslides_21.png"),
             file_html_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_html_21.png"),
             file_iaf_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_iaf_21.png"),
             file_image_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_image_21.png"),
             file_m2ts_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_m2ts_21.png"),
             file_mkv_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_mkv_21.png"),
             file_mov_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_mov_21.png"),
             file_mp4_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_mp4_21.png"),
             file_mpg_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_mpg_21.png"),
             file_odp_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_odp_21.png"),
             file_ods_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_ods_21.png"),
             file_odt_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_odt_21.png"),
             file_pdf_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_pdf_21.png"),
             file_pps_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_pps_21.png"),
             file_ppsx_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_ppsx_21.png"),
             file_ppt_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_ppt_21.png"),
             file_pptt_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_pptt_21.png"),
             file_pptx_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_pptx_21.png"),
             file_rtf_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_rtf_21.png"),
             file_sound_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_sound_21.png"),
             file_svg_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_svg_21.png"),
             file_txt_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_txt_21.png"),
             file_xls_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_xls_21.png"),
             file_xlst_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_xlst_21.png"),
             file_xlsx_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_xlsx_21.png"),
             file_xml_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_xml_21.png"),
             file_xps_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_xps_21.png"),
             file_docm_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_docm_21.png"),
             file_dot_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_dot_21.png"),
             file_dotm_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_dotm_21.png"),
             file_dotx_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_dotx_21.png"),
             file_pot_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_pot_21.png"),
             file_potm_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_potm_21.png"),
             file_potx_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_potx_21.png"),
             file_ppsm_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_ppsm_21.png"),
             file_pptm_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_pptm_21.png"),
             file_soundunk_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_soundunk_21.png"),
             file_video_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_video_21.png"),
             file_videounk_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_videounk_21.png"),
             file_xlsm_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_xlsm_21.png"),
             file_xlt_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_xlt_21.png"),
             file_xltm_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_xltm_21.png"),
             file_xltx_21 = CommonLinkUtility.GetFullAbsolutePath("~/usercontrols/common/ckeditor/plugins/filetype/images/file_xltx_21.png"),
             IsTurnOnAttachmentsGroupOperations = Convert.ToBoolean(WebConfigurationManager.AppSettings["mail.attachments-group-operations"] ?? "false"),
             IsTurnOnOAuth = MailPage.IsTurnOnOAuth(),
             OAuthLocation = VirtualPathUtility.ToAbsolute(OAuth.Location),
             userDisplayFormat = (int)UserFormatter.GetUserDisplayDefaultOrder()
         })
     });
 }
 public void CheckSendButtonHoverClass()
 {
     Console.Write("Checking class of send button on hover.. ");
     MailPage.ClickComposeLink();
     EditorMailPage.HoverSendButtonAndCheckClassName(ExpectedClassName);
 }
示例#5
0
    /// <summary>
    /// Every application in Starcounter works like a console application. They have an .EXE ending. They have a Main() function and
    /// they can do console output. However, they are run inside the scope of a database rather than connecting to it.
    /// </summary>
    static void Main()
    {
        Handle.POST("/init-demo-data", () => {      // The Handle class is where you register new handlers for incomming requests.
            DemoData.Create();                      // Will create some demo data.
            return(201);                            // Returning an integer is the shortcut for returning a response with a status code.
        });

        Handle.GET("/", () => {                     // The root page of our little PMail website.
            var m     = Master.GET("/master");      // Create the view model for the main application frame.
            MailApp p = new MailApp();              // The email application also consists of a view model.
            p.Html    = "/mailboxes.html";          // Starcounter is a generic server and does not know of Html, so this is a variable we create in Page.json
            p.AddSomeNiceMenuItems(m);              // Adds some menu items in the main menu (by modifying the master view model)
            m.ApplicationPage = p;                  // Place the email applications view model inside the main application frame as its subpage.
            return(p);                              // Returns the home page. As you can see in Page.json, we taught it how to serve both HTML and the JSON view model without any extra work.
        });

        Handle.GET("/master", () => {
            Master m = new Master()                 // This is the root view model for our application. A view model is a JSON object/tree.
            {
                Html = "/master.html",              // This is just a field we added to allow the client to know what Html to load. No magic.
            };
            // m.Location[ MimeType.Application_Json ] = Server.Store(m, 10000);
            Session.Data = m;                       // Save the JSON on the server to be accessed using GET/PATCH to allow it to be used as a view model in web components.
            return(m);                              // Return the JSON or the HTML depending on the type asked for. See Page.json on how Starcounter knowns what to return.
        });

        Handle.GET("/mailboxes/{?}", (string name) => {
            MailApp p             = MailApp.GET("/");                                                     // If this is a first time call (like if the URL came from a bookmark), this call will call into the "/" handler above. If this is a super-fast SPA call (i.e. the user is navigating from within the application, this call does nothing else than to return the already existing view model. This means that the server does nothing and the client does nothing. The stuff is already created at both ends.
            p.FocusedMailbox.Data = Db.SQL <Mailbox>("SELECT m FROM Mailbox m WHERE Name=?", name).First; // By setting the Data property on a JSON object, we bind its properties to the properties of the database object.
            return(p);                                                                                    // Return the JSON, or the JSON-Patch or the Html depending on what the client asks for.
        });

        Handle.GET("/mailboxes/{?}/threads/{?}", (string name, string id) => {
            var thread = Db.SQL <Thread>("SELECT t FROM Thread t WHERE Id=?", id).First; // The database object representing a set of emails (a discussion)
            var page   = new ThreadPage()                                                // The viewmodel/html for the email thread
            {
                Html = "/thread.html",
                Data = thread                            // Connect the database object to the view model
            };
            var box = MailApp.GET("/mailboxes/" + name); // Let's get the parent page...
            box.FocusedMailbox.FocusedThread = page;     // ...and place the thread page inside it
            return(page);
        });

        Handle.GET("/compose-mail", () => {
            var p = Master.GET("/master");
            var m = new MailPage()
            {
                Html = "/email-compose.html"
            };
            m.Transaction = new Transaction();
            m.Transaction.Add(() => { m.Data = new Mail(); });
            p.ApplicationPage = m;
            return(m);
        });

        Handle.GET("/contacts", () => {
            Master m = Master.GET("/master");
            var p    = new ContactApp()
            {
                Html = "/contacts.html"
            };
            p.AddSomeNiceMenuItems(m);
            p.Contacts        = Db.SQL("SELECT c FROM Contact c");
            m.ApplicationPage = p;
            return(p);
        });

        Handle.GET("/contacts/{?}", (string id) => {
            var contact = Db.SQL <Contact>("SELECT c FROM Contact c WHERE Id=?", id).First;
            var p       = ContactApp.GET("/contacts");
            var page    = new ContactPage()
            {
                Html         = "/contact.html",
                Data         = contact,
                Addresses    = contact.Addresses,
                PhoneNumbers = contact.PhoneNumbers
            };
            page.Transaction = new Transaction();
            p.FocusedContact = page;
            return(p);
        });

        Handle.GET("/contacts/create", () => {
            var p    = ContactApp.GET("/contacts");
            var page = new ContactPage()
            {
                Html = "/contact.html"
            };
            page.Transaction = new Transaction();
            page.Transaction.Add(() => { page.Data = new Contact(); });
            p.FocusedContact = page;
            return(page);
        });
    }