Skip to content

Commit

Permalink
test: course make and course enroll test with id's applied where nece…
Browse files Browse the repository at this point in the history
…ssary #434
  • Loading branch information
bsilkyn committed May 22, 2024
1 parent bac4c34 commit 6b6061a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions backend/authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def login_professor(self, request, *__) -> Response:
user, created = create_user(self, request, settings.TEST_PROFESSOR_DATA)
if created:
Teacher.create(user)
return response

@action(detail=False, methods=['POST'], permission_classes=[IsDebug], url_path='multi')
def login_multi(self, request, *__) -> Response:
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/courses/CourseDetailCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const { getImport } = useGlob(import.meta.glob('@/assets/img/faculties/*.png', {

<template>
<RouterLink :to="{ name: 'course', params: { courseId: course.id } }">
<Card class="border-round course-card max-w-30rem">
<Card id="course" class="border-round course-card max-w-30rem">
<template #header>
<div class="flex align-items-center justify-content-center text-white relative p-3 text-center h-12rem">
<img
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/courses/CourseDetailList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const { t } = useI18n();
<span class="pi pi-exclamation-circle text-6xl text-primary" />
<slot name="empty">
<p>{{ t('components.list.noCourses.student') }}</p>
<RouterLink :to="{ name: 'courses' }">
<RouterLink id="courses" :to="{ name: 'courses' }">
<Button :label="t('components.button.searchCourse')" icon="pi pi-search" />
</RouterLink>
</slot>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/courses/CourseForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ watchEffect(() => {
</div>

<!-- Submit button -->
<Button :label="t('views.courses.save')" type="submit" icon="pi pi-check" iconPos="right" rounded />
<Button id="courseSave" :label="t('views.courses.save')" type="submit" icon="pi pi-check" iconPos="right" rounded />
</form>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ async function leaveCourse(): Promise<void> {

<template>
<Button
id="courseEnroll"
class="text-sm p-0"
:label="t('views.courses.enroll')"
icon-pos="right"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/projects/ProjectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const incomingProjects = computed<Project[] | null>(() => {
<div class="mt-3">
<slot name="empty">
<p>{{ t('components.list.noProjects.student') }}</p>
<RouterLink :to="{ name: 'courses' }">
<RouterLink id="courses" :to="{ name: 'courses' }">
<Button :label="t('components.button.searchCourse')" icon="pi pi-search" />
</RouterLink>
</slot>
Expand Down
12 changes: 8 additions & 4 deletions frontend/src/views/dashboard/roles/TeacherDashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ watchImmediate(
<Title class="m-0">{{ t('views.dashboard.projects') }}</Title>

<!-- Create project button -->
<ProjectCreateButton :courses="filteredCourses" :label="t('components.button.createProject')" />
<ProjectCreateButton
id="projectCreate"
:courses="filteredCourses"
:label="t('components.button.createProject')"
/>
</div>
<!-- Project list body -->
<ProjectList :projects="projects">
Expand All @@ -79,7 +83,7 @@ watchImmediate(
{{ t('components.list.noCourses.teacher') }}
</p>

<ProjectCreateButton :courses="filteredCourses" :label="t('components.button.createProject')" />
<ProjectCreateButton id="projectCreate" :courses="filteredCourses" :label="t('components.button.createProject')" />
</template>
</template>
</ProjectList>
Expand All @@ -95,7 +99,7 @@ watchImmediate(
<YearSelector :years="allYears" v-model="selectedYear" />

<!-- Create course button -->
<RouterLink :to="{ name: 'course-create' }">
<RouterLink id="courseCreate" :to="{ name: 'course-create' }">
<Button
:icon="PrimeIcons.PLUS"
icon-pos="right"
Expand All @@ -109,7 +113,7 @@ watchImmediate(
<CourseList :courses="filteredCourses">
<template #empty>
<p>{{ t('components.list.noCourses.teacher') }}</p>
<RouterLink :to="{ name: 'course-create' }">
<RouterLink id="courseCreate" :to="{ name: 'course-create' }">
<Button :label="t('components.button.createCourse')" icon="pi pi-plus" />
</RouterLink>
</template>
Expand Down
7 changes: 4 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ django_exit=0
if [ "$frontend" = true ]; then
echo "Running frontend tests..."
echo "Filling up database with test data"
docker exec backend sh -c "python manage.py flush --no-input; python manage.py migrate; python manage.py loaddata
notifications/fixtures/$data/*; python manage.py loaddata authentication/fixtures/$data/*; python
manage.py loaddata api/fixtures/$data/*;"
docker exec backend sh -c "python manage.py flush --no-input; python manage.py migrate;
python manage.py loaddata notifications/fixtures/realistic/*;
python manage.py loaddata authentication/fixtures/realistic/*;
python manage.py loaddata api/fixtures/realistic/*;"
echo "Running Cypress tests..."
docker-compose -f test.yml up --exit-code-from cypress --abort-on-container-exit cypress
cypress_exit=$?
Expand Down

0 comments on commit 6b6061a

Please sign in to comment.