create-appraisejs 0.1.9 → 0.1.10-alpha.1

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 (159) hide show
  1. package/README.md +24 -17
  2. package/dist/cli.d.ts +2 -1
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.e2e.test.js +11 -8
  5. package/dist/cli.e2e.test.js.map +1 -1
  6. package/dist/cli.js +32 -48
  7. package/dist/cli.js.map +1 -1
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/config.js +5 -1
  10. package/dist/config.js.map +1 -1
  11. package/dist/config.test.js +9 -5
  12. package/dist/config.test.js.map +1 -1
  13. package/dist/copy-template.d.ts +1 -1
  14. package/dist/copy-template.d.ts.map +1 -1
  15. package/dist/copy-template.js +7 -3
  16. package/dist/copy-template.js.map +1 -1
  17. package/dist/copy-template.test.js +14 -9
  18. package/dist/copy-template.test.js.map +1 -1
  19. package/dist/create-project.d.ts +23 -0
  20. package/dist/create-project.d.ts.map +1 -0
  21. package/dist/create-project.js +58 -0
  22. package/dist/create-project.js.map +1 -0
  23. package/dist/create-project.test.d.ts +2 -0
  24. package/dist/create-project.test.d.ts.map +1 -0
  25. package/dist/create-project.test.js +80 -0
  26. package/dist/create-project.test.js.map +1 -0
  27. package/dist/install.d.ts +8 -4
  28. package/dist/install.d.ts.map +1 -1
  29. package/dist/install.js +22 -72
  30. package/dist/install.js.map +1 -1
  31. package/dist/install.test.js +26 -10
  32. package/dist/install.test.js.map +1 -1
  33. package/dist/package-manager.d.ts +11 -0
  34. package/dist/package-manager.d.ts.map +1 -0
  35. package/dist/package-manager.js +47 -0
  36. package/dist/package-manager.js.map +1 -0
  37. package/dist/package-manager.test.d.ts +2 -0
  38. package/dist/package-manager.test.d.ts.map +1 -0
  39. package/dist/package-manager.test.js +51 -0
  40. package/dist/package-manager.test.js.map +1 -0
  41. package/dist/prepare-template-utils.d.ts +10 -0
  42. package/dist/prepare-template-utils.d.ts.map +1 -0
  43. package/dist/prepare-template-utils.js +53 -0
  44. package/dist/prepare-template-utils.js.map +1 -0
  45. package/dist/prepare-template-utils.test.d.ts +2 -0
  46. package/dist/prepare-template-utils.test.d.ts.map +1 -0
  47. package/dist/prepare-template-utils.test.js +67 -0
  48. package/dist/prepare-template-utils.test.js.map +1 -0
  49. package/dist/prompts.d.ts +2 -0
  50. package/dist/prompts.d.ts.map +1 -1
  51. package/dist/prompts.js +11 -3
  52. package/dist/prompts.js.map +1 -1
  53. package/dist/prompts.test.js +17 -7
  54. package/dist/prompts.test.js.map +1 -1
  55. package/dist/template-sync-utils.test.d.ts +2 -0
  56. package/dist/template-sync-utils.test.d.ts.map +1 -0
  57. package/dist/template-sync-utils.test.js +41 -0
  58. package/dist/template-sync-utils.test.js.map +1 -0
  59. package/package.json +3 -2
  60. package/templates/default/.appraise-template-meta.json +5 -0
  61. package/templates/default/.env.example +1 -1
  62. package/templates/default/.vscode/settings.json +10 -3
  63. package/templates/default/README.md +27 -25
  64. package/templates/default/automation/features/base/login.feature +15 -0
  65. package/templates/default/automation/locators/base/home.json +3 -0
  66. package/templates/default/automation/locators/base/login.json +6 -0
  67. package/templates/default/automation/locators/base/test.json +1 -0
  68. package/templates/default/automation/mapping/locator-map.json +14 -0
  69. package/templates/default/{src/tests → automation}/steps/actions/click.step.ts +1 -4
  70. package/templates/default/{src/tests → automation}/steps/actions/hover.step.ts +1 -4
  71. package/templates/default/{src/tests → automation}/steps/actions/input.step.ts +1 -4
  72. package/templates/default/{src/tests → automation}/steps/actions/navigation.step.ts +1 -3
  73. package/templates/default/{src/tests → automation}/steps/actions/random_data.step.ts +1 -3
  74. package/templates/default/{src/tests → automation}/steps/actions/store.step.ts +1 -4
  75. package/templates/default/automation/steps/actions/wait.step.ts +91 -0
  76. package/templates/default/{src/tests → automation}/steps/validations/active_state_assertion.step.ts +1 -4
  77. package/templates/default/{src/tests → automation}/steps/validations/navigation_assertion.step.ts +1 -2
  78. package/templates/default/{src/tests → automation}/steps/validations/text_assertion.step.ts +1 -4
  79. package/templates/default/{src/tests → automation}/steps/validations/visibility_assertion.step.ts +1 -4
  80. package/templates/default/cucumber.mjs +6 -6
  81. package/templates/default/eslint.config.mjs +5 -4
  82. package/templates/default/package-lock.json +322 -485
  83. package/templates/default/package.json +12 -6
  84. package/templates/default/packages/cucumber-runtime/package.json +13 -0
  85. package/templates/default/packages/cucumber-runtime/src/cache.util.ts +93 -0
  86. package/templates/default/packages/cucumber-runtime/src/cli.ts +68 -0
  87. package/templates/default/packages/cucumber-runtime/src/environment.util.ts +21 -0
  88. package/templates/default/packages/cucumber-runtime/src/executor.ts +32 -0
  89. package/templates/default/{src/tests/hooks → packages/cucumber-runtime/src}/hooks.ts +17 -32
  90. package/templates/default/packages/cucumber-runtime/src/index.ts +17 -0
  91. package/templates/default/{src/tests/utils → packages/cucumber-runtime/src}/locator.util.ts +50 -64
  92. package/templates/default/packages/cucumber-runtime/src/parameter-types.ts +7 -0
  93. package/templates/default/packages/cucumber-runtime/src/paths.ts +33 -0
  94. package/templates/default/packages/cucumber-runtime/src/random-data.util.ts +35 -0
  95. package/templates/default/packages/cucumber-runtime/src/types.ts +13 -0
  96. package/templates/default/{src/tests/config/executor → packages/cucumber-runtime/src}/world.ts +4 -1
  97. package/templates/default/packages/cucumber-runtime/tsconfig.json +11 -0
  98. package/templates/default/scripts/setup-env.ts +4 -4
  99. package/templates/default/scripts/sync-appraise-base-template.ts +124 -105
  100. package/templates/default/scripts/sync-environments.ts +8 -5
  101. package/templates/default/scripts/sync-locator-groups.ts +7 -10
  102. package/templates/default/scripts/sync-locators.ts +5 -9
  103. package/templates/default/scripts/sync-modules.ts +9 -17
  104. package/templates/default/scripts/sync-tags.ts +2 -2
  105. package/templates/default/scripts/sync-template-step-groups.ts +16 -6
  106. package/templates/default/scripts/sync-template-steps.ts +16 -5
  107. package/templates/default/scripts/sync-test-cases.ts +6 -3
  108. package/templates/default/scripts/sync-test-suites.ts +7 -4
  109. package/templates/default/src/actions/environments/environment-actions.ts +6 -23
  110. package/templates/default/src/actions/locator/locator-actions.ts +36 -93
  111. package/templates/default/src/actions/locator-groups/locator-group-actions.ts +24 -78
  112. package/templates/default/src/actions/modules/module-actions.ts +4 -2
  113. package/templates/default/src/actions/tags/tag-actions.ts +4 -1
  114. package/templates/default/src/actions/template-step/template-step-actions.ts +10 -101
  115. package/templates/default/src/actions/template-step-group/template-step-group-actions.ts +31 -130
  116. package/templates/default/src/actions/test-case/test-case-actions.ts +31 -94
  117. package/templates/default/src/actions/test-run/test-run-actions.ts +11 -13
  118. package/templates/default/src/actions/test-suite/test-suite-actions.ts +29 -82
  119. package/templates/default/src/app/(base)/locator-groups/page.tsx +1 -3
  120. package/templates/default/src/app/(base)/reports/page.tsx +1 -1
  121. package/templates/default/src/app/(base)/reports/test-cases/page.tsx +2 -2
  122. package/templates/default/src/app/(base)/reports/test-cases/test-cases-metric-table-columns.tsx +1 -1
  123. package/templates/default/src/app/(base)/tags/page.tsx +2 -2
  124. package/templates/default/src/app/(base)/template-steps/page.tsx +1 -2
  125. package/templates/default/src/app/(base)/test-runs/page.tsx +2 -2
  126. package/templates/default/src/app/api/test-runs/[runId]/logs/route.ts +2 -1
  127. package/templates/default/src/app/api/test-runs/[runId]/trace/[testCaseId]/route.ts +2 -1
  128. package/templates/default/src/app/page.tsx +4 -5
  129. package/templates/default/src/components/diagram/dynamic-parameters.tsx +76 -40
  130. package/templates/default/src/components/diagram/options-header-node.tsx +1 -1
  131. package/templates/default/src/components/ui/data-table.tsx +33 -39
  132. package/templates/default/src/lib/automation/paths.ts +181 -0
  133. package/templates/default/src/lib/automation/projection-service.ts +230 -0
  134. package/templates/default/src/lib/environment-file-utils.ts +14 -51
  135. package/templates/default/src/lib/executor/local-executor-adapter.ts +101 -0
  136. package/templates/default/src/lib/executor/types.ts +24 -0
  137. package/templates/default/src/lib/feature-file-generator.ts +22 -112
  138. package/templates/default/src/lib/locator-group-file-utils.ts +57 -120
  139. package/templates/default/src/lib/process/task-spawner.ts +236 -0
  140. package/templates/default/src/lib/template-sync-utils.d.ts +7 -0
  141. package/templates/default/src/lib/template-sync-utils.d.ts.map +1 -0
  142. package/templates/default/src/lib/template-sync-utils.js +47 -0
  143. package/templates/default/src/lib/template-sync-utils.js.map +1 -0
  144. package/templates/default/src/lib/template-sync-utils.ts +63 -0
  145. package/templates/default/src/lib/test-run/process-manager.ts +9 -87
  146. package/templates/default/src/lib/test-run/test-run-executor.ts +7 -136
  147. package/templates/default/src/lib/test-run/winston-logger.ts +6 -35
  148. package/templates/default/src/lib/utils/template-step-file-generator.ts +22 -85
  149. package/templates/default/src/lib/utils/template-step-file-manager-intelligent.ts +7 -22
  150. package/templates/default/public/favicon.ico +0 -0
  151. package/templates/default/src/tests/executor.ts +0 -80
  152. package/templates/default/src/tests/mapping/locator-map.json +0 -1
  153. package/templates/default/src/tests/steps/actions/wait.step.ts +0 -107
  154. package/templates/default/src/tests/support/parameter-types.ts +0 -12
  155. package/templates/default/src/tests/utils/cache.util.ts +0 -260
  156. package/templates/default/src/tests/utils/cli.util.ts +0 -177
  157. package/templates/default/src/tests/utils/environment.util.ts +0 -65
  158. package/templates/default/src/tests/utils/random-data.util.ts +0 -45
  159. package/templates/default/src/tests/utils/spawner.util.ts +0 -617
