Esempio n. 1
0
        public void Test_EditEvent_ValidData()
        {
            // Create an event for editing
            string eventName = "Best Show" + DateTime.Now.Ticks;

            this.CreateEvent(eventName);

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

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

            // Get the row with the new event
            var eventRowText = allEventsPage.GetEventRow(eventName);

            Assert.That(eventRowText.Contains(eventName));

            // Click on the "Edit" button of the new event
            allEventsPage.PressEventEditButton(eventName);

            // Assert the user is redirected to the "Edit Event" page
            var editPage = new EditPage(driver);

            Assert.IsTrue(editPage.IsOpen(baseUrl));
            Assert.AreEqual("Edit Event - Eventures App", editPage.GetPageTitle());
            Assert.AreEqual("Edit Event", editPage.GetPageHeadingText());
            Assert.IsTrue(editPage.Contains(eventName));

            // Change the name of the event
            var changedName = "Best Best Show" + DateTime.Now.Ticks;

            editPage.EditEventName(changedName);

            // Assert the user is redirected to the "All Events" page
            Assert.IsTrue(allEventsPage.IsOpen(baseUrl));

            // Assert that the page contains the new event name and not the old one
            Assert.IsTrue(allEventsPage.Contains(changedName));
            Assert.IsFalse(allEventsPage.Contains(eventName));
        }
Esempio n. 2
0
        public void Test_EditEvent_InvalidData()
        {
            // Create an event for editing
            string eventName = "Best Show" + DateTime.Now.Ticks;

            this.CreateEvent(eventName);

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

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

            // Get the row with the new event
            var eventRowText = allEventsPage.GetEventRow(eventName);

            Assert.That(eventRowText.Contains("Edit"));

            // Click on the "Edit" button of the new event
            allEventsPage.PressEventEditButton(eventName);

            // Assert the user is redirected to the "Edit Event" page
            var editPage = new EditPage(driver);

            Assert.IsTrue(editPage.IsOpen(baseUrl));
            Assert.AreEqual("Edit Event - Eventures App", editPage.GetPageTitle());
            Assert.AreEqual("Edit Event", editPage.GetPageHeadingText());
            Assert.IsTrue(editPage.Contains(eventName));

            // Change the name of the event with an invalid one
            var invalidName = string.Empty;

            editPage.EditEventName(invalidName);

            // Assert the user is on the same page
            Assert.IsTrue(editPage.IsOpen(baseUrl));

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