|
No.
|
Steps
|
Data
|
Expected results
|
| 1
|
Click on the hamburger menu if the navigation panel is not visible
|
|
Navigation panel is visible
|
| 2
|
Click on the “Mongoose Resources” → Complicated link inside the navigation panel
|
|
User should be redirected to the “.../admin/resources/Complicated” page
|
| 3
|
Hide the navigation panel if you launch it via hamburger menu
|
|
Navigation panel is not visible. Hamburger menu is visible
|
| 4
|
Click on the “Create new” button
|
|
The form is visible. User should be on the “.../admin/resources/Complicated/actions/new” page
|
| 5
|
Fill the “Name” input element with a random value
|
e.g. Alex
|
The field has been completed
|
| 6
|
Click on the “Add New Item” button in the “String Array” section
|
|
A text input element and bin icon are shown
|
| 7
|
Click on the bin icon
|
|
The text input element was removed
|
| 8
|
Click on the “Add New Item” button again in the “String Array” section
|
|
A text input element and bin icon are shown again
|
| 9
|
Fill the text input element with a random value
|
e.g. String Array
|
The field has been completed
|
| 10
|
Click on the “Add New Item” button in the “Authors” section
|
|
A text input element and bin icon are shown
|
| 11
|
Choose one of the elements from the dropdown list
|
e.g. Books
|
The field has been completed
|
| 12
|
Fill the “Nested Details Age” input element with a random value
|
e.g. 26
|
The field has been completed
|
| 13
|
Fill the “Nested Details Height” input element with a random value
|
e.g. 187
|
The field has been completed
|
| 14
|
Fill the “Nested Details Place Of Birth” input element with a random value
|
e.g. Warsaw
|
The field has been completed
|
| 15
|
Fill the “Nested Details Place Of Birth” input element with a random value
|
e.g. Extremely Nested Text
|
The field has been completed
|
| 16
|
Click on the “Add New Item” button in the “Parents” section
|
|
Two text input elements (“Parents Name”, “Parents Surname”) and the bin icon are shown
|
| 17
|
Fill the “Parents Name” input element with a random value
|
e.g. Harry
|
The field has been completed
|
| 18
|
Fill the “Parents Surname” input element with a random value
|
e.g. Potter
|
The field has been completed
|
| 19
|
Click on the “Add New Item” button in the “Item” section
|
|
The “Item Image Variants” section with a new button “Add New Item” and the bin icon are shown
|
| 20
|
Click on the “Add New Item” button in the “Item Image Variants” section
|
|
Two input elements, two checkboxes and a new bin icon are shown
|
| 21
|
Fill the “Item Image Variants Image URL” input element with a random value
|
e.g. www.google.com
|
The field has been completed
|
| 22
|
Check the checkbox “Item Image Variants Is Approved”
|
|
The checkbox is checked
|
| 23
|
Set the random date and time from the picker in “Item Image Variants Date Created” input element
|
|
The field has been completed
|
| 24
|
Click on the “Save” button
|
|
User is redirected to the “.../admin/resources/Complicated” page. The toast message: “Successfully created a new record” is shown
|
| 25
|
Look at the number of the elements on the list
|
|
The number is increased by 1
|
| 26
|
Look at your new element on the list
|
|
Your element should be at the top of the list
|
| 27
|
Look at values in each column in your element
|
|
Users should see provided data in each related column. Columns “String Array”, “Authors”, “Parents” and “Item” show information about quantity. In this case “length: 1”. Column “Id” has a random string. Column “Updated At” shows time and date of creating
|
## Test suite: Sequelize Resources filters
### SRF-1: Filter elements on the “Favorite Places” list
**Test description:** Verify if a user will be able to filter elements on the list
**Type:** Functional
**Priority:** Medium
**Severity:** Normal
**Behavior:** Positive
**Automation status:** To be automated
**Tags:** sequelize_resources, favorite_places_category, favorite_places_filters, filters
#### Precondition
* User is already logged into the application
|
No.
|
Steps
|
Data
|
Expected results
|
| 1
|
Click on the hamburger menu if the navigation panel is not visible
|
|
Navigation panel is visible
|
| 2
|
Click on the “Sequelize Resources” → Favourite Places link inside the navigation panel
|
|
User should be redirected to the “.../admin/resources/FavouritePlaces” page
|
| 3
|
Hide the navigation panel if you launch it via hamburger menu
|
|
Navigation panel is not visible. Hamburger menu is visible
|
| 4
|
If there is no any elements on the list, create at least two elements with random data
|
|
The elements are visible on the list
|
| 5
|
Click on the “Filter” button
|
|
The filters section with form is visible
|
| 6
|
Fill the “Name” input element with the name from e.g. the first element on the list
|
|
The field has been completed
|
| 7
|
Click on the “Apply changes” button inside the filters section
|
|
On the list should be visible only elements with the name inserted in the filter input
|
| 8
|
Click on the “Reset” button inside the filters section
|
|
Inside the list all elements should be visible
|
| 9
|
Fill the “Id” input element with the Id from e.g. the first element on the list
|
|
The field has been completed
|
| 10
|
Click on the “Apply changes” button inside the filters section
|
|
On the list should be visible only elements with the Id inserted in the filter input
|
| 11
|
Click on the “Reset” button inside the filters section
|
|
Inside the list all elements should be visible
|
| 12
|
Choose one of the elements from the “User Id” dropdown element with the User Id from e.g. the first element on the list
|
|
The field has been completed
|
| 13
|
Click on the “Apply changes” button inside the filters section
|
|
On the list should be visible only elements with the User Id inserted in the filter input
|
| 14
|
Click on the “Reset” button inside the filters section
|
|
Inside the list all elements should be visible
|
| 15
|
Choose the dates “From” and “To” that first element’s “published At” field on the list is in the range of them
|
|
The fields have been completed
|
| 16
|
Click on the “Apply changes” button inside he filters section
|
|
On the list should be visible only elements with “Published At” date and time in the range of the filters
|
| 17
|
Click on the “Reset” button inside the filters section
|
|
Inside the list all elements should be visible
|
| 18
|
Fill the “Description” input element with the word from the column “Description” from e.g. the first element on the list
|
|
The field has been completed
|
| 19
|
Click on the “Apply changes” button inside the filters section
|
|
On the list should be visible only elements with “Description” field which include the word from the filter input element
|
| 20
|
Click on the “Reset” button inside the filters section
|
|
Inside the list all elements should be visible
|
================================================
FILE: index.d.ts
================================================
import AdminJS from './types/src/index.js'
import { ReduxState } from './types/src/frontend/store/store.js'
export * from './types/src/index.js'
export {
AdminJS,
ReduxState,
}
export default AdminJS
declare const REDUX_STATE: ReduxState
================================================
FILE: index.js
================================================
import AdminJS from './lib/index.js'
export * from './lib/index.js'
export {
AdminJS,
}
export default AdminJS
================================================
FILE: package.json
================================================
{
"name": "adminjs",
"version": "7.8.17",
"description": "Admin panel for apps written in node.js",
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./index.js"
},
"./bundler": "./lib/backend/bundler/index.js"
},
"scripts": {
"test": "mocha --loader=ts-node/esm ./spec/index.js",
"types": "tsc",
"clean": "rm -rf lib && mkdir lib && rm -fr types && mkdir types",
"build": "babel src --out-dir lib --copy-files --extensions '.ts,.js,.jsx,.tsx'",
"lint": "eslint './spec/**/*' './src/**/*' './cy/**/*' './*'",
"cover": "NODE_ENV=test nyc --reporter=lcov --reporter=text-lcov npm test",
"codecov": "NODE_ENV=test nyc --reporter=text-lcov npm test | codecov --pipe",
"bundle": "node bin/app.js",
"bundle:globals": "node bin/globals.js",
"cspell": "cspell src/**/*.ts src/**/*.js src/**/*.tsx src/**/*.jsx",
"check:all": "yarn types && yarn cspell && yarn lint && yarn test && yarn bundle && NODE_ENV=production yarn bundle",
"dev": "yarn build && yarn types && yarn bundle:globals && yarn bundle && NODE_ENV=production yarn bundle:globals && NODE_ENV=production yarn bundle",
"release": "semantic-release"
},
"bin": {
"admin": "./cli.js"
},
"nyc": {
"exclude": [
"spec",
"example-app",
"src/**/*.spec.ts",
"src/**/*.spec.js",
"src/**/*.spec.tsx",
"src/**/*.spec.jsx",
"src/**/*.factory.ts",
"src/backend/bundler/user-components-bundler.ts",
"docs",
"coverage",
"types",
"src/frontend/assets/scripts",
"lib",
".vscode",
".github",
"**/*.spec.js"
],
"all": true,
"extension": [
".js",
".jsx",
".tsx",
".ts"
]
},
"repository": {
"type": "git",
"url": "https://github.com/SoftwareBrothers/adminjs.git"
},
"engines": {
"node": ">=16.0.0"
},
"keywords": [
"hapi",
"express",
"mongoose",
"admin",
"admin-panel"
],
"browserslist": [
"last 5 Chrome versions"
],
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"author": "Wojciech Krysiak",
"license": "MIT",
"bugs": {
"url": "https://github.com/SoftwareBrothers/adminjs/issues"
},
"homepage": "https://github.com/SoftwareBrothers/adminjs#readme",
"dependencies": {
"@adminjs/design-system": "^4.1.0",
"@babel/core": "^7.23.9",
"@babel/parser": "^7.23.9",
"@babel/plugin-syntax-import-assertions": "^7.23.3",
"@babel/plugin-transform-runtime": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@babel/register": "^7.23.7",
"@hello-pangea/dnd": "^16.2.0",
"@redux-devtools/extension": "^3.2.5",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"axios": "^1.3.4",
"commander": "^10.0.0",
"flat": "^5.0.2",
"i18next": "^22.4.13",
"i18next-browser-languagedetector": "^7.0.1",
"i18next-http-backend": "^2.2.0",
"lodash": "^4.17.21",
"ora": "^6.2.0",
"prop-types": "^15.8.1",
"punycode": "^2.3.0",
"qs": "^6.11.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-feather": "^2.0.10",
"react-i18next": "^12.2.0",
"react-is": "^18.2.0",
"react-redux": "^8.0.5",
"react-router": "^6.9.0",
"react-router-dom": "^6.9.0",
"redux": "^4.2.1",
"regenerator-runtime": "^0.14.1",
"rollup": "^4.11.0",
"rollup-plugin-esbuild-minify": "^1.1.1",
"rollup-plugin-polyfill-node": "^0.13.0",
"slash": "^5.0.0",
"uuid": "^9.0.0",
"xss": "^1.0.14"
},
"devDependencies": {
"@babel/cli": "^7.23.9",
"@commitlint/cli": "^17.5.0",
"@commitlint/config-conventional": "^17.4.4",
"@semantic-release/git": "^10.0.1",
"@testing-library/react": "^14.0.0",
"@types/babel-core": "^6.25.10",
"@types/chai": "^4.3.4",
"@types/chai-as-promised": "^7.1.5",
"@types/factory-girl": "^5.0.8",
"@types/flat": "^5.0.2",
"@types/lodash": "^4.14.194",
"@types/mocha": "^10.0.1",
"@types/node": "^20.6.0",
"@types/qs": "^6.9.7",
"@types/react": "^18.0.35",
"@types/react-dom": "^18.0.11",
"@types/sinon": "^10.0.13",
"@types/sinon-chai": "^3.2.9",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"babel-plugin-module-resolver": "^5.0.0",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"chai-change": "^2.1.2",
"core-js": "^3.36.0",
"cspell": "^6.30.2",
"eslint": "^8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"factory-girl": "^5.0.4",
"husky": "^8.0.3",
"jsdom": "^21.1.1",
"jsdom-global": "^3.0.2",
"mocha": "^10.2.0",
"node-esm-import-all": "^1.0.0",
"npm-run-all": "^4.1.5",
"semantic-release": "^20.1.3",
"sinon": "^15.0.2",
"sinon-chai": "^3.7.0",
"ts-node": "10.8.1",
"typescript": "^5.3.3"
},
"resolutions": {
"react-redux": "8.0.5",
"redux": "4.2.1"
}
}
================================================
FILE: project.inlang/project_id
================================================
ed92cfe9d9d26d48639c434e4f5ddd645dfbd5ecaac14329f8b042b5546fd3a9
================================================
FILE: project.inlang/settings.json
================================================
{
"$schema": "https://inlang.com/schema/project-settings",
"sourceLanguageTag": "en",
"languageTags": [
"en", "es", "it", "ja", "pl", "pt-BR", "ua", "zh-CN"
],
"modules": [
"https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@4/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js"
],
"plugin.inlang.i18next": {
"pathPattern": "./src/locale/{languageTag}/translation.json"
}
}
================================================
FILE: spec/backend/helpers/helper-stub.ts
================================================
import sinon from 'sinon'
import ViewHelpers from '../../../src/backend/utils/view-helpers/view-helpers.js'
export const expectedResult = {
recordActionUrl: '#recordActionUrl',
resourceActionUrl: '#resourceActionUrl',
bulkActionUrl: '#bulkActionUrl',
loginUrl: 'loginUrl',
logoutUrl: 'logoutUrl',
rootUrl: 'admin',
assetPath: 'assetPath',
resourceUrl: 'resourceUrl',
dashboardUrl: 'dashboardUrl',
pageUrl: 'pageUrl',
editUrl: 'editUrl',
showUrl: 'showUrl',
deleteUrl: 'deleteUrl',
newUrl: 'newUrl',
listUrl: 'listUrl',
bulkDeleteUrl: 'bulkDeleteUrl',
}
export default (): ViewHelpers => (
{
options: {
loginPath: expectedResult.loginUrl,
logoutPath: expectedResult.logoutUrl,
rootPath: expectedResult.rootUrl,
},
recordActionUrl: sinon.stub().returns(expectedResult.recordActionUrl),
resourceActionUrl: sinon.stub().returns(expectedResult.resourceActionUrl),
bulkActionUrl: sinon.stub().returns(expectedResult.bulkActionUrl),
urlBuilder: sinon.stub(),
loginUrl: sinon.stub().returns(expectedResult.loginUrl),
logoutUrl: sinon.stub().returns(expectedResult.logoutUrl),
assetPath: sinon.stub().returns(expectedResult.assetPath),
resourceUrl: sinon.stub().returns(expectedResult.resourceUrl),
dashboardUrl: sinon.stub().returns(expectedResult.dashboardUrl),
pageUrl: sinon.stub().returns(expectedResult.pageUrl),
editUrl: sinon.stub().returns(expectedResult.editUrl),
showUrl: sinon.stub().returns(expectedResult.showUrl),
deleteUrl: sinon.stub().returns(expectedResult.deleteUrl),
newUrl: sinon.stub().returns(expectedResult.newUrl),
listUrl: sinon.stub().returns(expectedResult.listUrl),
bulkDeleteUrl: sinon.stub().returns(expectedResult.bulkDeleteUrl),
}
)
================================================
FILE: spec/backend/helpers/resource-stub.ts
================================================
import sinon from 'sinon'
import BaseProperty from '../../../src/backend/adapters/property/base-property.js'
import BaseResource from '../../../src/backend/adapters/resource/base-resource.js'
import ResourceDecorator from '../../../src/backend/decorators/resource/resource-decorator.js'
/**
* returns properties with following absolute paths:
* - normal: number
* - nested: mixed
* - nested.normal: string
* - nested.nested: mixed
* - nested.nested.normalInner: string
* - arrayed: string (array)
* - arrayedMixed: mixed (array)
* - arrayedMixed.arrayParam: string
*
* @private
*/
const buildProperties = (): Array