Skip to content

Commit

Permalink
fix: update app and depdendencies
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh committed Jun 11, 2024
1 parent dec9522 commit b64fc10
Show file tree
Hide file tree
Showing 16 changed files with 5,578 additions and 4,688 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ build
public
coverage
src/registerServiceWorker.js
cypress/integration/examples
cypress/integration/examples
commitlint.config.js
53 changes: 35 additions & 18 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"airbnb",
"plugin:cypress/recommended",
"plugin:@typescript-eslint/recommended",
"airbnb-typescript",
"plugin:import/typescript", // this is needed because airbnb uses eslint-plugin-import
"prettier",
"plugin:react/recommended"
"plugin:cypress/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint", "prettier", "react-hooks"],
"env": {
"browser": true,
"node": true,
"mocha": true,
"jest": true
},
"globals": {
"cy": true,
"Cypress": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.eslint.json",
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react", "react-hooks", "@typescript-eslint", "prettier"],
"rules": {
"react/prop-types": "off",
"react/no-array-index-key": "off",
"react/jsx-props-no-spreading": "off",
"react/destructuring-assignment": "off",
"react/require-default-props": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/ban-ts-comment": "off",
"import/no-import-module-exports": "off",
"no-console": ["error", { "allow": ["error", "warn", "debug", "info"] }],
"import/no-extraneous-dependencies": [
"error",
{
Expand All @@ -51,7 +59,9 @@
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
"allowExpressions": true,
"allowHigherOrderFunctions": true,
"allowTypedFunctionExpressions": true
}
],
"@typescript-eslint/no-var-requires": "off",
Expand All @@ -75,21 +85,28 @@
],
// eslint rule reports false error
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"]
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
},
"settings": {
"react": {
"version": "detect"
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {},
"typescript": {
"alwaysTryTypes": true
},
"node": {
"extensions": [".ts", ".tsx"],
"moduleDirectory": ["src", "node_modules"]
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
}
}
}
13 changes: 11 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
"semi": true,
"singleQuote": true,
"jsxSingleQuote": false,
"importOrder": ["^react", "^@?graasp*", "^@?mui*", "^@.*", "^[./]"],
"importOrder": [
"^react",
"^@?graasp*",
"^@?mui*",
"^@.*",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
"importOrderSortSpecifiers": true,
"plugins": [
"@trivago/prettier-plugin-sort-imports"
]
}
127 changes: 75 additions & 52 deletions cypress/e2e/builder/keywords.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ describe('Empty Keywords', () => {

cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY))
.should('be.visible')
.should('not.be.disabled')
.click()
.should('be.disabled');
.and('not.be.disabled');
cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY)).click();
cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY)).should('be.disabled');
cy.get(buildDataCy(EDITABLE_TABLE_NO_DATA_CY)).should('not.exist');

cy.get(buildDataCy(buildEditableTableDeleteButtonCy(NEW_KEYWORD.word)))
Expand All @@ -113,9 +113,9 @@ describe('Empty Keywords', () => {

cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY))
.should('be.visible')
.should('not.be.disabled')
.click()
.should('be.disabled');
.and('not.be.disabled');
cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY)).click();
cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY)).should('be.disabled');

cy.get(buildDataCy(buildKeywordNotExistWarningCy(k))).should(
'be.visible',
Expand All @@ -136,9 +136,9 @@ describe('Empty Keywords', () => {

cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY))
.should('be.visible')
.should('not.be.disabled')
.click()
.should('be.disabled');
.and('not.be.disabled');
cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY)).click();
cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY)).should('be.disabled');

cy.get(buildDataCy(buildKeywordNotExistWarningCy(k))).should('not.exist');
});
Expand Down Expand Up @@ -189,10 +189,8 @@ describe('Existing Keywords', () => {
// try to add the existing keyword
cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY))
.should('be.visible')
.should('not.be.disabled')
.click()
// the button should not be disabled because it fails
.should('not.be.disabled');
.and('not.be.disabled');
cy.get(buildDataCy(ADD_KEYWORD_BUTTON_CY)).click();

// check that the keyword is not added in the table
cy.get(buildDataCy(EDITABLE_TABLE_ROW_CY)).should(
Expand Down Expand Up @@ -228,9 +226,12 @@ describe('Existing Keywords', () => {
cy.get(
buildDataCy(buildEditableTableEditButtonCy(UPDATING_KEYWORD.word)),
).click();
cy.get(buildDataCy(buildKeywordTextInputCy(UPDATING_KEYWORD.word, false)))
.clear()
.type(EXISTING_KEYWORD.word);
cy.get(
buildDataCy(buildKeywordTextInputCy(UPDATING_KEYWORD.word, false)),
).clear();
cy.get(
buildDataCy(buildKeywordTextInputCy(UPDATING_KEYWORD.word, false)),
).type(EXISTING_KEYWORD.word);

// try to save the modifications, it should fail
cy.get(
Expand Down Expand Up @@ -293,16 +294,22 @@ describe('Existing Keywords', () => {
cy.get(
buildDataCy(buildEditableTableEditButtonCy(UPDATING_KEYWORD.word)),
).click();
cy.get(buildDataCy(buildKeywordTextInputCy(UPDATING_KEYWORD.word, false)))
.clear()
.type(NEW_KEYWORD.word);
cy.get(
buildDataCy(buildKeywordTextInputCy(UPDATING_KEYWORD.word, false)),
).clear();
cy.get(
buildDataCy(buildKeywordTextInputCy(UPDATING_KEYWORD.word, false)),
).type(NEW_KEYWORD.word);
cy.get(
buildDataCy(
buildKeywordDefinitionTextInputCy(UPDATING_KEYWORD.word, false),
),
)
.clear()
.type(NEW_KEYWORD.def);
).clear();
cy.get(
buildDataCy(
buildKeywordDefinitionTextInputCy(UPDATING_KEYWORD.word, false),
),
).type(NEW_KEYWORD.def);

// save the modifications
cy.get(
Expand Down Expand Up @@ -355,9 +362,10 @@ describe('Existing Keywords', () => {
KEYWORDS.length,
);

cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY))
.clear()
.type(FILTER_WORD);
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY)).clear();
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY)).type(
FILTER_WORD,
);

cy.get(buildDataCy(EDITABLE_TABLE_ROW_CY)).should('have.length', 1);
cy.get(buildDataCy(buildKeywordTextInputCy(FILTER_WORD, true)));
Expand All @@ -373,9 +381,10 @@ describe('Existing Keywords', () => {
it('invalid filter display no result', () => {
const FILTER_WORD = 'kd kjfd fkjbd';

cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY))
.clear()
.type(FILTER_WORD);
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY)).clear();
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY)).type(
FILTER_WORD,
);

