itemengine-cypress-automation 1.0.431-revertChangesForBuildIdFunction-1ab0e9b.0 → 1.0.432-addQuestionNamesToBuildIdGeneationFunction-5daf356.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.431-revertChangesForBuildIdFunction-1ab0e9b.0",
3
+ "version": "1.0.432-addQuestionNamesToBuildIdGeneationFunction-5daf356.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,7 +32,64 @@ const env = process.env.STAGE ? process.env.STAGE : envArgs.fileConfig;
32
32
  function setCiBuildId(user, startTime) {
33
33
  let tags;
34
34
  let testType = '[Regression]';
35
-
35
+ let questionTypeInfo = '';
36
+
37
+ // Map specific script commands to display names
38
+ const questionTypeDisplayNames = {
39
+ 'essayResponse': 'Constructed_response',
40
+ 'thinkSphereQuestion': 'ThinkSphere',
41
+ 'textEntryMath': 'Math_response',
42
+ 'DNDIntoCategories': 'Drag_and_drop',
43
+ 'multipleSelection': 'Multiple_choice_selection',
44
+ 'graphing': 'Graph_and_chart',
45
+ 'imageHighlight': 'Highlight',
46
+ 'listOrdering': 'List',
47
+ 'fillInTheGaps': 'Fill_in_the_gaps'
48
+ };
49
+
50
+ // Method 1: Try npm script detection (works locally)
51
+ const npmScript = process.env.npm_lifecycle_event;
52
+ let commandName = null;
53
+
54
+ if (npmScript && npmScript.startsWith('spinnaker:')) {
55
+ commandName = npmScript.replace('spinnaker:', '');
56
+ } else if (envArgs.questionType) {
57
+ // Method 2: Detect from questionType patterns (works in CI)
58
+ const questionTypePatterns = {
59
+ 'EssayResponse': 'essayResponse',
60
+ 'ThinkSphere': 'thinkSphereQuestion',
61
+ 'TextEntryMath': 'textEntryMath',
62
+ 'DragAndDropIntoCategoriesNew': 'DNDIntoCategories',
63
+ 'MultipleSelection': 'multipleSelection',
64
+ 'Graphing': 'graphing',
65
+ 'ChartsBar': 'graphing',
66
+ 'ChartsLine': 'graphing',
67
+ 'ChartsDotsPlot': 'graphing',
68
+ 'ImageHighlight': 'imageHighlight',
69
+ 'GridFill': 'imageHighlight',
70
+ 'TextSelection': 'imageHighlight',
71
+ 'ListOrderingNew': 'listOrdering',
72
+ 'Matching': 'listOrdering',
73
+ 'FillInTheGapsTextNew': 'fillInTheGaps',
74
+ 'FillInTheGapsDropdownNew': 'fillInTheGaps',
75
+ 'FillInTheGapsDragAndDropNew': 'fillInTheGaps'
76
+ };
77
+
78
+ // Find matching pattern in questionType
79
+ const questionTypes = envArgs.questionType.split('_');
80
+ for (const questionType of questionTypes) {
81
+ if (questionTypePatterns[questionType]) {
82
+ commandName = questionTypePatterns[questionType];
83
+ break; // Use first match
84
+ }
85
+ }
86
+ }
87
+
88
+ // Apply display name if found
89
+ if (commandName && questionTypeDisplayNames[commandName]) {
90
+ questionTypeInfo = `[${questionTypeDisplayNames[commandName]}]`;
91
+ }
92
+
36
93
  if (envArgs.grepUntagged) {
37
94
  tags = 'untagged';
38
95
  } else if (envArgs.grepTags) {
@@ -44,7 +101,7 @@ function setCiBuildId(user, startTime) {
44
101
  tags = '--';
45
102
  }
46
103
 
47
- return `${user}${testType}[env:${env}][tags:${tags}][${startTime}]`
104
+ return `${user}${testType}${questionTypeInfo}[env:${env}][tags:${tags}][${startTime}]`;
48
105
  }
49
106
 
50
107
  function setCommandLineEnvArgs() {