Skip to content

Commit

Permalink
Merge branch 'master' of github.com:informatics-isi-edu/chaise into 2…
Browse files Browse the repository at this point in the history
…326-customize-order-of-facets
  • Loading branch information
RFSH committed Aug 19, 2024
2 parents ead34c2 + 607535e commit 9a8438f
Show file tree
Hide file tree
Showing 168 changed files with 7,550 additions and 6,858 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ module.exports = {
'@typescript-eslint/no-duplicate-enum-values': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/ban-types': 'warn',
'@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',

// ------------------ testing ------------------
'@typescript-eslint/no-floating-promises': '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
9 changes: 0 additions & 9 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,6 @@ jobs:
run: |
cd chaise
make testdefaultconfig-protractor
- name: Run delete prohibited test spec (protractor)
id: test-protractor-delete-prohibited
continue-on-error: true
run: |
cd chaise
make testdeleteprohibited-protractor
- name: Check on all features test spec
if: always() && steps.test-all-features.outcome != 'success'
run: exit 1
Expand All @@ -204,9 +198,6 @@ jobs:
- name: Check on default config test spec (protractor)
if: always() && steps.test-protractor-default-config.outcome != 'success'
run: exit 1
- name: Check on delete prohibited test spec (protractor)
if: always() && steps.test-protractor-delete-prohibited.outcome != 'success'
run: exit 1
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
71 changes: 33 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,25 @@ E2EDIrecordEdit=test/e2e/specs/all-features-confirmation/recordedit/edit-delete.
# not part of the make recordedit command anymore
E2EDIrecordMultiFormInput=test/e2e/specs/default-config/multi-form-input/multi-form-input.config.ts
E2EDIrecordMultiEdit=test/e2e/specs/default-config/recordedit/multi-edit.conf.js
E2EDrecordEditCompositeKey=test/e2e/specs/default-config/recordedit/composite-key.conf.js
E2EDrecordEditDomainFilter=test/e2e/specs/default-config/recordedit/domain-filter.conf.js
E2EDrecordEditCompositeKey=test/e2e/specs/default-config/recordedit/composite-key.config.ts
E2EDrecordEditDomainFilter=test/e2e/specs/default-config/recordedit/domain-filter.config.ts
E2EDrecordEditSubmissionDisabled=test/e2e/specs/default-config/recordedit/submission-disabled.conf.js
E2ErecordEditForeignKeyDropdown=test/e2e/specs/default-config/recordedit/foreign-key-dropdown.conf.js
E2ErecordEditForeignKeyDropdown=test/e2e/specs/default-config/recordedit/foreign-key-dropdown.config.ts
E2ErecordEditInputIframe=test/e2e/specs/all-features/recordedit/input-iframe.config.ts
# Record tests
E2EDrecord=test/e2e/specs/all-features-confirmation/record/presentation-btn.conf.js
E2EDrecord=test/e2e/specs/all-features-confirmation/record/presentation-btn.config.ts
E2EDrecordProt=test/e2e/specs/all-features-confirmation/record/presentation-btn.conf.js
E2EDrecordCopy=test/e2e/specs/all-features/record/copy-btn.config.ts
E2ErecordNoDeleteBtn=test/e2e/specs/delete-prohibited/record/no-delete-btn.config.ts
E2EDrecordRelatedTable=test/e2e/specs/all-features/record/related-table.config.ts
E2EDrecordLinks=test/e2e/specs/default-config/record/links.conf.js
E2EDrecordLinks=test/e2e/specs/default-config/record/links.config.ts
# Recordset tests
E2EDrecordset=test/e2e/specs/all-features-confirmation/recordset/presentation.conf.js
E2EDrecordsetEdit=test/e2e/specs/default-config/recordset/edit.conf.js
E2ErecordsetAdd=test/e2e/specs/default-config/recordset/add.conf.js
E2EDrecordsetIndFacet=test/e2e/specs/delete-prohibited/recordset/ind-facet.conf.js
E2EDrecordsetHistFacet=test/e2e/specs/delete-prohibited/recordset/histogram-facet.conf.js
E2ErecordsetSavedQuery=test/e2e/specs/all-features/recordset/saved-query.conf.ts
E2EDrecordsetIndFacet=test/e2e/specs/delete-prohibited/recordset/ind-facet.config.ts
E2EDrecordsetHistFacet=test/e2e/specs/delete-prohibited/recordset/histogram-facet.config.ts
E2ErecordsetSavedQuery=test/e2e/specs/all-features/recordset/saved-query.config.ts

# misc tests
E2Enavbar=test/e2e/specs/all-features/navbar/playwright.config.ts
Expand All @@ -78,10 +79,9 @@ E2EmultiPermissionsVisibility=test/e2e/specs/all-features/permissions.config.ts
# footer test
E2Efooter=test/e2e/specs/all-features-confirmation/footer/playwright.config.ts
# errors test
E2Eerrors=test/e2e/specs/all-features-confirmation/errors/protractor.conf.js
E2Eerrors=test/e2e/specs/all-features-confirmation/errors/errors.config.ts
## Parallel test scripts (protractor)
AllFeaturesConfirmationParallel_PROTRACTOR=test/e2e/specs/all-features-confirmation/protractor.conf.js
DeleteProhibitedParallel_PROTRACTOR=test/e2e/specs/delete-prohibited/protractor.conf.js
DefaultConfigParallel_PROTRACTOR=test/e2e/specs/default-config/protractor.conf.js
## Parallel test scripts
AllFeaturesParallel=test/e2e/specs/all-features/playwright.config.ts
Expand All @@ -92,26 +92,24 @@ DefaultConfigParallel=test/e2e/specs/default-config/playwright.config.ts
Manualrecordset=test/manual/specs/recordset.conf.js

# protractor tests
RECORD_TESTS_PROTRACTOR=$(E2EDrecord) $(E2EDrecordLinks)
RECORDSET_TESTS_PROTRACTOR=$(E2EDrecordset) $(E2ErecordsetAdd) $(E2EDrecordsetEdit) $(E2EDrecordsetIndFacet) $(E2EDrecordsetHistFacet)
RECORDADD_TESTS_PROTRACTOR=$(E2EDIrecordAdd) $(E2EDIrecordMultiFormInput) $(E2EDIrecordImmutable) $(E2ErecordEditForeignKeyDropdown)
RECORDEDIT_TESTS_PROTRACTOR=$(E2EDIrecordEdit) $(E2EDIrecordMultiEdit) $(E2EDrecordEditCompositeKey) $(E2EDrecordEditSubmissionDisabled) $(E2EDIrecordEditMultiColTypes) $(E2EDrecordEditDomainFilter)
ERRORS_TESTS_PROTRACTOR=$(E2Eerrors)
RECORD_TESTS_PROTRACTOR=$(E2EDrecordProt)
RECORDSET_TESTS_PROTRACTOR=$(E2EDrecordset) $(E2ErecordsetAdd) $(E2EDrecordsetEdit)
RECORDADD_TESTS_PROTRACTOR=$(E2EDIrecordAdd) $(E2EDIrecordMultiFormInput) $(E2EDIrecordImmutable)
RECORDEDIT_TESTS_PROTRACTOR=$(E2EDIrecordEdit) $(E2EDIrecordMultiEdit) $(E2EDrecordEditSubmissionDisabled) $(E2EDIrecordEditMultiColTypes)
DEFAULT_CONFIG_PARALLEL_TESTS_PROTRACTOR=$(DefaultConfigParallel_PROTRACTOR)
DELETE_PROHIBITED_PARALLEL_TESTS_PROTRACTOR=$(DeleteProhibitedParallel_PROTRACTOR)
ALL_FEATURES_CONFIRMATION_PARALLEL_TESTS_PROTRACTOR=$(AllFeaturesConfirmationParallel_PROTRACTOR)
PARALLEL_TESTS_PROTRACTOR=$(AllFeaturesConfirmationParallel_PROTRACTOR) $(DefaultConfigParallel_PROTRACTOR) $(DeleteProhibitedParallel_PROTRACTOR)
ALL_TESTS_PROTRACTOR=$(RECORD_TESTS_PROTRACTOR) $(RECORDSET_TESTS_PROTRACTOR) $(RECORDADD_TESTS_PROTRACTOR) $(RECORDEDIT_TESTS_PROTRACTOR) $(ERRORS_TESTS_PROTRACTOR)
PARALLEL_TESTS_PROTRACTOR=$(AllFeaturesConfirmationParallel_PROTRACTOR) $(DefaultConfigParallel_PROTRACTOR)
ALL_TESTS_PROTRACTOR=$(RECORD_TESTS_PROTRACTOR) $(RECORDSET_TESTS_PROTRACTOR) $(RECORDADD_TESTS_PROTRACTOR) $(RECORDEDIT_TESTS_PROTRACTOR)

# playwright tests
NAVBAR_TESTS=$(E2Enavbar) $(E2EnavbarHeadTitle) $(E2EnavbarCatalogConfig)
RECORD_TESTS=$(E2ErecordNoDeleteBtn) $(E2EDrecordRelatedTable) $(E2EDrecordCopy)
RECORDSET_TESTS=$(E2ErecordsetSavedQuery)
RECORDADD_TESTS=$(E2EDIrecordMultiFormInput)
RECORDEDIT_TESTS=$(E2ErecordEditInputIframe)
RECORD_TESTS=$(E2EDrecord) $(E2ErecordNoDeleteBtn) $(E2EDrecordRelatedTable) $(E2EDrecordCopy) $(E2EDrecordLinks)
RECORDSET_TESTS=$(E2ErecordsetSavedQuery) $(E2EDrecordsetIndFacet) $(E2EDrecordsetHistFacet)
RECORDADD_TESTS=$(E2EDIrecordMultiFormInput) $(E2ErecordEditForeignKeyDropdown) $(E2EDrecordEditCompositeKey)
RECORDEDIT_TESTS=$(E2ErecordEditInputIframe) $(E2EDrecordEditDomainFilter)
PERMISSIONS_TESTS=$(E2EmultiPermissionsVisibility)
FOOTER_TESTS=$(E2Efooter)
ERRORS_TESTS=
ERRORS_TESTS=$(E2Eerrors)
DEFAULT_CONFIG_PARALLEL_TESTS=$(DefaultConfigParallel)
DELETE_PROHIBITED_PARALLEL_TESTS=$(DeleteProhibitedParallel)
ALL_FEATURES_CONFIRMATION_PARALLEL_TESTS=$(AllFeaturesConfirmationParallel)
Expand Down Expand Up @@ -183,6 +181,14 @@ testrecordset: test-RECORDSET_TESTS
.PHONY: testrecordset-protractor
testrecordset-protractor: test_protractor-RECORDSET_TESTS_PROTRACTOR

#Rule to run the default chaise configuration tests in parallel
.PHONY: testfooter
testfooter: test-FOOTER_TESTS

#Rule to run the default chaise configuration tests in parallel
.PHONY: testerrors
testerrors: test-ERRORS_TESTS

#### Parallel make commands - these commands will run tests in parallel
#Rule to run all parallel test configurations
.PHONY: testparallel
Expand All @@ -206,28 +212,13 @@ testallfeaturesconfirmation-protractor: test_protractor-ALL_FEATURES_CONFIRMATIO
.PHONY: testdeleteprohibited
testdeleteprohibited: test-DELETE_PROHIBITED_PARALLEL_TESTS

.PHONY: testdeleteprohibited-protractor
testdeleteprohibited-protractor: test_protractor-DELETE_PROHIBITED_PARALLEL_TESTS_PROTRACTOR


#Rule to run the default chaise configuration tests in parallel
.PHONY: testdefaultconfig
testdefaultconfig: test-DEFAULT_CONFIG_PARALLEL_TESTS

.PHONY: testdefaultconfig-protractor
testdefaultconfig-protractor: test_protractor-DEFAULT_CONFIG_PARALLEL_TESTS_PROTRACTOR

#Rule to run the default chaise configuration tests in parallel
.PHONY: testfooter
testfooter: test-FOOTER_TESTS

#Rule to run the default chaise configuration tests in parallel
.PHONY: testerrors
testerrors: test-ERRORS_TESTS

.PHONY: testerrors-protractor
testerrors-protractor: test_protractor-ERRORS_TESTS_PROTRACTOR

# Rule to setup schema and data for manual tests
.PHONY: testmanually
testmanually: test_protractor-ALL_MANUAL_TESTS
Expand Down Expand Up @@ -511,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': []
}
2 changes: 2 additions & 0 deletions config/chaise-config-sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

