@nextsparkjs/theme-default 0.1.0-beta.38 → 0.1.0-beta.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/components/ai-chat/ChatPanel.tsx +1 -1
  2. package/components/ai-chat/Message.tsx +1 -1
  3. package/components/ai-chat/MessageInput.tsx +1 -1
  4. package/components/ai-chat/MessageList.tsx +1 -1
  5. package/components/ai-chat/TypingIndicator.tsx +1 -1
  6. package/lib/selectors.ts +2 -3
  7. package/package.json +3 -2
  8. package/tests/cypress/e2e/api/_core/billing/BillingAPIController.js +1 -1
  9. package/tests/cypress/e2e/api/_core/settings/api-keys.crud.cy.ts +1 -1
  10. package/tests/cypress/e2e/api/_core/users/users-crud.cy.ts +1 -1
  11. package/tests/cypress/e2e/api/_core/users/users-metas.cy.ts +1 -1
  12. package/tests/cypress/e2e/api/entities/customers/customers-crud.cy.ts +1 -1
  13. package/tests/cypress/e2e/api/entities/customers/customers-metas.cy.ts +1 -1
  14. package/tests/cypress/e2e/api/entities/tasks/tasks-crud.cy.ts +1 -1
  15. package/tests/cypress/e2e/api/entities/tasks/tasks-metas.cy.ts +1 -1
  16. package/tests/cypress/e2e/uat/_core/teams/team-switcher.md +2 -2
  17. package/tests/cypress/src/core/BasePOM.ts +23 -76
  18. package/tests/cypress/src/core/DashboardEntityPOM.ts +17 -668
  19. package/tests/cypress/src/entities/TasksPOM.ts +70 -0
  20. package/tests/cypress/src/helpers/ApiInterceptor.ts +14 -171
  21. package/tests/cypress.config.ts +12 -17
  22. package/tests/cypress/e2e/_utils/docs/tutorials/sector7-superadmin-teams.narration.json +0 -155
  23. package/tests/cypress/e2e/_utils/docs/tutorials/sector7-superadmin.cy.ts +0 -390
  24. package/tests/cypress/e2e/_utils/docs/tutorials/teams-system.doc.cy.ts +0 -349
  25. package/tests/cypress/e2e/_utils/docs/tutorials/teams-system.narration.json +0 -165
@@ -8,7 +8,7 @@ import { MessageInput } from './MessageInput'
8
8
  import { MarkdownRenderer } from './MarkdownRenderer'
9
9
  import { TypingIndicator } from './TypingIndicator'
10
10
  import { ConversationSidebar } from './ConversationSidebar'
11
- import { createCyId } from '@nextsparkjs/core/lib/testing-utils'
11
+ import { createCyId } from '@nextsparkjs/testing/utils'
12
12
  import { cn } from '@nextsparkjs/core/lib/utils'
13
13
  import { Bot, User, Loader2, Trash2, ListTodo, Users, FileText, Sparkles, X } from 'lucide-react'
14
14
  import type { ConversationInfo } from '../../lib/hooks/useConversations'
@@ -2,7 +2,7 @@ import { cn } from '@nextsparkjs/core/lib/utils'
2
2
  import { Message as MessageType } from '../../lib/hooks/useAiChat'
3
3
  import { MarkdownRenderer } from './MarkdownRenderer'
4
4
  import { User, Bot } from 'lucide-react'
5
- import { createCyId } from '@nextsparkjs/core/lib/testing-utils'
5
+ import { createCyId } from '@nextsparkjs/testing/utils'
6
6
 
