Skip to content

Commit

Permalink
Merge branch 'master' into recordedit-w-association-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
jrchudy committed Aug 13, 2024
2 parents 967edeb + a59e4f6 commit ed1bf14
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 58 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module.exports = {
'@typescript-eslint/no-unsafe-function-type': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-inferrable-types': 'warn',
'@typescript-eslint/no-require-imports': 'warn',
// TODO we should remove the following deprecated rule when we go to version 8:
'@typescript-eslint/ban-types': 'warn',

Expand Down
26 changes: 21 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,43 @@

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
allow:
- dependency-name: "@playwright/test"
# https://github.com/dependabot/dependabot-core/issues/1778#issuecomment-1988140219
target-branch: master
assignees:
- "jrchudy"
- "RFSH"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
ignore:
- dependency-name: "@playwright/test"
- dependency-name: "moment*"
- dependency-name: "protractor"
- dependency-name: "@typescript-eslint/*"
- dependency-name: "eslint-*"
- dependency-name: "eslint"
- dependency-name: "prettier"
- dependency-name: "patch-package"
- dependency-name: "uglify-js"
groups:
babel:
patterns:
- "@babel/*"
- "babel-loader"
- "css-loader"
- "sass-loader"
bootstrap:
patterns:
- "react-bootstrap"
- "bootstrap"
eslint:
patterns:
- "@typescript-eslint/*"
- "eslint-*"
- "eslint"
react:
patterns:
- "@types/react"
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ lint: $(SOURCE)
lint-w-warn: $(SOURCE)
@npx eslint src --ext .ts,.tsx

.PHONY: lint-tests
lint-tests:
npx eslint test/e2e --ext .ts,.tsx --quiet

# Rule to create the package.
.PHONY: dist-wo-deps
dist-wo-deps: print-variables run-webpack $(SASS) $(MIN) $(HTML) gitversion
Expand Down
4 changes: 1 addition & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ module.exports = {
}],
'@babel/preset-typescript',
],
'plugins': [
'@babel/plugin-proposal-class-properties',
]
'plugins': []
}
63 changes: 25 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
},
"dependencies": {
"@babel/core": "7.24.x",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/preset-env": "7.24.x",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "7.24.x",
Expand Down
2 changes: 1 addition & 1 deletion src/components/input-switch/date-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const DateField = (props: DateFieldProps): JSX.Element => {
* converting a strored "Date" object to string (what user sees)
* and vice versa.
*/
format={(date) => windowRef.moment(date).format(dataFormats.date)}
format={(date: any) => windowRef.moment(date).format(dataFormats.date)}
parse={(str) => windowRef.moment(str, dataFormats.date)}
autofix={false}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/input-switch/file-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const FileField = (props: FileFieldProps): JSX.Element => {
return () => {
if (fieldValue && isStringAndNotEmpty(fieldValue.filename)) {
if (fieldValue.filesize) {
return `- ${fieldValue.filename} \n- size: ${humanFileSize(fieldValue.filesize)}`;
return `- ${fieldValue.filename}\n- ${humanFileSize(fieldValue.filesize)}`;
} else {
return fieldValue.filename;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const ChaiseTooltip = ({
* adding the tooltip as key will make sure we're remounting when tooltip changes.
* we have to remount so the tooltip position is updated properly
*/
{...(dynamicTooltipString && typeof tooltip === 'string' && { key: tooltip })}
key={dynamicTooltipString && typeof tooltip === 'string' ? tooltip : undefined}
>
{tooltip}
</Tooltip>
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/setup/playwright.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ export type TestOptions = {
*/
chaiseConfigFilePath?: string,

/**
* if set to to true, we will inject the "defaultCatalog" property
* into the chaise-config.js file.
*
* the id of the catalog created for the chrome project will be used for this.
*/
addDefaultCatalogToChaiseConfig?: boolean,

manualTestConfig?: boolean,

/**
Expand Down
30 changes: 23 additions & 7 deletions test/e2e/setup/playwright.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { FullConfig } from '@playwright/test';
import axios from 'axios';
import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';

import { TestOptions } from '@isrd-isi-edu/chaise/test/e2e/setup/playwright.model';
import { removeAllCatalogs, setupCatalog } from '@isrd-isi-edu/chaise/test/e2e/utils/catalog-utils';
import { ENTITIES_PATH, PW_PROJECT_NAMES } from '@isrd-isi-edu/chaise/test/e2e/utils/constants';
import { getCatalogID, removeAllCatalogs, setupCatalog } from '@isrd-isi-edu/chaise/test/e2e/utils/catalog-utils';
import { ENTITIES_PATH, PW_PROJECT_NAMES, UPLOAD_FOLDER } from '@isrd-isi-edu/chaise/test/e2e/utils/constants';
import { setCatalogID } from '@isrd-isi-edu/chaise/test/e2e/utils/catalog-utils';

/**
Expand Down Expand Up @@ -80,7 +81,7 @@ export default async function globalSetup(config: FullConfig) {
chaiseConfigFilePath = `test/e2e/specs/${options.mainSpecName}/chaise-config.js`;
}

copyChaiseConfig(chaiseConfigFilePath);
copyChaiseConfig(chaiseConfigFilePath, options.addDefaultCatalogToChaiseConfig);

registerCallbacks(testConfiguration);
}
Expand Down Expand Up @@ -180,9 +181,7 @@ async function createCatalog(testConfiguration: any, projectNames: string[], mai

for (const p of projectNames) {
try {
// add alias to the catalog based on the config and project name
const alias = `${mainSpecName}-${p}`;
const res = await setupCatalog({ catalog: { ...catalog, alias }, schemas });
const res = await setupCatalog({ catalog: { ...catalog }, schemas });
console.log(`catalog with id ${res.catalogId} created for project ${p}`);
setCatalogID(p, res.catalogId);

Expand Down Expand Up @@ -292,7 +291,7 @@ async function getSessionByUserPass(username: string, password: string, authCook
/**
* copy the chaise config into desired location
*/
function copyChaiseConfig(chaiseConfigFilePath?: string) {
function copyChaiseConfig(chaiseConfigFilePath?: string, addDefaultCatalogToChaiseConfig?: boolean) {
let chaiseFilePath = 'chaise-config-sample.js';
if (typeof chaiseConfigFilePath === 'string') {
try {
Expand All @@ -303,6 +302,23 @@ function copyChaiseConfig(chaiseConfigFilePath?: string) {
}
}

if (addDefaultCatalogToChaiseConfig) {
// grab the catalog id
const catId = getCatalogID(PW_PROJECT_NAMES.CHROME);
if (catId === null) {
throw new Error('unable to find catalog id for chrome project while adding defaultCatalog');
}

// grab the content of chaise-config file and add the defaultCatalog to it
let content = fs.readFileSync(chaiseFilePath, 'utf8');
content += `\nchaiseConfig.defaultCatalog = '${catId}'`;

// write the new content into the temporary location
execSync(`mkdir -p ${UPLOAD_FOLDER}`);
chaiseFilePath = path.resolve(UPLOAD_FOLDER, 'chaise-config.js');
fs.writeFileSync(chaiseFilePath, content);
}

const remoteChaiseDirPath = process.env.REMOTE_CHAISE_DIR_PATH;

// The tests will take this path when it is not running on CI and remoteChaseDirPath is not null
Expand Down
1 change: 0 additions & 1 deletion test/e2e/specs/delete-prohibited/chaise-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

var chaiseConfig = {
name: "Delete Prohibited",
defaultCatalog: 'delete-prohibited-chrome',
editRecord: true,
deleteRecord: false,
showFaceting: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export default getConfig({
testName: 'delete-prohibited/navbar',
configFileName: 'navbar/catalog-chaise-config.dev.json',
mainSpecName: 'delete-prohibited',
addDefaultCatalogToChaiseConfig: true
});
1 change: 1 addition & 0 deletions test/e2e/specs/delete-prohibited/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export default getConfig({
testName: 'delete-prohibited',
configFileName: 'parallel-configs/delete-prohibited.dev.json',
mainSpecName: 'delete-prohibited',
addDefaultCatalogToChaiseConfig: true
});

0 comments on commit ed1bf14

Please sign in to comment.