/// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the ContactService.
      ContactService contactService =
          (ContactService) user.GetService(DfpService.v201511.ContactService);

      // Create a statement to get all contacts.
      StatementBuilder statementBuilder = new StatementBuilder()
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

      // Set default for page.
      ContactPage page = new ContactPage();

      try {
        do {
          // Get contacts by statement.
          page = contactService.getContactsByStatement(statementBuilder.ToStatement());

          if (page.results != null) {
            int i = page.startIndex;
            foreach (Contact contact in page.results) {
              Console.WriteLine("{0}) Contact with ID \"{1}\" and name \"{2}\" was found.",
                  i, contact.id, contact.name);
              i++;
            }
          }
          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);

        Console.WriteLine("Number of results found: " + page.totalResultSetSize);
      } catch (Exception e) {
        Console.WriteLine("Failed to get contacts. Exception says \"{0}\"", e.Message);
      }
    }
Esempio n. 2
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        public void Run(AdManagerUser user)
        {
            using (ContactService contactService = user.GetService <ContactService>())
            {
                // Set the ID of the contact to update.
                long contactId = long.Parse(_T("INSERT_CONTACT_ID_HERE"));

                try
                {
                    StatementBuilder statementBuilder = new StatementBuilder()
                                                        .Where("id = :id")
                                                        .OrderBy("id ASC")
                                                        .Limit(1)
                                                        .AddValue("id", contactId);

                    // Get the contact.
                    ContactPage page =
                        contactService.getContactsByStatement(statementBuilder.ToStatement());
                    Contact contact = page.results[0];

                    // Update the address of the contact.
                    contact.address = "123 New Street, New York, NY, 10011";

                    // Update the contact on the server.
                    Contact[] contacts = contactService.updateContacts(new Contact[]
                    {
                        contact
                    });

                    // Display results.
                    foreach (Contact updatedContact in contacts)
                    {
                        Console.WriteLine(
                            "Contact with ID \"{0}\", name \"{1}\", and comment \"{2}\" was " +
                            "updated.", updatedContact.id, updatedContact.name,
                            updatedContact.comment);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Failed to update contacts. Exception says \"{0}\"",
                                      e.Message);
                }
            }
        }
Esempio n. 3
0
        public void testMandatoryFieldErrorMessages()
        {
            HomePage    homePage    = new HomePage(driver);
            ContactPage contactPage = homePage.navigateContact();

            contactPage.clickSubmit();

            Assert.AreEqual("Forename is required", contactPage.getFirstNameError());
            Assert.AreEqual("Email is required", contactPage.getEmailError());
            Assert.AreEqual("Message is required", contactPage.getMessageError());

            contactPage.setFirstName("Testing");
            contactPage.setEmail("*****@*****.**");
            contactPage.setMessage("Welcome to testing!");

            Assert.AreEqual("", contactPage.getFirstNameError());
            Assert.AreEqual("", contactPage.getEmailError());
            Assert.AreEqual("", contactPage.getMessageError());
        }
