Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import com.instructure.canvas.espresso.common.pages.compose.SelectContextPage
import com.instructure.canvas.espresso.common.pages.compose.SettingsPage
import com.instructure.canvas.espresso.common.pages.compose.SmartSearchPage
import com.instructure.canvas.espresso.common.pages.compose.SmartSearchPreferencesPage
import com.instructure.canvas.espresso.common.pages.compose.ToDoFilterPage
import com.instructure.canvas.espresso.common.pages.compose.ToDoListPage
import com.instructure.espresso.ModuleItemInteractions
import com.instructure.student.R
Expand Down Expand Up @@ -65,11 +66,6 @@ abstract class StudentComposeTest : StudentTest() {
val assignmentListPage = AssignmentListPage(composeTestRule)
val inboxSignatureSettingsPage = InboxSignatureSettingsPage(composeTestRule)
val toDoListPage = ToDoListPage(composeTestRule)
val assignmentDetailsPage = StudentAssignmentDetailsPage(
ModuleItemInteractions(
R.id.moduleName,
R.id.next_item,
R.id.prev_item
), composeTestRule
)
val toDoFilterPage = ToDoFilterPage(composeTestRule)
val assignmentDetailsPage = StudentAssignmentDetailsPage(ModuleItemInteractions(R.id.moduleName, R.id.next_item, R.id.prev_item), composeTestRule)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import android.net.Uri
import android.os.Environment
import android.view.View
import androidx.core.content.FileProvider
import androidx.test.espresso.Espresso
import androidx.test.espresso.UiController
import androidx.test.espresso.ViewAction
import androidx.test.espresso.intent.Intents
Expand All @@ -44,7 +43,6 @@ import com.instructure.canvas.espresso.common.pages.WrongDomainPage
import com.instructure.espresso.InstructureActivityTestRule
import com.instructure.espresso.ModuleItemInteractions
import com.instructure.espresso.Searchable
import com.instructure.espresso.swipeRight
import com.instructure.pandautils.utils.Const
import com.instructure.student.BuildConfig
import com.instructure.student.R
Expand Down Expand Up @@ -89,7 +87,6 @@ import com.instructure.student.ui.pages.classic.ShareExtensionTargetPage
import com.instructure.student.ui.pages.classic.SubmissionDetailsPage
import com.instructure.student.ui.pages.classic.SyllabusPage
import com.instructure.student.ui.pages.classic.TextSubmissionUploadPage
import com.instructure.student.ui.pages.classic.TodoPage
import com.instructure.student.ui.pages.classic.UrlSubmissionUploadPage
import com.instructure.student.ui.pages.classic.k5.ElementaryCoursePage
import com.instructure.student.ui.pages.classic.k5.ElementaryDashboardPage
Expand Down Expand Up @@ -166,7 +163,6 @@ abstract class StudentTest : CanvasTest() {
val submissionDetailsPage = SubmissionDetailsPage()
val textSubmissionUploadPage = TextSubmissionUploadPage()
val syllabusPage = SyllabusPage()
val todoPage = TodoPage()
val urlSubmissionUploadPage = UrlSubmissionUploadPage()
val elementaryDashboardPage = ElementaryDashboardPage()
val homeroomPage = HomeroomPage()
Expand All @@ -180,20 +176,14 @@ abstract class StudentTest : CanvasTest() {
val manageOfflineContentPage = ManageOfflineContentPage()
val syncProgressPage = SyncProgressPage()

// A no-op interaction to afford us an easy, harmless way to get a11y checking to trigger.
fun meaninglessSwipe() {
Espresso.onView(ViewMatchers.withId(R.id.action_bar_root)).swipeRight()
}

// Get the number of files/avatars in our panda avatars folder
fun getSavedPandaAvatarCount() : Int {
val root = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), originalActivity.getString(R.string.pandaAvatarsFolderName))

if(root.isDirectory) {
return root.listFiles()?.size ?: 0
}
else {
return 0
return if(root.isDirectory) {
root.listFiles()?.size ?: 0
} else {
0
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ object CalendarEventApi {
@Query("calendar_event[start_at]") startDate: String
): Call<ScheduleItemApiModel>
}

private fun calendarEventService(token: String): CalendarEventService {
return CanvasNetworkAdapter.retrofitWithToken(token).create(CalendarEventService::class.java)
}


fun createCalendarEvent(token: String, contextCode: String, title: String, startDate: String): ScheduleItemApiModel = calendarEventService(token)
.createCalendarEvent(contextCode, title, startDate)
.execute()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.instructure.dataseeding.api

import com.instructure.dataseeding.model.PlannerNoteApiModel
import com.instructure.dataseeding.util.CanvasNetworkAdapter
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.POST

object PlannerAPI {

interface PlannerService {

@POST("planner_notes")
fun createPlannerNote(@Body plannerNote: PlannerNoteApiModel): Call<PlannerNoteApiModel>
}

private fun plannerService(token: String): PlannerService {
return CanvasNetworkAdapter.retrofitWithToken(token).create(PlannerService::class.java)
}

fun createPlannerNote(token: String, title: String, details: String, todoDate: String): PlannerNoteApiModel {
val plannerNote = PlannerNoteApiModel(
title = title,
details = details,
todoDate = todoDate
)
return plannerService(token).createPlannerNote(plannerNote)
.execute()
.body()!!
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,18 @@ object SeedApi {
CoursesApi.concludeCourse(coursesList[c].id)
}

// Seed favorite courses
addAllFavorites(
(0 until minOf(request.favoriteCourses, coursesList.size))
.map {
CoursesApi.addCourseToFavorites(coursesList[it].id,teachersList[0].token)
}
)
// Seed favorite courses for all students
(0 until minOf(request.favoriteCourses, coursesList.size)).forEach { courseIndex ->
studentsList.forEach { student ->
coursesList[courseIndex].isFavorite = true
addFavoriteCourses(
CoursesApi.addCourseToFavorites(
coursesList[courseIndex].id,
student.token
)
)
}
}

// Seed discussions
addAllDiscussions(
Expand Down Expand Up @@ -212,13 +217,12 @@ object SeedApi {
CoursesApi.concludeCourse(coursesList[c].id)
}

// Seed favorite courses
addAllFavorites(
(0 until minOf(request.favoriteCourses, coursesList.size))
.map {
CoursesApi.addCourseToFavorites(coursesList[it].id,teachersList[0].token)
}
)
// Seed favorite courses for all students
(0 until minOf(request.favoriteCourses, coursesList.size)).forEach { courseIndex ->
studentsList.forEach { student ->
addFavoriteCourses(CoursesApi.addCourseToFavorites(coursesList[courseIndex].id, student.token))
}
}

// Seed discussions
addAllDiscussions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ data class CourseApiModel(
@SerializedName("syllabus_body")
val syllabusBody: String? = null,
@SerializedName("default_view")
var homePage: String? = null
var homePage: String? = null,
@SerializedName("is_favorite")
var isFavorite: Boolean = false,
)

data class CreateCourse(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.instructure.dataseeding.model

import com.google.gson.annotations.SerializedName

data class PlannerNoteApiModel(
val id: String? = null,
val title: String,
var details: String? = null,
@SerializedName("user_id")
val userId: String? = null,
@SerializedName("created_at")
val createdAt: String? = null,
@SerializedName("todo_date")
val todoDate: String? = null,
@SerializedName("updated_at")
val lastUpdatedDate: String? = null,
@SerializedName("workflow_state")
val workflowState: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import com.google.gson.annotations.SerializedName

data class ScheduleItemApiModel(
val id: String? = null,
val title: String? = null,
val title: String,
var description: String? = null,
@SerializedName("start_at")
val startAt: String? = null
Expand Down
Loading
Loading