@@ -0,0 +1,91 @@
1
+ import { When, Then, CustomWorld, expect, SelectorName, resolveLocator, getEnvironment, generateRandomData, RandomDataType } from '../../../packages/cucumber-runtime/src/index.js'
2
+ /**
3
+ * @name wait
4
+ * @description Template steps that handles waiting
5
+ * @type ACTION
6
+ */
7
+
8
+ // This file is generated automatically. Add template steps to this group to generate content.
9
+
10
+ /**
11
+ * @name wait for page load
12
+ * @description Template step for waiting till page becomes interactive
13
+ * @icon WAIT
14
+ */
15
+ When('the user waits for the current page to be loaded', async function (this: CustomWorld) {
16
+ try {
17
+ await this.page.waitForLoadState('domcontentloaded')
18
+ } catch (error) {
19
+ throw new Error(`Failed to wait for the current page to be loaded: ${error}`)
20
+ }
21
+ })
22
+
23
+ /**
24
+ * @name wait for url route
25
+ * @description Template step for waiting for a url route to be loaded
26
+ * @icon WAIT
27
+ */
28
+ When('the user waits for the route {string} to be loaded', async function (this: CustomWorld, routeName: string) {
29
+ try {
30
+ const baseUrl = getEnvironment(process.env.ENVIRONMENT as string).baseUrl
31
+ const sanitizedBaseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl
32
+ const sanitizedRouteName = routeName.startsWith('/') ? routeName.slice(1) : routeName
33
+ const fullRoute = `${sanitizedBaseUrl}/${sanitizedRouteName}`
34
+ await this.page.waitForURL(fullRoute, { waitUntil: 'domcontentloaded' })
35
+ } catch (error) {
36
+ throw new Error(`Failed to wait for the route ${routeName} to be loaded: ${error}`)
37
+ }
38
+ })
39
+
40
+ /**
41
+ * @name wait for element
42
+ * @description Template step for waiting for element to become visible
43
+ * @icon WAIT
44
+ */
45
+ When(
46
+ 'the user waits for the element {string} to become visible',
47
+ async function (this: CustomWorld, elementName: SelectorName) {
48
+ try {
49
+ const selector = await resolveLocator(this.page, elementName)
50
+ if (!selector) {
51
+ throw new Error(`Selector ${elementName} not found`)
52
+ }
53
+ await this.page.waitForSelector(selector, { state: 'visible' })
54
+ } catch (error) {
55
+ throw new Error(`Failed to wait for the element ${elementName} to become visible: ${error}`)
56
+ }
57
+ },
58
+ )
59
+
60
+ /**
61
+ * @name wait for element to disappear
62
+ * @description Template step for waiting for an element to disappear from viewport
63
+ * @icon WAIT
64
+ */
65
+ When(
66
+ 'the user waits for the {string} element to disappear',
67
+ async function (this: CustomWorld, elementName: SelectorName) {
68
+ try {
69
+ const selector = await resolveLocator(this.page, elementName)
70
+ if (!selector) {
71
+ throw new Error(`Selector ${elementName} not found`)
72
+ }
73
+ await this.page.waitForSelector(selector, { state: 'hidden' })
74
+ } catch (error) {
75
+ throw new Error(`Failed to wait for the ${elementName} element to disappear: ${error}`)
76
+ }
77
+ },
78
+ )
79
+
80
+ /**
81
+ * @name wait for specific amount of seconds
82
+ * @description Template step for waiting for for an specific amount of seconds before proceeding with next action
83
+ * @icon WAIT
84
+ */
85
+ When('the user waits for {int} seconds', async function (this: CustomWorld, waitTimeInSeconds: number) {
86
+ try {
87
+ await this.page.waitForTimeout(waitTimeInSeconds * 1000)
88
+ } catch (error) {
89
+ throw new Error(`Failed to wait for ${waitTimeInSeconds} seconds: ${error}`)
90
+ }
91
+ })
@@ -1,12 +1,9 @@
1
+ import { When, Then, CustomWorld, expect, SelectorName, resolveLocator, getEnvironment, generateRandomData, RandomDataType } from '../../../packages/cucumber-runtime/src/index.js'
1
2
  /**
2
3
  * @name active state assertion
3
4
  * @description Template steps for handling the validation of the active state of an element
4
5
  * @type VALIDATION
5
6
  */
