From 3a5631e8736eabcdd61bca1c6ff3de9583f070b1 Mon Sep 17 00:00:00 2001 From: aaronshiel Date: Thu, 21 Sep 2023 18:24:55 -0700 Subject: [PATCH] default api coverage for cypress --- .../fixtures/mentor/orphaned_answer.ts | 22 +++++++++++++++ cypress/cypress/support/functions.ts | 3 +++ cypress/cypress/support/types.ts | 27 +++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 cypress/cypress/fixtures/mentor/orphaned_answer.ts diff --git a/cypress/cypress/fixtures/mentor/orphaned_answer.ts b/cypress/cypress/fixtures/mentor/orphaned_answer.ts new file mode 100644 index 00000000..87a06b5f --- /dev/null +++ b/cypress/cypress/fixtures/mentor/orphaned_answer.ts @@ -0,0 +1,22 @@ +/* +This software is Copyright ©️ 2020 The University of Southern California. All Rights Reserved. +Permission to use, copy, modify, and distribute this software and its documentation for educational, research and non-profit purposes, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and subject to the full license file found in the root of this software deliverable. Permission to make commercial use of this software may be obtained by contacting: USC Stevens Center for Innovation University of Southern California 1150 S. Olive Street, Suite 2300, Los Angeles, CA 90115, USA Email: accounting@stevens.usc.edu + +The full terms of this copyright and license should always be found in the root directory of this software deliverable as "license.txt" and if these terms are not found with this software, please contact the USC Stevens Center for the full license. +*/ +import { Answer, QuestionType, Status } from "../../support/types"; + +export const orphanedAnswer: Answer = { + previousVersions: [], + _id: "A9_9_9", + question: { + _id: "A9_9_9", + clientId: "C_A9_9_9", + question: "Orphaned Question", + type: QuestionType.QUESTION, + name: null, + paraphrases: [], + }, + transcript: "Orphaned transcript", + status: Status.COMPLETE, +}; diff --git a/cypress/cypress/support/functions.ts b/cypress/cypress/support/functions.ts index 151b03ae..0cab9038 100644 --- a/cypress/cypress/support/functions.ts +++ b/cypress/cypress/support/functions.ts @@ -20,6 +20,7 @@ import { TaskStatus, UserAccessToken } from "./types"; import questions from "../fixtures/questions"; import { encodedSentences } from "../fixtures/feedback/trendingFeedbackEncodedResults"; import { v4 as uuid } from "uuid"; +import { orphanedAnswer } from "../fixtures/mentor/orphaned_answer"; const TRAIN_STATUS_URL = `/train/status`; const UPLOAD_STATUS_URL = `/upload/answer/status`; @@ -333,6 +334,8 @@ export function cyMockDefault( mockGQL("UpdateMentorDetails", { me: { updateMentorDetails: true } }), mockGQL("UpdateMentorKeywords", { me: { updateMentorKeywords: true } }), mockGQL("UpdateMentorPrivacy", { me: { updateMentorPrivacy: true } }), + mockGQL("FetchMentorConfig", { fetchMentorConfig: {} }), + mockGQL("Answer", { answer: orphanedAnswer }), ]); } diff --git a/cypress/cypress/support/types.ts b/cypress/cypress/support/types.ts index 5b16010a..63242310 100644 --- a/cypress/cypress/support/types.ts +++ b/cypress/cypress/support/types.ts @@ -78,8 +78,35 @@ export interface UserAccessToken { expirationDate: string; } +export enum OrgViewPermissionType { + NONE = "NONE", // no custom settings, use "isPrivate" + HIDDEN = "HIDDEN", // org cannot see or use mentor + SHARE = "SHARE", // org can use mentor as-is +} + +export enum OrgEditPermissionType { + NONE = "NONE", // no custom settings, use "isPrivate" + MANAGE = "MANAGE", // org can edit content + ADMIN = "ADMIN", // org can edit content and edit sharing settings +} + +export interface OrgPermissionsGQL { + org: string; + viewPermission: OrgViewPermissionType; + editPermission: OrgEditPermissionType; +} + export interface MentorConfig { configId: string; + subjects: string[]; + publiclyVisible: boolean; + mentorType: MentorType; + orgPermissions: OrgPermissionsGQL[]; + loginHeaderText: string; + welcomeSlideHeader: string; + welcomeSlideText: string; + disableMyGoalSlide: boolean; + disableFollowups: boolean; } export interface Mentor {