Esempio n. 4
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public void Run(DfpUser user)
        {
            ContactService contactService =
                (ContactService)user.GetService(DfpService.v201605.ContactService);

            // Create a statement to select contacts.
            StatementBuilder statementBuilder = new StatementBuilder()
                                                .Where("status = :status")
                                                .OrderBy("id ASC")
                                                .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
                                                .AddValue("status", ContactStatus.UNINVITED.ToString());

            // Retrieve a small amount of contacts at a time, paging through
            // until all contacts have been retrieved.
            ContactPage page = new ContactPage();

            try {
                do
                {
                    page = contactService.getContactsByStatement(statementBuilder.ToStatement());

                    if (page.results != null)
                    {
                        // Print out some information for each contact.
                        int i = page.startIndex;
                        foreach (Contact contact in page.results)
                        {
                            Console.WriteLine("{0}) Contact with ID \"{1}\" and name \"{2}\" was found.",
                                              i++,
                                              contact.id,
                                              contact.name);
                        }
                    }

                    statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
                } while (statementBuilder.GetOffset() < page.totalResultSetSize);

                Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
            } catch (Exception e) {
                Console.WriteLine("Failed to get contacts. Exception says \"{0}\"",
                                  e.Message);
            }
        }
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public void Run(DfpUser dfpUser)
        {
            ContactService contactService =
                (ContactService)dfpUser.GetService(DfpService.v201611.ContactService);

            // Create a statement to select contacts.
            int pageSize = StatementBuilder.SUGGESTED_PAGE_LIMIT;
            StatementBuilder statementBuilder = new StatementBuilder()
                                                .Where("status = :status")
                                                .OrderBy("id ASC")
                                                .Limit(pageSize)
                                                .AddValue("status", ContactStatus.UNINVITED.ToString());

            // Retrieve a small amount of contacts at a time, paging through until all
            // contacts have been retrieved.
            int totalResultSetSize = 0;

            do
            {
                ContactPage page = contactService.getContactsByStatement(
                    statementBuilder.ToStatement());

                // Print out some information for each contact.
                if (page.results != null)
                {
                    totalResultSetSize = page.totalResultSetSize;
                    int i = page.startIndex;
                    foreach (Contact contact in page.results)
                    {
                        Console.WriteLine(
                            "{0}) Contact with ID {1} and name \"{2}\" was found.",
                            i++,
                            contact.id,
                            contact.name
                            );
                    }
                }

                statementBuilder.IncreaseOffsetBy(pageSize);
            } while (statementBuilder.GetOffset() < totalResultSetSize);

            Console.WriteLine("Number of results found: {0}", totalResultSetSize);
        }
        public ActionResult Operation(ContactPage inputs)
        {
            ViewBag.userName = User.Identity.Name;
            if (inputs.id == 0)
            {
                //Create Mode
                #region Create ContactPage
                ViewBag.msg = ContactPageTable.Create(inputs);
                #endregion
            }
            else
            {
                //Update Mode
                #region Update ContactPage
                ContactPageTable.Update(inputs);
                #endregion
            }

            return(Redirect("/Admin/ContactPage"));
        }
Esempio n. 7
0
        private void HoverMouse()
        {
            ContactPage contactPage = new ContactPage(driver);

            try
            {
                Actions action = new Actions(driver);
                foreach (IWebElement item in contactPage.TabElements)
                {
                    TakeScreenShot("Before action " + item.Text + ".jpg");
                    action.MoveToElement(item).Build().Perform();
                    TakeScreenShot("After action " + item.Text + ".jpg");
                }
            }
            catch (Exception ex)
            {
                log.ErrorFormat("error in HoverMouse: {0}", ex);
                throw ex;
            }
        }
 public void FillForm()
 {
     try {
         ContactPage contactPage = new ContactPage(driver);
         PageFactory.InitElements(driver, contactPage);
         string[] allLines = fileReaderObj.ReadFile();
         //Reading First Line
         string[] data = allLines[0].Split(",");
         string   email = data[0], ordRef = data[1], filePath = data[2];
         contactPage.FillForm(email, ordRef, filePath, "User : "******" , Order Ref : " + ordRef);
         string msgText = contactPage.GetMsgText();
         Assert.IsTrue(msgText.Contains("Your message has been successfully sent to our team."));
     }
     catch (Exception e) {
         //Taking Screenshot
         takeScreenShot.takeSnapShot();
         Console.WriteLine("Exception in Test");
         LogHelper.Write(e.Message);
         Assert.IsFalse(true);
     }
 }