6
- import { Then } from '@cucumber/cucumber'
7
- import { CustomWorld, expect } from '../../config/executor/world.js'
8
- import { SelectorName } from '@/types/locator/locator.type'
9
- import { resolveLocator } from '../../utils/locator.util.js'
10
7
 
11
8
  // This file is generated automatically. Add template steps to this group to generate content.
12
9
 
@@ -1,10 +1,9 @@
1
+ import { When, Then, CustomWorld, expect, SelectorName, resolveLocator, getEnvironment, generateRandomData, RandomDataType } from '../../../packages/cucumber-runtime/src/index.js'
1
2
  /**
2
3
  * @name navigation assertion
3
4
  * @description Template steps that handles navigation validations
4
5
  * @type VALIDATION
5
6
  */
6
- import { Then } from '@cucumber/cucumber'
7
- import { CustomWorld, expect } from '../../config/executor/world.js'
8
7
 
9
8
  // This file is generated automatically. Add template steps to this group to generate content.
10
9
 
@@ -1,12 +1,9 @@
1
+ import { When, Then, CustomWorld, expect, SelectorName, resolveLocator, getEnvironment, generateRandomData, RandomDataType } from '../../../packages/cucumber-runtime/src/index.js'
1
2
  /**
2
3
  * @name text assertion
3
4
  * @description Template steps for asserting text inside elements
4
5
  * @type VALIDATION
5
6
  */
