Пример #1
0
        public void Test_CreateEventPage_CreateEvent_ValidData()
        {
            // Arrange: open the "Create Event" page
            var createEventPage = new CreateEventPage(driver);

            createEventPage.Open(baseUrl);

            // act: create a new event
            var eventName  = "Party" + DateTime.Now.Ticks;
            var eventPlace = "Beach";

            createEventPage.CreateEvent(eventName, eventPlace, "100", "10.00");

            // Assert user is redirected to the "All Events" page
            var allEventsPage = new AllEventsPage(driver);

            Assert.IsTrue(allEventsPage.IsOpen(baseUrl));

            // Assert the new event appears
            var eventRowText = allEventsPage.GetEventRow(eventName);

            Assert.That(eventRowText.Contains(eventName));
            Assert.That(eventRowText.Contains(eventPlace));
            Assert.That(eventRowText.Contains(username));
            Assert.That(eventRowText.Contains("Delete"));
            Assert.That(eventRowText.Contains("Edit"));
        }
Пример #2
0
        private void CreateEvent(string eventName)
        {
            // Create a new event through the "Create Event" page
            var createPage = new CreateEventPage(driver);

            createPage.Open(baseUrl);
            createPage.CreateEvent(eventName, "Beach", "100", "10");
        }
Пример #3
0
        public void Test_CreateEventPage_CreateEvent_InvalidData()
        {
            // Arrange: go to the "Create Event" page
            var createEventPage = new CreateEventPage(driver);

            createEventPage.Open(baseUrl);

            // Create an event with an invalid name
            var invalidEventName = string.Empty;
            var eventPlace       = "Beach";

            createEventPage.CreateEvent(invalidEventName, eventPlace, "100", "10.00");

            // Assert the user stays on the same page
            Assert.IsTrue(createEventPage.IsOpen(baseUrl));

            // Assert that an error message appears on the page
            Assert.AreEqual("The Name field is required.", createEventPage.GetNameError());
        }