Skip to content
Open
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
10 changes: 10 additions & 0 deletions client/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "cypress";

export default defineConfig({
component: {
devServer: {
framework: "react",
bundler: "vite",
},
},
});
5 changes: 5 additions & 0 deletions client/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
37 changes: 37 additions & 0 deletions client/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
12 changes: 12 additions & 0 deletions client/cypress/support/component-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
19 changes: 19 additions & 0 deletions client/cypress/support/component.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MountOptions, MountReturn } from "cypress/react";
import { MemoryRouterProps } from "react-router-dom";
import { mount } from "cypress/react";

declare global {
namespace Cypress {
interface Chainable {
/**
* Mounts a React node
* @param component React Node to mount
* @param options Additional options to pass into mount
*/
mount(
component: React.ReactNode,
options?: MountOptions & { routerProps?: MemoryRouterProps },
): Cypress.Chainable<MountReturn>;
}
}
}
61 changes: 61 additions & 0 deletions client/cypress/support/component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/// <reference path="./component.d.ts" />

// ***********************************************************
// This example support/component.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import { ChakraProvider } from "@chakra-ui/react";
import "./commands";

import { mount } from "cypress/react";

import { createMemoryRouter, RouterProvider } from "react-router-dom";
import { MathJaxContext } from "better-react-mathjax";
import { mathjaxConfig } from "@doenet/doenetml-iframe";
import { theme } from "../../src/theme";

// Augment the Cypress namespace to include type definitions for
// your custom command.
// Alternatively, can be defined in cypress/support/component.d.ts
// with a <reference path="./component" /> at the top of your spec.

// Cypress.Commands.add('mount', mount)

Cypress.Commands.add("mount", (component, options = {}) => {
const { routerProps = { initialEntries: ["/"] }, ...mountOptions } = options;

const router = createMemoryRouter(
[
{
path: "/",
element: (
<ChakraProvider theme={theme}>
<MathJaxContext version={4} config={mathjaxConfig}>
{component as any}
</MathJaxContext>
</ChakraProvider>
),
},
],
routerProps as any,
);

const wrapped = <RouterProvider router={router} />;

return mount(wrapped, mountOptions);
});

// Example use:
// cy.mount(<MyComponent />)
17 changes: 17 additions & 0 deletions client/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";
1 change: 1 addition & 0 deletions client/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default tseslint.config(
rules: {
"react/react-in-jsx-scope": "off", // Not needed with new JSX transform
"react/jsx-uses-react": "off", // Not needed with new JSX transform
"@typescript-eslint/triple-slash-reference": "off",
},
},

Expand Down
15 changes: 8 additions & 7 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "wireit",
"dev": "cross-env NODE_ENV=production vite",
"lint": "eslint --fix",
"lint:check": "eslint"
"lint:check": "eslint",
"test-cypress": "cypress open"
},
"wireit": {
"build": {
Expand All @@ -31,13 +32,13 @@
"dependencies": {
"@chakra-ui/icons": "^2.2.4",
"@chakra-ui/react": "^2.10.9",
"@doenet/assignment-viewer": "^0.1.0-alpha-12",
"@doenet/doenetml-iframe": "^0.7.0-beta-17",
"@doenet/v06-to-v07": "^0.7.0-beta-17",
"@doenet-tools/shared": "*",
"@doenet/assignment-viewer": "^0.1.0-alpha-13",
"@doenet/doenetml-iframe": "^0.7.0-rc-2",
"@doenet/v06-to-v07": "^0.7.0-beta-17",
"@fontsource/jost": "^5.2.6",
"axios": "^1.11.0",
"better-react-mathjax": "^2.1.0",
"better-react-mathjax": "^2.4.0-beta-1",
"browser-image-resizer": "^2.4.1",
"cssesc": "^3.0.0",
"export-to-csv": "^1.4.0",
Expand All @@ -46,8 +47,8 @@
"math-expressions": "^2.0.0-alpha76",
"nanoid": "^5.1.5",
"papaparse": "^5.5.3",
"react": "19.2.1",
"react-dom": "19.2.1",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-dropzone": "^14.3.8",
"react-icons": "5.5.0",
"react-qrcode-logo": "^3.0.0",
Expand Down
53 changes: 3 additions & 50 deletions client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { createRoot } from "react-dom/client";
import "@doenet/doenetml-iframe/style.css";

import { MathJaxContext } from "better-react-mathjax";
import { theme } from "./theme";
import { loader as exploreLoader, Explore } from "./paths/Explore";

import { loader as curateLoader, Curate } from "./paths/Curate";
Expand Down Expand Up @@ -54,7 +55,7 @@ import {
assignedDataloader,
} from "./paths/StudentAssignmentScores";
import { loader as trashLoader, Trash } from "./paths/Trash";
import { ChakraProvider, extendTheme } from "@chakra-ui/react";
import { ChakraProvider } from "@chakra-ui/react";
import { FolderContext } from "./paths/FolderContext";

import ErrorPage from "./paths/ErrorPage";
Expand Down Expand Up @@ -125,54 +126,6 @@ import {
} from "./paths/SharedWithMe";
import { editorUrl } from "./utils/url";

const theme = extendTheme({
fonts: {
body: "Jost",
},
textStyles: {
primary: {
fontFamily: "Jost",
},
},
config: {
initialColorMode: "light",
useSystemColorMode: false,
},
colors: {
doenet_blue: {
100: "#a6f19f", //Ghost/Outline Click
200: "#c1292e", //Normal Button - Dark Mode - Background
300: "#f5ed85", //Normal Button - Dark Mode - Hover
400: "#949494", //Normal Button - Dark Mode - Click
500: "#1a5a99", //Normal Button - Light Mode - Background
600: "#757c0d", //Normal Button - Light Mode - Hover //Ghost/Outline BG
700: "#d1e6f9", //Normal Button - Light Mode - Click
800: "#6d4445",
900: "#4a03d9",
},
doenet: {
mainBlue: "#1a5a99",
lightBlue: "#b8d2ea",
solidLightBlue: "#8fb8de",
mainGray: "#e3e3e3",
mediumGray: "#949494",
lightGray: "#e7e7e7",
donutBody: "#eea177",
donutTopping: "#6d4445",
mainRed: "#c1292e",
lightRed: "#eab8b8",
mainGreen: "#459152",
canvas: "#ffffff",
canvastext: "#000000",
lightGreen: "#a6f19f",
lightYellow: "#f5ed85",
whiteBlankLink: "#6d4445",
mainYellow: "#94610a",
mainPurple: "#4a03d9",
},
},
});

const router = createBrowserRouter([
{
path: "/",
Expand All @@ -181,7 +134,7 @@ const router = createBrowserRouter([
<>
<ChakraProvider theme={theme}>
<MathJaxContext
version={3}
version={4}
config={mathjaxConfig}
// onStartup={(mathJax) => (mathJax.Hub.processSectionDelay = 0)}
>
Expand Down
2 changes: 2 additions & 0 deletions client/src/paths/editor/EditorHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export function EditorHeader() {
variant="ghost"
aria-label={"Folder"}
to={folderLink}
data-test="Folder Breadcrumb Icon"
/>
</Show>

Expand Down Expand Up @@ -523,6 +524,7 @@ export function EditorHeader() {
colorScheme="blue"
isDisabled={inLibrary}
onClick={() => shareContentOnOpen()}
data-test="Share Button"
>
Share
</Button>
Expand Down
Loading