6
- import { Then } from '@cucumber/cucumber';
7
- import { CustomWorld, expect } from '../../config/executor/world.js';
8
- import { SelectorName } from '@/types/locator/locator.type';
9
- import { resolveLocator } from '../../utils/locator.util.js';
10
7
 
11
8
  // This file is generated automatically. Add template steps to this group to generate content.
12
9
 
@@ -1,12 +1,9 @@
1
+ import { When, Then, CustomWorld, expect, SelectorName, resolveLocator, getEnvironment, generateRandomData, RandomDataType } from '../../../packages/cucumber-runtime/src/index.js'
1
2
  /**
2
3
  * @name visibility assertion
3
4
  * @description Template steps that handles the assertion of element visibility states
4
5
  * @type VALIDATION
5
6
  */
6
- import { Then } from '@cucumber/cucumber'
7
- import { CustomWorld, expect } from '../../config/executor/world.js'
8
- import { SelectorName } from '@/types/locator/locator.type'
9
- import { resolveLocator } from '../../utils/locator.util.js'
10
7
 
11
8
  // This file is generated automatically. Add template steps to this group to generate content.
12
9
 
@@ -1,16 +1,16 @@
1
1
  // eslint-disable-next-line import/no-anonymous-default-export
2
2
  export default {
3
- paths: ['src/tests/features/**/*.feature'],
3
+ paths: ['automation/features/**/*.feature'],
4
4
  import: [
5
- 'src/tests/support/parameter-types.ts',
6
- 'src/tests/steps/**/*.ts',
7
- 'src/tests/hooks/hooks.ts',
8
- 'src/tests/config/executor/world.ts',
5
+ 'packages/cucumber-runtime/src/parameter-types.ts',
6
+ 'automation/steps/**/*.ts',
7
+ 'packages/cucumber-runtime/src/hooks.ts',
8
+ 'packages/cucumber-runtime/src/world.ts',
9
9
  ],
10
10
  loader: ['ts-node/esm'],
11
11
  format: [
12
12
  'pretty',
13
- process.env.REPORT_FORMAT ?? `json:${process.env.REPORT_PATH ?? 'src/tests/reports/cucumber.json'}`,
13
+ process.env.REPORT_FORMAT ?? `json:${process.env.REPORT_PATH ?? 'automation/reports/cucumber.json'}`,
14
14
  ],
15
15
  publishQuiet: true,
16
16
  }
@@ -1,13 +1,14 @@
1
- import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
2
- import nextTypescript from "eslint-config-next/typescript";
1
+ import nextCoreWebVitals from 'eslint-config-next/core-web-vitals';
2
+ import nextTypescript from 'eslint-config-next/typescript';
3
3
 
4
4
  const eslintConfig = [
5
5
  ...nextCoreWebVitals,
6
6
  ...nextTypescript,
7
7
  {
8
8
  ignores: [
9
- "src/tests/steps/**/*.step.ts", // Exclude generated template step files
10
- "src/tests/steps/**/*", // Exclude all files in steps directory
9
+ 'automation/steps/**/*.step.ts',
10
+ 'automation/steps/**/*',
11
+ 'packages/cucumber-runtime/dist/**/*',
11
12
  ],
12
13
  },
13
14
  ];