Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Commit

Permalink
feat!: typeorm (#216)
Browse files Browse the repository at this point in the history
* fix: update with typeorm changes

* fix: update chatbox

* fix: update chatbox

* chore: update and bump for chatbox

* fix: use messages instead of chat in itemchat

* refactor: partly fix chatbox still missing transaltions

* refactor: fix multiple issues in player

* test: pass

* refactor: fix issue with files and hidden items are now completly hidden

* test: fix public mock data

* fix: hidden tests and navigation

* fix: tests for navigation

* fix: remove getItemTags fro tests

* chore update sdk

* fix: issues ItemTagType casing

* chore: update deps with rc

* chore: update chatbox version

* fix: make PR changes

* fix: add translations

* chore: update translations
  • Loading branch information
spaenleh authored Jun 1, 2023
1 parent 60bbe39 commit 6e89839
Show file tree
Hide file tree
Showing 60 changed files with 3,275 additions and 2,529 deletions.
93 changes: 74 additions & 19 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"plugin:react-hooks/recommended",
"eslint:recommended"
],
"plugins": ["@typescript-eslint", "react-hooks"],
"plugins": [
"@typescript-eslint",
"react-hooks"
],
"env": {
"browser": true,
"node": true,
Expand All @@ -30,26 +33,37 @@
"rules": {
"react/function-component-definition": [
2,
{ "namedComponents": "arrow-function" }
{
"namedComponents": "arrow-function"
}
],
"import/extensions": "off",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
// note you must disable the base rule as it can report incorrect errors
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"@typescript-eslint/no-use-before-define": [
"error"
],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
// remove when possible
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error"
],
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{ "allowHigherOrderFunctions": true }
{
"allowHigherOrderFunctions": true
}
],
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx", ".ts", ".tsx"]
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
],
"import/no-named-as-default": 0,
Expand All @@ -66,42 +80,83 @@
}
],
"no-restricted-syntax": "off",
"react/state-in-constructor": ["error", "never"],
"no-console": [1, { "allow": ["error"] }],
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"react/state-in-constructor": [
"error",
"never"
],
"no-console": [
1,
{
"allow": [
"error"
]
}
],
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
],
"react/prop-types": "off", // Since we do not use prop-types
"react/require-default-props": "off" // Since we do not use prop-types
"react/require-default-props": "off", // Since we do not use prop-types
// disable the rule for all files
"@typescript-eslint/explicit-function-return-type": "off",
},
"overrides": [
{
// enable the rule specifically for TypeScript files
"files": ["*.ts", "*.tsx"],
"files": [
"*.ts",
"*.tsx"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{ "allowHigherOrderFunctions": true }
{
"allowHigherOrderFunctions": true
}
]
}
},
{
// enable the rule specifically for src files
"files": ["src/**/*.js", "src/**/*.tsx", "src/**/*.ts"],
"files": [
"src/**/*.js",
"src/**/*.tsx",
"src/**/*.ts"
],
"rules": {
"no-restricted-syntax": ["error"]
"no-restricted-syntax": [
"error"
]
}
}
],
"settings": {
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
"import/extensions": [
".js",
".jsx",
".ts",
".tsx"
],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
"@typescript-eslint/parser": [
".ts",
".tsx"
]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
},
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ jobs:
VITE_GRAASP_AUTH_HOST: http://localhost:3001
VITE_GRAASP_BUILDER_HOST: http://localhost:3111
VITE_SHOW_NOTIFICATIONS: false
VITE_HIDDEN_ITEM_TAG_ID: 'hidden-item-tag-id'
VITE_PUBLIC_TAG_ID: 'public-tag-id'

# after the test run completes
# store any screenshots
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
VITE_GA_MEASUREMENT_ID: ${{ secrets.VITE_GA_MEASUREMENT_ID }}
VITE_HIDDEN_ITEM_TAG_ID: ${{ secrets.VITE_HIDDEN_ITEM_TAG_ID }}
VITE_SHOW_NOTIFICATIONS: ${{ vars.VITE_SHOW_NOTIFICATIONS }}
run: yarn build
shell: bash
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
VITE_GA_MEASUREMENT_ID: ${{ secrets.VITE_GA_MEASUREMENT_ID }}
VITE_HIDDEN_ITEM_TAG_ID: ${{ secrets.VITE_HIDDEN_ITEM_TAG_ID }}
VITE_SHOW_NOTIFICATIONS: ${{ vars.VITE_SHOW_NOTIFICATIONS }}
run: yarn build
shell: bash
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
VITE_GA_MEASUREMENT_ID: ${{ secrets.VITE_GA_MEASUREMENT_ID }}
VITE_HIDDEN_ITEM_TAG_ID: ${{ secrets.VITE_HIDDEN_ITEM_TAG_ID }}
VITE_SHOW_NOTIFICATIONS: ${{ vars.VITE_SHOW_NOTIFICATIONS }}
run: yarn build
shell: bash
Expand Down
560 changes: 280 additions & 280 deletions .yarn/releases/yarn-3.4.1.cjs → .yarn/releases/yarn-3.5.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.4.1.cjs
yarnPath: .yarn/releases/yarn-3.5.1.cjs
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ VITE_GRAASP_LIBRARY_HOST=http://localhost:3005
VITE_SENTRY_ENV=development
VITE_H5P_INTEGRATION_URL=
VITE_SHOW_NOTIFICATIONS=true
# only used by the server for tests
VITE_PUBLIC_TAG_ID=123456-123789
VITE_HIDDEN_ITEM_TAG_ID=456789-123456
```

4. Run `yarn start`. The client should be accessible at `localhost:3112`
Expand All @@ -33,8 +30,6 @@ VITE_GRAASP_AUTH_HOST=http://localhost:3001
VITE_SENTRY_ENV=test
VITE_H5P_INTEGRATION_URL=
VITE_SHOW_NOTIFICATIONS=false
VITE_PUBLIC_TAG_ID=123456-123789
VITE_HIDDEN_ITEM_TAG_ID=456789-123456
```

