Exemple #1
0
        public void AddNewTask_WithSubTasks_MustCreateXSubTasks(int subTasksToCreate)
        {
            //Arrange
            string title               = "Title";
            string content             = $"This task contains {subTasksToCreate} subtasks";
            int    initialNumberOfTask = TasksPage.GetCurrentNumberOfTasks();
            int    taskIndex           = initialNumberOfTask;

            TasksPage.GoToNewTaskPage();

            //Act
            for (int i = 1; i <= subTasksToCreate; i++)
            {
                NewTaskPage.ShowAddSubTaskDialog();
                TaskMenuOptionsDialog.AddSubTask(true, $"This is subtask number = {i}");
            }
            NewTaskPage.AddEditNewTask(title, content);

            //Assert
            int finalNumberOfTasks = TasksPage.GetCurrentNumberOfTasks();

            Assert.True(initialNumberOfTask + 1 == finalNumberOfTasks);
            Assert.DoesNotThrow(() => TasksPage.ShowSubTasks(taskIndex));
            int numberOfSubTasks = TasksPage.GetNumberOfSubTasks(taskIndex);

            Assert.True(numberOfSubTasks == subTasksToCreate);
            Assert.AreEqual(title, TasksPage.GetTaskTitle(taskIndex));
            Assert.AreEqual(content, TasksPage.GetTaskContent(taskIndex));
        }
Exemple #2
0
        public void EditTask_ExistingTask_TaskIsTotallyEdited()
        {
            //Arrange
            string newTitle            = "Edited title";
            string newContent          = "This task is edited";
            string subTaskTitle        = "This is subtask of an edited task";
            int    initialNumberOfTask = TasksPage.GetCurrentNumberOfTasks();
            int    taskIndex           = initialNumberOfTask - 1;

            TasksPage.GoToNewTaskPage(taskIndex);

            //Act
            //Here we basically edit everything
            NewTaskPage.ShowAddEditCompletitionDate()
            .AddCompletitionDate(true)
            .ShowAddReminderDialog();
            TaskMenuOptionsDialog.AddAReminder(true);
            NewTaskPage.ShowAddSubTaskDialog();
            TaskMenuOptionsDialog.AddSubTask(true, subTaskTitle);
            NewTaskPage.AddEditNewTask(newTitle, newContent);

            //Assert
            int finalNumberOfTasks = TasksPage.GetCurrentNumberOfTasks();

            Assert.AreEqual(initialNumberOfTask, finalNumberOfTasks);
            Assert.AreEqual(newTitle, TasksPage.GetTaskTitle(taskIndex));
            Assert.AreEqual(newContent, TasksPage.GetTaskContent(taskIndex));
            Assert.True(TasksPage.HasACompletitionDateSet(taskIndex));
            Assert.True(TasksPage.HasAReminderDateSet(taskIndex));
            TasksPage.ShowSubTasks(taskIndex);
            Assert.True(TasksPage.HasSubTasks(taskIndex));
        }