var chaiseConfig = {
name: "Sample",
defaultCatalog: "1",
resolverImplicitCatalog: "1",
allowErrorDismissal: true,
confirmDelete: true,
headTitle: 'Chaise',
Expand Down
34 changes: 34 additions & 0 deletions docs/dev-docs/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This is a guide for people who develop Chaise.
- [Building and installation](#building-and-installation)
* [Make targets](#make-targets)
* [NPM](#npm)
* [Dependabot](#dependabot)
- [Structure of an App](#structure-of-an-app)
- [Using Chaise through npm](#using-chaise-through-npm)
- [Error handling](#error-handling)
Expand Down Expand Up @@ -432,6 +433,39 @@ This section will go over how we think the NPM modules should be managed.
3. Push the changes to the main branch.
4. After pushing the changes, `npm-publish.yml` GitHub workflow will detect the version change and properly publish the new version to npm.

### Dependabot

We're using [dependabot](https://github.com/dependabot) to keep our dependencies up to date. Apart from automated security updates, it will use the [`dependabot.yml`](https://github.com/informatics-isi-edu/chaise/blob/master/.github/dependabot.yml) to figure out which dependencies should be checked for update.

While our goal is to keep all dependencies updated, we don't want the process of updating to hinder our development. We also want to avoid introducing new bugs with the new versions. So, before going through the review process, look at the release notes. If you didn't notice any change worth pushing, consider closing and ignoring that version change. Dependable will eventually create new PRs for newer versions that might be worth merging.

While reviewing a PR that Dependabot opened:

1. Ensure that the GitHub Actions build was successful and had no issues.

3. Grab the branch locally and ensure you can build it using all the Node.js versions that we support:

```
nvm use 18.18
make dist
```
This should not throw any errors and should finish properly.
5. Build and deploy the branch locally with the main Node.js version we support and use on our servers (currently 20.12.2):
```
nvm use 20.12.2
make deps-test
make dist-wo-deps
make deploy
```
6. Run the test cases and manually take a look at the pages if necessary.
7. Depending on the automated or manual test, you might have to make more changes to the code. Push them to the same branch so they can be merged together.
## Structure of an App
Since Chaise is a collection of multiple single-page apps (`recordset`, `record`, `recordedit`, etc.), the app setup will be very similar. This similar structure allowed us to factor out a lot of that common setup code into different bits described below.
Expand Down
22 changes: 21 additions & 1 deletion docs/dev-docs/e2e-test-writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ This section summarizes the best practices for writing test cases in Chaise.
});
});
```
- If your file has multiple independent `test`s that can run in parallel, you can ask playwright to run them in parallel by adding the following:
```ts
test.describe.configure({ mode: 'parallel' });
```
- Don't use this configuration if you have a `beforeAll` or `afterAll` that you want to run only once. Because in this case each worker will run their own `beforeAll` and `afterAll` instead of running it once (https://github.com/microsoft/playwright/issues/28201).
- If your tests must run in order and on the same browser, use the `test.step` method.
- Don't forget to include `await` before each `test.step`.
- Playwright will not run the remaining steps if any of the steps fail. To get around this, you should use `expect.soft`.
Expand Down Expand Up @@ -225,9 +230,18 @@ In here we've listed all the actions that we encountered and we found useful. Pl
// https://playwright.dev/docs/api/class-locator#locator-fill
await locator.fill('new value');

// clear the value of input or textaraea
// clear the value of input or textaraea (PREFERRED)
// https://playwright.dev/docs/api/class-locator#locator-clear
await locator.clear();

// will accomplish the same thing as `clear()`
await locator.fill('');
```
- When filling a value in an input, we want to ensure it is filled afterwards:
```ts
await locator.fill(value);
await expect.soft(locator).toHaveValue(value);
```
- Mouse actions:
Expand All @@ -237,6 +251,12 @@ In here we've listed all the actions that we encountered and we found useful. Pl
await locator.hover();
```
- Checkbox specific:
```ts
// https://playwright.dev/docs/input#checkboxes-and-radio-buttons
await locator.check();
```
### Managing page
- Useful links
Expand Down
8 changes: 8 additions & 0 deletions docs/dev-docs/e2e-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ To debug Playwright tests,
npx playwright test --config CONFIG_LOC --project=NAME_OF_PROEJECT --debug --max-failures=1
```

### Github Actions debugging

There's a chance a test case will fail in github actions only and not locally. This makes it very difficult to reproduce/test without a browser to show what is happening. In github actions, if you download the playwright report, there will be images with the HTML report of the pages when they did fail.

This isn't "perfect" since it captures the state of the browser when the test "ends" not when the test fails. We often have tests written with `test.step` and `expect.soft` which will run tests in sequence and usually not cause later tests to fail just because an earlier one did. More info about screencaps with `test.step` and `expect.soft` in [this github issue](https://github.com/microsoft/playwright/issues/14854).

If there is a suspicion that a test is failing only in github actions, to get an accurate screencap, comment out the rest of the `test.step`s that are after the failing step so that the state during the "failing" test.step will be properly captured.

## Writing test

Please use [this link](e2e-test-writing.md) to find more information about how to write new test cases.
Loading

0 comments on commit 9a8438f

Please sign in to comment.