Skip to content

Commit

Permalink
Merge branch 'master' of github.com:informatics-isi-edu/chaise into f…
Browse files Browse the repository at this point in the history
…acet-within-facet
  • Loading branch information
RFSH committed Apr 30, 2024
2 parents f4f37a9 + c9f57f9 commit 806245d
Show file tree
Hide file tree
Showing 63 changed files with 7,664 additions and 6,288 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ module.exports = {
'react/react-in-jsx-scope': 0,

// ------------------ typescript ------------------
'@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/ban-ts-comment': 'warn',
'@typescript-eslint/no-inferrable-types': 'warn',
Expand Down
37 changes: 37 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
ignore:
- dependency-name: "moment*"
- dependency-name: "protractor"
groups:
babel:
patterns:
- "@babel/*"
- "babel-loader"
bootstrap:
patterns:
- "react-bootstrap"
- "bootstrap"
eslint:
patterns:
- "@typescript-eslint/*"
- "eslint-*"
- "eslint"
react:
patterns:
- "@types/react"
- "@types/react-dom"
- "react"
- "react-dom"
assignees:
- "jrchudy"
- "RFSH"
3 changes: 2 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ jobs:
cd chaise
make deps-test
make dist-wo-deps
make lint
sudo make deploy
- name: Add tests users
run: |
Expand Down Expand Up @@ -216,7 +217,7 @@ jobs:
- name: Check on delete prohibited test spec (protractor)
if: always() && steps.test-protractor-delete-prohibited.outcome != 'success'
run: exit 1
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
Expand Down
32 changes: 12 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,25 @@ E2ErecordEditForeignKeyDropdown=test/e2e/specs/default-config/recordedit/foreign
E2ErecordEditInputIframe=test/e2e/specs/all-features/recordedit/input-iframe.conf.js
# Record tests
E2EDrecord=test/e2e/specs/all-features-confirmation/record/presentation-btn.conf.js
E2EDrecordCopy=test/e2e/specs/all-features/record/copy-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.conf.js
E2EDrecordRelatedTable=test/e2e/specs/all-features/record/related-table.config.ts
E2EDrecordLinks=test/e2e/specs/default-config/record/links.conf.js
# 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.js
E2ErecordsetSavedQuery=test/e2e/specs/all-features/recordset/saved-query.conf.ts

# misc tests
E2Enavbar=test/e2e/specs/all-features/navbar/playwright.config.ts
E2EnavbarHeadTitle=test/e2e/specs/all-features-confirmation/navbar/playwright.config.ts
E2EnavbarCatalogConfig=test/e2e/specs/delete-prohibited/navbar/playwright.config.ts
E2EmultiPermissionsVisibility=test/e2e/specs/all-features/permissions.conf.js
E2EmultiPermissionsVisibility=test/e2e/specs/all-features/permissions.config.ts
# footer test
E2Efooter=test/e2e/specs/all-features-confirmation/footer/protractor.conf.js
E2Efooter=test/e2e/specs/all-features-confirmation/footer/playwright.config.ts
# errors test
E2Eerrors=test/e2e/specs/all-features-confirmation/errors/protractor.conf.js
## Parallel test scripts (protractor)
Expand All @@ -93,28 +93,26 @@ DefaultConfigParallel=test/e2e/specs/default-config/playwright.config.ts
Manualrecordset=test/manual/specs/recordset.conf.js

# protractor tests
RECORD_TESTS_PROTRACTOR=$(E2EDrecord) $(E2EDrecordCopy) $(E2EDrecordLinks)
RECORDSET_TESTS_PROTRACTOR=$(E2EDrecordset) $(E2ErecordsetAdd) $(E2EDrecordsetEdit) $(E2EDrecordsetIndFacet) $(E2EDrecordsetHistFacet) $(E2ErecordsetSavedQuery)
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) $(E2ErecordEditInputIframe)
PERMISSIONS_TESTS_PROTRACTOR=$(E2EmultiPermissionsVisibility)
FOOTER_TESTS_PROTRACTOR=$(E2Efooter)
ERRORS_TESTS_PROTRACTOR=$(E2Eerrors)
DEFAULT_CONFIG_PARALLEL_TESTS_PROTRACTOR=$(DefaultConfigParallel_PROTRACTOR)
DELETE_PROHIBITED_PARALLEL_TESTS_PROTRACTOR=$(DeleteProhibitedParallel_PROTRACTOR)
ALL_FEATURES_CONFIRMATION_PARALLEL_TESTS_PROTRACTOR=$(AllFeaturesConfirmationParallel_PROTRACTOR)
ALL_FEATURES_PARALLEL_TESTS_PROTRACTOR=$(AllFeaturesParallel_PROTRACTOR)
PARALLEL_TESTS_PROTRACTOR=$(AllFeaturesConfirmationParallel_PROTRACTOR) $(DefaultConfigParallel_PROTRACTOR) $(AllFeaturesParallel_PROTRACTOR) $(DeleteProhibitedParallel_PROTRACTOR)
ALL_TESTS_PROTRACTOR=$(RECORD_TESTS_PROTRACTOR) $(RECORDSET_TESTS_PROTRACTOR) $(RECORDADD_TESTS_PROTRACTOR) $(RECORDEDIT_TESTS_PROTRACTOR) $(PERMISSIONS_TESTS_PROTRACTOR) $(FOOTER_TESTS_PROTRACTOR) $(ERRORS_TESTS_PROTRACTOR)
ALL_TESTS_PROTRACTOR=$(RECORD_TESTS_PROTRACTOR) $(RECORDSET_TESTS_PROTRACTOR) $(RECORDADD_TESTS_PROTRACTOR) $(RECORDEDIT_TESTS_PROTRACTOR) $(ERRORS_TESTS_PROTRACTOR)