7
7
  interface MessageProps {
8
8
  message: MessageType
@@ -2,7 +2,7 @@ import { KeyboardEvent } from 'react'
2
2
  import { Button } from '@nextsparkjs/core/components/ui/button'
3
3
  import { Textarea } from '@nextsparkjs/core/components/ui/textarea'
4
4
  import { Send } from 'lucide-react'
5
- import { createCyId } from '@nextsparkjs/core/lib/testing-utils'
5
+ import { createCyId } from '@nextsparkjs/testing/utils'
6
6
 
7
7
  interface MessageInputProps {
8
8
  value: string
@@ -3,7 +3,7 @@ import { ScrollArea } from '@nextsparkjs/core/components/ui/scroll-area'
3
3
  import { Message as MessageType } from '../../lib/hooks/useAiChat'
4
4
  import { Message } from './Message'
5
5
  import { TypingIndicator } from './TypingIndicator'
6
- import { createCyId } from '@nextsparkjs/core/lib/testing-utils'
6
+ import { createCyId } from '@nextsparkjs/testing/utils'
7
7
 
8
8
  interface MessageListProps {
9
9
  messages: MessageType[]
@@ -1,4 +1,4 @@
1
- import { createCyId } from '@nextsparkjs/core/lib/testing-utils'
1
+ import { createCyId } from '@nextsparkjs/testing/utils'
2
2
 
3
3
  export function TypingIndicator() {
4
4
  return (
package/lib/selectors.ts CHANGED
@@ -9,8 +9,7 @@
9
9
  * - Cypress tests (via tests/cypress/src/selectors.ts)
10
10
  */
11
11
 
12
- import { createSelectorHelpers } from '@nextsparkjs/core/lib/test/selector-factory'
13
- import { CORE_SELECTORS } from '@nextsparkjs/core/lib/test/core-selectors'
12
+ import { createSelectorHelpers, CORE_SELECTORS } from '@nextsparkjs/testing/selectors'
14
13
 
15
14
  // =============================================================================
16
15
  // BLOCK SELECTORS
@@ -197,5 +196,5 @@ export const entitySelectors = helpers.entitySelectors
197
196
  */
198
197
  export type ThemeSelectorsType = typeof THEME_SELECTORS
199
198
  export type BlockSelectorsType = typeof BLOCK_SELECTORS
200
- export type { Replacements } from '@nextsparkjs/core/lib/test/selector-factory'
199
+ export type { Replacements } from '@nextsparkjs/testing/selectors'
201
200
  export { CORE_SELECTORS }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextsparkjs/theme-default",
3
- "version": "0.1.0-beta.38",
3
+ "version": "0.1.0-beta.40",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./config/theme.config.ts",
@@ -17,7 +17,8 @@
17
17
  "react-dom": "^19.0.0",
18
18
  "react-markdown": "^10.1.0",
19
19
  "zod": "^4.0.0",
20
- "@nextsparkjs/core": "0.1.0-beta.38"
20
+ "@nextsparkjs/core": "0.1.0-beta.40",
21
+ "@nextsparkjs/testing": "0.1.0-beta.40"
21
22
  },
22
23
  "nextspark": {
23
24
  "type": "theme",
@@ -6,7 +6,7 @@
6
6
  * - API Key with appropriate scopes (or superadmin with *)
7
7
  * - x-team-id header for team context
8
8
  */
9
- const BaseAPIController = require('../../../src/controllers/BaseAPIController')
9
+ const BaseAPIController = require('../../../../src/controllers/BaseAPIController')
10
10
 
11
11
  class BillingAPIController extends BaseAPIController {
12
12
  /**
@@ -12,7 +12,7 @@
12
12
 
13
13
  import * as allure from 'allure-cypress'
14
14
 
15
- const ApiKeysAPIController = require('../../../src/controllers/ApiKeysAPIController.js')
15
+ const ApiKeysAPIController = require('../../../../src/controllers/ApiKeysAPIController.js')
16
16
 
17
17
  describe('API Keys API - CRUD Operations', {
18
18
  tags: ['@api', '@feat-api-keys', '@crud', '@security', '@regression']
@@ -9,7 +9,7 @@
9
9
 
10
10
  import * as allure from 'allure-cypress'
11
11
 
12
- const UsersAPIController = require('../../../src/controllers/UsersAPIController.js')
12
+ const UsersAPIController = require('../../../../src/controllers/UsersAPIController.js')
13
13
 
14
14
  describe('Users API - CRUD Operations', {
15
15
  tags: ['@api', '@feat-users', '@crud', '@regression']
@@ -10,7 +10,7 @@
10
10
 
11
11
  import * as allure from 'allure-cypress'
12
12
 
13
- const UsersAPIController = require('../../../src/controllers/UsersAPIController.js')
13
+ const UsersAPIController = require('../../../../src/controllers/UsersAPIController.js')
14
14
 
15
15
  describe('Users API - Metadata Tests', {
16
16
  tags: ['@api', '@feat-users', '@metas', '@regression']
@@ -14,7 +14,7 @@
14
14
 
15
15
  import * as allure from 'allure-cypress'
16
16
 
17
- const CustomerAPIController = require('../../../src/controllers/CustomerAPIController.js')
17
+ const CustomerAPIController = require('../../../../src/controllers/CustomerAPIController.js')
18
18
 
19
19
  describe('Customers API - CRUD Operations', {
20
20
  tags: ['@api', '@feat-customers', '@crud', '@regression']
@@ -10,7 +10,7 @@
10
10
 
11
11
  import * as allure from 'allure-cypress'
12
12
 
13
- const CustomerAPIController = require('../../../src/controllers/CustomerAPIController.js')
13
+ const CustomerAPIController = require('../../../../src/controllers/CustomerAPIController.js')
14
14
 
15
15
  describe('Customers API - Metadata Operations', {
16
16
  tags: ['@api', '@feat-customers', '@metas', '@regression']
@@ -9,7 +9,7 @@
9
9
 
10
10
  import * as allure from 'allure-cypress'
11
11
 
12
- const TaskAPIController = require('../../../src/controllers/TaskAPIController.js')
12
+ const TaskAPIController = require('../../../../src/controllers/TaskAPIController.js')
13
13
 
14
14
  describe('Tasks API - CRUD Operations', {
15
15
  tags: ['@api', '@feat-tasks', '@crud', '@regression']
@@ -10,7 +10,7 @@
10
10
 
11
11
  import * as allure from 'allure-cypress'
12
12
 
13
- const TaskAPIController = require('../../../src/controllers/TaskAPIController.js')
13
+ const TaskAPIController = require('../../../../src/controllers/TaskAPIController.js')
14
14
 
15
15
  describe('Tasks API - Metadata Operations', {
16
16
  tags: ['@api', '@feat-tasks', '@metas', '@regression']
@@ -142,7 +142,7 @@ To enable pending tests, add these attributes:
142
142
 
143
143
  ## POM Class
144
144
 
145
- **Path:** `test/cypress/src/classes/components/teams/TeamSwitcher.js`
145
+ **Path:** `cypress/src/components/TeamSwitcher.ts`
146
146
 
147
147
  ### Key Methods
148
148
 
@@ -195,4 +195,4 @@ Tests use `cy.session()` for performance:
195
195
 
196
196
  - `core/components/teams/TeamSwitcherCompact.tsx` - Main component
197
197
  - `core/components/teams/TeamSwitchModal.tsx` - Transition modal
198
- - `test/cypress/src/classes/components/teams/TeamSwitcher.js` - POM class
198
+ - `cypress/src/components/TeamSwitcher.ts` - POM class
@@ -1,85 +1,32 @@
1
1
  /**
2
- * BasePOM - Base class with common utilities for all Page Object Models
2
+ * BasePOM - Theme-specific base class for Page Object Models
3
3
  *
4
- * Provides:
5
- * - Selector pattern replacement for {placeholder} patterns
6
- * - Wrapper methods for common Cypress operations
7
- * - Fluent interface support (methods return `this`)
4
+ * Extends BasePOMCore from @nextsparkjs/testing and implements
5
+ * the abstract cySelector method with theme-specific selectors.
6
+ *
7
+ * @example Usage in feature POMs:
8
+ * ```ts
9
+ * import { BasePOM } from './BasePOM'
10
+ *
11
+ * class MyFeaturePOM extends BasePOM {
12
+ * get elements() {
13
+ * return {
14
+ * button: this.cy('myFeature.button'),
15
+ * }
16
+ * }
17
+ * }
18
+ * ```
8
19
  */
9
- import { cySelector as cySel, type Replacements } from '../selectors'
10
-
11
- export abstract class BasePOM {
12
- /**
13
- * Replaces placeholders in a selector pattern and wraps with data-cy attribute
14
- * @deprecated Use cySelector() from selectors.ts instead
15
- * @param pattern - Selector pattern with {placeholder} syntax
16
- * @param replacements - Object with placeholder values
17
- * @returns Formatted data-cy selector string
18
- *
19
- * @example
20
- * selector('{slug}-row-{id}', { slug: 'tasks', id: '123' })
21
- * // Returns: '[data-cy="tasks-row-123"]'
22
- */
23
- protected selector(pattern: string, replacements: Record<string, string> = {}): string {
24
- let result = pattern
25
- for (const [key, value] of Object.entries(replacements)) {
26
- result = result.replaceAll(`{${key}}`, value)
27
- }
28
- return `[data-cy="${result}"]`
29
- }
30
-
31
- /**
32
- * Get a Cypress selector using the centralized selectors
33
- * @param path - Dot-notation path to the selector (e.g., "auth.login.form")
34
- * @param replacements - Optional placeholder replacements
35
- * @returns Cypress selector string like [data-cy="selector-value"]
36
- *
37
- * @example
38
- * this.cy('auth.login.form')
39
- * // Returns: '[data-cy="login-form"]'
40
- *
41
- * this.cy('entities.table.row', { slug: 'tasks', id: '123' })
42
- * // Returns: '[data-cy="tasks-row-123"]'
43
- */
44
- protected cy(path: string, replacements?: Replacements): string {
45
- return cySel(path, replacements)
46
- }
47
-
48
- /**
49
- * Wrapper for cy.get with selector pattern support
50
- * @param pattern - Selector pattern or direct selector
51
- * @param replacements - Optional placeholder replacements
52
- */
53
- protected get(pattern: string, replacements: Record<string, string> = {}) {
54
- return cy.get(this.selector(pattern, replacements))
55
- }
56
-
57
- /**
58
- * Generic wait with configurable timeout
59
- * @param selector - CSS selector to wait for
60
- * @param timeout - Max wait time in ms (default: 15000)
61
- */
62
- protected waitFor(selector: string, timeout = 15000) {
63
- cy.get(selector, { timeout }).should('be.visible')
64
- return this
65
- }
66
-
67
- /**
68
- * Wait for URL to contain a specific path
69
- * @param path - Path segment to check for
70
- */
71
- protected waitForUrl(path: string) {
72
- cy.url().should('include', path)
73
- return this
74
- }
20
+ import { BasePOMCore, type Replacements } from '@nextsparkjs/testing/pom'
21
+ import { cySelector } from '../selectors'
75
22
 
23
+ export abstract class BasePOM extends BasePOMCore {
76
24
  /**
77
- * Wait for URL to match a regex pattern
78
- * @param pattern - RegExp to match against URL
25
+ * Implement abstract method from BasePOMCore
26
+ * Uses theme-specific selectors (THEME_SELECTORS)
79
27
  */
80
- protected waitForUrlMatch(pattern: RegExp) {
81
- cy.url().should('match', pattern)
82
- return this
28
+ protected cySelector(path: string, replacements?: Replacements): string {
29
+ return cySelector(path, replacements)
83
30
  }
84
31
  }
85
32