cy.get(buildDataCy(EDITABLE_TABLE_ROW_CY)).should('have.length', 0);
cy.get(buildDataCy(EDITABLE_TABLE_FILTER_NO_RESULT_CY)).should('exist');
Expand All @@ -399,9 +408,10 @@ describe('Existing Keywords', () => {
).click();

// filter by keyword
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY))
.clear()
.type(FILTER_WORD);
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY)).clear();
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY)).type(
FILTER_WORD,
);

cy.get(buildDataCy(EDITABLE_TABLE_ROW_CY)).should('have.length', 1);
cy.get(buildDataCy(buildKeywordTextInputCy(FILTER_WORD, true)));
Expand Down Expand Up @@ -461,18 +471,23 @@ describe('Existing Keywords', () => {
// updates the keywords without saving for now
UPDATING_KEYWORDS.forEach((k, idx) => {
cy.get(buildDataCy(buildEditableTableEditButtonCy(k))).click();
cy.get(buildDataCy(buildKeywordTextInputCy(k, false)))
.clear()
.type(NEW_KEYWORDS[idx].word);
cy.get(buildDataCy(buildKeywordDefinitionTextInputCy(k, false)))
.clear()
.type(NEW_KEYWORDS[idx].def);
cy.get(buildDataCy(buildKeywordTextInputCy(k, false))).clear();
cy.get(buildDataCy(buildKeywordTextInputCy(k, false))).type(
NEW_KEYWORDS[idx].word,
);
cy.get(
buildDataCy(buildKeywordDefinitionTextInputCy(k, false)),
).clear();
cy.get(buildDataCy(buildKeywordDefinitionTextInputCy(k, false))).type(
NEW_KEYWORDS[idx].def,
);
});

// filter by keyword
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY))
.clear()
.type(FILTER_WORD);
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY)).clear();
cy.get(buildTextFieldSelectorCy(EDITABLE_TABLE_FILTER_INPUT_CY)).type(
FILTER_WORD,
);

cy.get(buildDataCy(EDITABLE_TABLE_ROW_CY)).should('have.length', 1);

Expand Down Expand Up @@ -599,12 +614,16 @@ describe('Existing Keywords', () => {
// updates the keywords without saving for now
UPDATING_KEYWORDS.forEach((k, idx) => {
cy.get(buildDataCy(buildEditableTableEditButtonCy(k))).click();
cy.get(buildDataCy(buildKeywordTextInputCy(k, false)))
.clear()
.type(NEW_KEYWORDS[idx].word);
cy.get(buildDataCy(buildKeywordDefinitionTextInputCy(k, false)))
.clear()
.type(NEW_KEYWORDS[idx].def);
cy.get(buildDataCy(buildKeywordTextInputCy(k, false))).clear();
cy.get(buildDataCy(buildKeywordTextInputCy(k, false))).type(
NEW_KEYWORDS[idx].word,
);
cy.get(
buildDataCy(buildKeywordDefinitionTextInputCy(k, false)),
).clear();
cy.get(buildDataCy(buildKeywordDefinitionTextInputCy(k, false))).type(
NEW_KEYWORDS[idx].def,
);
});

// save all the modifications
Expand Down Expand Up @@ -641,12 +660,16 @@ describe('Existing Keywords', () => {
UPDATING_KEYWORDS.forEach((k, idx) => {
// edit the existing keyword to a keyword that are already in the table
cy.get(buildDataCy(buildEditableTableEditButtonCy(k))).click();
cy.get(buildDataCy(buildKeywordTextInputCy(k, false)))
.clear()
.type(NEW_KEYWORDS[idx].word);
cy.get(buildDataCy(buildKeywordDefinitionTextInputCy(k, false)))
.clear()
.type(NEW_KEYWORDS[idx].def);
cy.get(buildDataCy(buildKeywordTextInputCy(k, false))).clear();
cy.get(buildDataCy(buildKeywordTextInputCy(k, false))).type(
NEW_KEYWORDS[idx].word,
);
cy.get(
buildDataCy(buildKeywordDefinitionTextInputCy(k, false)),
).clear();
cy.get(buildDataCy(buildKeywordDefinitionTextInputCy(k, false))).type(
NEW_KEYWORDS[idx].def,
);
});

// discard all the modifications
Expand Down
Loading

0 comments on commit b64fc10

Please sign in to comment.