Esempio n. 9
0
        public void NavigateToContact()
        {
            home.GoToPage();
            contact = home.GoToContactPage();
            IWebElement regionButton     = contact.FindRegion(region);
            string      classBeforeClick = regionButton.GetAttribute("class");

            regionButton.Click();
            Screenshot ss = ((ITakesScreenshot)_driver).GetScreenshot();

            ss.SaveAsFile(AppDomain.CurrentDomain + "\\" + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss_fff") + "Omada.png", ScreenshotImageFormat.Png);
            string classAfterClick = regionButton.GetAttribute("class");

            Assert.That(classAfterClick != classBeforeClick, "Region button class did not change after clicking!");
            IWebElement newRegionButton = contact.FindRegion("UK");
            Helpers     helper          = new Helpers();

            ss.SaveAsFile(AppDomain.CurrentDomain + "\\" + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss_fff") + "BeforeHoverOmada.png", ScreenshotImageFormat.Png);
            helper.Hover(_driver, newRegionButton);
            ss.SaveAsFile(AppDomain.CurrentDomain + "\\" + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss_fff") + "AfterHoverOmada.png", ScreenshotImageFormat.Png);
        }
Esempio n. 10
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the ContactService.
            ContactService contactService =
                (ContactService)user.GetService(DfpService.v201408.ContactService);

            // Create a statement to get all uninvited contacts.
            StatementBuilder statementBuilder = new StatementBuilder()
                                                .Where("status = :status")
                                                .OrderBy("id ASC")
                                                .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
                                                .AddValue("status", ContactStatus.UNINVITED.ToString());

            // Set default for page.
            ContactPage page = new ContactPage();

            try {
                do
                {
                    // Get contacts by statement.
                    page = contactService.getContactsByStatement(statementBuilder.ToStatement());

                    if (page.results != null)
                    {
                        int i = page.startIndex;
                        foreach (Contact contact in page.results)
                        {
                            Console.WriteLine("{0}) Contact with ID \"{1}\" and name \"{2}\" was found.",
                                              i, contact.id, contact.name);
                            i++;
                        }
                    }
                    statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
                } while (statementBuilder.GetOffset() < page.totalResultSetSize);

                Console.WriteLine("Number of results found: " + page.totalResultSetSize);
            } catch (Exception ex) {
                Console.WriteLine("Failed to get contacts. Exception says \"{0}\"", ex.Message);
            }
        }
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the ContactService.
            ContactService contactService =
                (ContactService)user.GetService(DfpService.v201311.ContactService);

            Statement filterStatement = new StatementBuilder("").AddValue(
                "status", ContactStatus.UNINVITED.ToString()).ToStatement();

            // Set defaults for page and filterStatement.
            ContactPage page   = new ContactPage();
            int         offset = 0;

            try {
                do
                {
                    // Create a statement to get all contacts.
                    filterStatement.query = "where status = :status LIMIT 500 OFFSET " + offset.ToString();

                    // Get contacts by statement.
                    page = contactService.getContactsByStatement(filterStatement);

                    if (page.results != null)
                    {
                        int i = page.startIndex;
                        foreach (Contact contact in page.results)
                        {
                            Console.WriteLine("{0}) Contact with ID \"{1}\" and name \"{2}\" was found.",
                                              i, contact.id, contact.name);
                            i++;
                        }
                    }
                    offset += 500;
                } while (offset < page.totalResultSetSize);

                Console.WriteLine("Number of results found: " + page.totalResultSetSize);
            } catch (Exception ex) {
                Console.WriteLine("Failed to get contacts. Exception says \"{0}\"", ex.Message);
            }
        }
Esempio n. 12
0
        public bool TestCaseExec()
        {
            try
            {
                MainPage mainPage = new MainPage(driver);
                mainPage.CompanyContact.Click();
                TakeScreenShot("Contact.jpg");

                ContactPage contactPage = new ContactPage(driver);
                contactPage.USWest.Click();
                string className = contactPage.USWest.GetAttribute("outerHTML");
                Assert.IsTrue(className.Contains("tabmenu__menu-item selected"));
                TakeScreenShot("Contact.jpg");

                HoverMouse();
                return(true);
            }
            catch (Exception ex)
            {
                log.ErrorFormat("error: {0}", ex);
                throw ex;
            }
        }
Esempio n. 13
0
        public void TestCase3()

        {
            try
            {
                var invalidEmail = "Email";
                var invalidPhone = "Phone";
                var homePage     = new HomePage(Driver);
                homePage.GoTo();
                ContactPage contactPage = homePage.GoToContactPage();
                //WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(5));
                //wait.Until(ExpectedConditions.ElementExists(By.CssSelector(".btn-contact.btn.btn-primary")));
                contactPage.EnterEmail(invalidEmail);
                contactPage.EnterTelephone(invalidPhone);

                Assert.AreEqual("Please enter a valid email", contactPage.GetEmailErrorMsg(), $"Displayed Email error message  is different and looks like : {contactPage.GetEmailErrorMsg()}");
                Assert.AreEqual("Please enter a valid telephone number", contactPage.GetTelephoneErrorMsg(), $"Displayed telephone error message  is different and looks like : {contactPage.GetTelephoneErrorMsg()}");
            }

            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Esempio n. 14
0
 public void ThenTheValidationErrorsShouldGoAway()
 {
     ContactPage.VerifyNoValidationErrors();
 }
Esempio n. 15
0
 public void ThenIShouldSeeValidationErrorForInvalidEmail()
 {
     ContactPage.VerifyValidationErrors("email");
 }
Esempio n. 16
0
 public void ThenIShouldSeeValidationErrors()
 {
     ContactPage.VerifyValidationErrors("all");
 }
Esempio n. 17
0
 public void WhenIPopulateMandtoryFieldsWithInvalidEmail()
 {
     ContactPage.EnterMandatoryFields("invalid");
 }
 public void StartUp()
 {
     driver      = new FirefoxDriver();
     homePage    = new HomePage(driver);
     contactPage = new ContactPage(driver);
 }
Esempio n. 19
0
 public ContactUsSteps(ContactPage contactPage, Context context)
 {
     _contactPage = contactPage;
     _context     = context;
 }
        public void VerifyCountofProductLinks()
        {
            ContactPage contactPage = new ContactPage();

            contactPage.VerifyCountofProductLinks("5");
        }
        public void NavigateToContactUsPage()
        {
            ContactPage contactPage = new ContactPage();

            contactPage.NavigateToContactUs();
        }
 public void WhenIAmOnContactusPage()
 {
     contPage = new ContactPage();
     contPage.goToContactpage();
 }
 public void WhenIGoToContactOmadaPageFromSoulutionIdentityPage()
 {
     _contactPage = _omadaIdentityPage.OpenContactOmada();
 }
 public void WhenIOpenContactOmadaPageFromMainPage()
 {
     _contactPage = _mainPage.ClickContactUsButton();
 }
Esempio n. 25
0
 public void UploadFile(string filePath)
 {
     Driver.FindElement(By.XPath(ContactPage.FilePathElement())).SendKeys(filePath);
     Thread.Sleep(5000);
     Driver.FindElement(By.XPath(ContactPage.UploadButtonElement())).Click();
 }
Esempio n. 26
0
 public void ThenIShouldSeeTheSuccessfulSubmissionMessage()
 {
     ContactPage.VerifySuccessMessage();
 }
 public ContactUsPageSteps()
 {
     contPage = new ContactPage();
 }
        public void VerifySearchProductFunctionality()
        {
            ContactPage contactPage = new ContactPage();

            contactPage.VerifySearchProduct("Test");
        }
Esempio n. 29
0
 public void WhenIClickSubmitButton()
 {
     ContactPage.ClickSubmit();
 }
Esempio n. 30
0
 public void WhenIPopulateMandtoryFieldsWithValidData()
 {
     ContactPage.EnterMandatoryFields("valid");
 }
 public void setUp()
 {
     firefox = new FirefoxDriver();
     firefox.Navigate().GoToUrl("http://sample.com/Home/Contact");
     page = new ContactPage(firefox);
 }
Esempio n. 32
0
 public void Go_To_Contact()
 {
     Page.HomePage.Contact_Page();
     ContactPage.form();
 }