Run `yarn cypress`. This should run every tests headlessly.
Expand Down
2 changes: 0 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export default defineConfig({
API_HOST: process.env.VITE_GRAASP_API_HOST || 'http://localhost:3000',
AUTHENTICATION_HOST:
process.env.VITE_GRAASP_AUTH_HOST || 'http://localhost:3001',
HIDDEN_ITEM_TAG_ID: process.env.VITE_HIDDEN_ITEM_TAG_ID || 'hidden-tag-id',
PUBLIC_TAG_ID: process.env.VITE_PUBLIC_TAG_ID || 'public-tag-id',
},
e2e: {
baseUrl: `http://localhost:${process.env.VITE_PORT || 3112}`,
Expand Down
57 changes: 27 additions & 30 deletions cypress/e2e/header.cy.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { getCurrentSession } from '@graasp/sdk';

import { HOME_PATH } from '../../src/config/paths';
import {
HEADER_MEMBER_MENU_BUTTON_ID,
HEADER_MEMBER_MENU_SEE_PROFILE_BUTTON_ID,
HEADER_MEMBER_MENU_SIGN_IN_BUTTON_ID,
HEADER_MEMBER_MENU_SIGN_OUT_BUTTON_ID,
buildMemberMenuItemId,
} from '../../src/config/selectors';
import { MOCK_SESSIONS } from '../fixtures/members';
import { MEMBER_PROFILE_PATH, SIGN_IN_PATH } from '../support/constants';

// catch hook warning from react
Expand All @@ -33,15 +28,16 @@ describe('Header', () => {
cy.url().should('equal', MEMBER_PROFILE_PATH);
});

it('Sign in', () => {
cy.setUpApi();
cy.visit(HOME_PATH);
// todo: not available currently because cookie is httpOnly
// it('Sign in', () => {
// cy.setUpApi();
// cy.visit(HOME_PATH);

cy.wait('@getCurrentMember');
cy.get(`#${HEADER_MEMBER_MENU_BUTTON_ID}`).click();
cy.get(`#${HEADER_MEMBER_MENU_SIGN_IN_BUTTON_ID}`).click();
cy.url().should('contain', SIGN_IN_PATH);
});
// cy.wait('@getCurrentMember');
// cy.get(`#${HEADER_MEMBER_MENU_BUTTON_ID}`).click();
// cy.get(`#${HEADER_MEMBER_MENU_SIGN_IN_BUTTON_ID}`).click();
// cy.url().should('contain', SIGN_IN_PATH);
// });

it('Sign out', () => {
cy.setUpApi();
Expand All @@ -53,25 +49,26 @@ describe('Header', () => {
cy.url().should('equal', SIGN_IN_PATH);
});

it('Switch users', () => {
cy.setUpApi({ storedSessions: MOCK_SESSIONS });
cy.visit(HOME_PATH);
// todo: not available since cookie is httpOnly
// it('Switch users', () => {
// cy.setUpApi({ storedSessions: MOCK_SESSIONS });
// cy.visit(HOME_PATH);

cy.wait('@getCurrentMember');
cy.get(`#${HEADER_MEMBER_MENU_BUTTON_ID}`).click();
// cy.wait('@getCurrentMember');
// cy.get(`#${HEADER_MEMBER_MENU_BUTTON_ID}`).click();

MOCK_SESSIONS.forEach(({ id }) => {
cy.get(`#${buildMemberMenuItemId(id)}`).should('be.visible');
});
// MOCK_SESSIONS.forEach(({ id }) => {
// cy.get(`#${buildMemberMenuItemId(id)}`).should('be.visible');
// });

// switch to first user
cy.get(`#${buildMemberMenuItemId(MOCK_SESSIONS[0].id)}`)
.click()
.then(() => {
// session cookie should be different
const currentCookie = getCurrentSession();
expect(currentCookie).to.equal(MOCK_SESSIONS[0].token);
});
});
// // switch to first user
// cy.get(`#${buildMemberMenuItemId(MOCK_SESSIONS[0].id)}`)
// .click()
// .then(() => {
// // session cookie should be different
// const currentCookie = getCurrentSession();
// expect(currentCookie).to.equal(MOCK_SESSIONS[0].token);
// });
// });
});
});
Loading

0 comments on commit 6e89839

Please sign in to comment.