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
4 changes: 4 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@
- Add ability to display placeholder row inside JUPTable component when no row data is available (no transactions, no assets, etc...)
- Upgrade JupTable sorting mechanisms; with room for extensions to more complex object types such as BigNumber and Date
- Adds current page indicator to navigation drawer

## 0.0.6

- Upgrade Cypress to latest version, add first component based test (JUPTable)
21 changes: 21 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineConfig } from "cypress";

export default defineConfig({
defaultCommandTimeout: 6000,

e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require("./cypress/plugins/index.js")(on, config);
},
baseUrl: "http://localhost:3002",
},

component: {
devServer: {
framework: "create-react-app",
bundler: "webpack",
},
},
});
5 changes: 0 additions & 5 deletions cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 37 additions & 0 deletions 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 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>
39 changes: 39 additions & 0 deletions cypress/support/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// ***********************************************************
// 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 './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from 'cypress/react'

// 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.
declare global {
namespace Cypress {
interface Chainable {
mount: typeof mount
}
}
}

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

// Example use:
// cy.mount(<MyComponent />)
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupiter-wallet",
"version": "0.0.5",
"version": "0.0.6",
"private": true,
"scripts": {
"proxy": "node proxy/server.js",
Expand Down Expand Up @@ -70,7 +70,7 @@
"concurrently": "^7.1.0",
"cross-fetch": "^3.1.5",
"crypto-js": "^4.1.1",
"cypress": "^9.5.4",
"cypress": "^12.5.1",
"cypress-dark": "^1.8.3",
"eslint": "^8.13.0",
"eslint-config-prettier": "8.5.0",
Expand Down
50 changes: 50 additions & 0 deletions src/components/JUPTable/JUPTable.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/// <reference types="cypress" />
import { IHeadCellProps, ITableRow } from ".";
import JUPTable from "./JUPTable";

// TODO:
// [ ] Fix cy.mount() not being recognized
// [ ] Test empty rows
// [ ] Test populated rows
// [ ] Test with/without title & associated link
// [ ] Test with/without displayed components
// [ ] Test sorting
// [ ] Test with/without pagination
// [ ] Test short and long page style

// interface IJUPTableProps {
// title?: string;
// headCells?: Array<IHeadCellProps>;
// rows?: Array<ITableRow>;
// path?: string;
// DisplayedComponents?: Array<React.ReactElement>;
// defaultSortOrder?: Order;
// rowsPerPageStyle?: "short" | "long"; // determines which page row quantity options are presented to the user
// isPaginated?: boolean;
// keyProp: string; // This prop gets used to build a unique key
// EmptyRowPlaceholder?: string | React.NamedExoticComponent; // component/string to display when no row data is present
// }

const testHeaders: Array<IHeadCellProps> = [
{
id: "col1",
label: "Column 1",
headAlignment: "center",
rowAlignment: "left",
},
];

const testRowsFull: Array<ITableRow> = [
{
col1: "12345",
},
];

const testRowsEmpty = [];

describe("JUP Table", () => {
it("renders", () => {
// see: https://on.cypress.io/mounting-react
cy.mount(<JUPTable keyProp={"col1"} rows={testRowsFull} headCells={testHeaders} />);
});
});
Loading