# playwright tests
NAVBAR_TESTS=$(E2Enavbar) $(E2EnavbarHeadTitle) $(E2EnavbarCatalogConfig)
RECORD_TESTS=$(E2ErecordNoDeleteBtn) $(E2EDrecordRelatedTable)
RECORDSET_TESTS=
RECORD_TESTS=$(E2ErecordNoDeleteBtn) $(E2EDrecordRelatedTable) $(E2EDrecordCopy)
RECORDSET_TESTS=$(E2ErecordsetSavedQuery)
RECORDADD_TESTS=$(E2EDIrecordMultiFormInput)
RECORDEDIT_TESTS=
PERMISSIONS_TESTS=
FOOTER_TESTS=
PERMISSIONS_TESTS=$(E2EmultiPermissionsVisibility)
FOOTER_TESTS=$(E2Efooter)
ERRORS_TESTS=
DEFAULT_CONFIG_PARALLEL_TESTS=$(DefaultConfigParallel)
DELETE_PROHIBITED_PARALLEL_TESTS=$(DeleteProhibitedParallel)
Expand Down Expand Up @@ -180,9 +178,6 @@ testrecordedit-protractor: test_protractor-RECORDEDIT_TESTS_PROTRACTOR
.PHONY: testpermissions
testpermissions:test-PERMISSIONS_TESTS

.PHONY: testpermissions-protractor
testpermissions-protractor:test_protractor-PERMISSIONS_TESTS_PROTRACTOR

#Rule to run recordset app tests
.PHONY: testrecordset
testrecordset: test-RECORDSET_TESTS
Expand Down Expand Up @@ -231,9 +226,6 @@ testdefaultconfig-protractor: test_protractor-DEFAULT_CONFIG_PARALLEL_TESTS_PROT
.PHONY: testfooter
testfooter: test-FOOTER_TESTS

.PHONY: testfooter-protractor
testfooter-protractor: test_protractor-FOOTER_TESTS_PROTRACTOR

#Rule to run the default chaise configuration tests in parallel
.PHONY: testerrors
testerrors: test-ERRORS_TESTS
Expand Down
27 changes: 25 additions & 2 deletions docs/dev-docs/e2e-test-writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ This section summarizes the best practices for writing test cases in Chaise.
await expect(page.locator('ul > li')).toHaveText(['Text 1', 'Text 2', 'Text 3']);
```
- Alternative for testing inner text of an element ([reference](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-contain-text)):
```ts
// partial match using contains
await expect.soft(title).toContainText('Data Collect');
```
- If you want to test element classes ([reference](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-class)):
```ts
Expand All @@ -179,17 +185,34 @@ This section summarizes the best practices for writing test cases in Chaise.
await expect.soft(input).toHaveClass('input-disabled');
```
- If you want to test value inside of an input ([reference](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-value)):
```ts
// partial regex match
await expect.soft(input).toHaveValue(/input\-value/);

// full match
await expect.soft(input).toHaveValue('input-value');

// this works too but avoid using it if possible
await expect.soft(input).toHaveAttribute('value', 'input-value');
```
- Test DOM attributes ([reference](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-attribute)):
```ts
// prefered
await expect(link).toHaveAttribute('href', regexOrFullString);

// if you cannot come up with a proper regex, do this. but generally toHaveAttribute is much better
expect(await link.getAttribute('href')).toContain(partialExpected)
```
- Test `innerHTML`:
// avoid using `.innerHTML` or getAttribute('innerHTML'
```ts
expect(await link.innerHTML()).toContain(partialExpected);
expect(await link.innerHTML()).toBe(fullString);
expect(await link.innerHTML()).toBe(expected);
```
### Actions
Expand Down
Loading

0 comments on commit 806245d

Please sign in to comment.