@suffolklitlab/alkiln 5.11.2 → 5.12.0-delete2

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.
@@ -7,6 +7,13 @@ const files = require(`./files` );
7
7
 
8
8
  module.exports = reports = {};
9
9
 
10
+ reports.title = `Assembly Line Kiln Automated Testing Report - ${ (new Date()).toUTCString() }\n`;
11
+ reports.failures = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n🤕 Failed scenarios\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
12
+ reports.successes = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n🌈 Passed scenarios\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
13
+ // reports.warnings = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n🔎 Scenarios to check\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
14
+ // reports.undefineds = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n[langs icon] Scenarios with typos\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
15
+ reports.others = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n🔎 Other scenarios that did not pass\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
16
+
10
17
  reports.addReportHeading = function (scope, { scenario }) {
11
18
  /** Return printable heading based on Scenario name and tags.
12
19
  * Allow characters from other languages.
@@ -19,14 +26,14 @@ reports.addReportHeading = function (scope, { scenario }) {
19
26
  tag_names.push( tag.name );
20
27
  }
21
28
 
22
- let heading = `\n---------------\n`
29
+ let heading = `\n―――――――――――――――\n`
23
30
  + `Scenario: ${ scenario.pickle.name }`;
24
31
 
25
32
  if ( tag_names.length > 0 ) {
26
33
  heading += `\nTags: ${ tag_names.join(' ') }`;
27
34
  }
28
35
 
29
- heading += `\n---------------`;
36
+ heading += `\n―――――――――――――――`;
30
37
 
31
38
  reports.addToReport( scope, {
32
39
  code: `ALK0176`,
@@ -71,21 +78,30 @@ reports.addToReport = function( scope, { type, code, value }) {
71
78
  }
72
79
 
73
80
  // Report stuff
74
- let scenario = makeSureReportPartsExist( scope );
81
+ let scenario = reports.makeSureScenarioExists( scope );
75
82
  scenario.lines.push({ type, code, value });
76
83
 
77
84
  return scenario;
78
85
  }; // Ends reports.addToReport()
79
86
 
80
- let makeSureReportPartsExist = function( scope ) {
87
+ reports.create = function( scope ) {
88
+ reports.makeSureReportExists( scope );
89
+ }
90
+
91
+ reports.makeSureReportExists = function( scope ) {
81
92
  /** If a part of the report needs to exist right now, but doesn't exist,
82
93
  * create it. */
83
94
  if ( !scope.report ) { scope.report = new Map(); }
95
+ return this;
96
+ }; // Ends reports.makeSureReportExists()
97
+
98
+ reports.makeSureScenarioExists = function ( scope ) {
99
+ reports.makeSureReportExists( scope );
84
100
  if ( !scope.scenario_id ) {
85
101
  scope.scenario_id = `_report_${ Date.now() }`;
86
102
  }
87
103
  if ( !scope.report.get( scope.scenario_id )) {
88
- scope.report.set( scope.scenario_id, {} )
104
+ scope.report.set( scope.scenario_id, {} );
89
105
  scope.report.get( scope.scenario_id ).status = `in progress`;
90
106
  }
91
107
 
@@ -93,11 +109,36 @@ let makeSureReportPartsExist = function( scope ) {
93
109
  if ( !scenario.lines ) { scenario.lines = []; }
94
110
 
95
111
  return scenario;
96
- }; // Ends makeSureReportPartsExist()
112
+ }; // Ends reports.makeSureScenarioExists()
113
+
114
+ reports.saveFinalScenarioData = function( scope, { status=`in progress` }) {
115
+ this.setReportScenarioStatus( scope, { status });
116
+ let scenario = scope.report.get( scope.scenario_id );
117
+ let report = this.getPrintableScenario( scenario );
118
+ if ( scenario.status === `FAILED` ) { this.failures.push( report ); }
119
+ else if ( scenario.status === `PASSED` ) { this.successes.push( report ); }
120
+ // else if ( scenario.status === `WARNING` ) { passed_reports += report; this.warnings.push( report ); }
121
+ // else if ( scenario.status === `UNDEFINED` ) { passed_reports += report; this.undefineds.push( report ); }
122
+ else { this.others.push( report ); }
123
+
124
+ // Save to failures.txt (worry about optimization later)
125
+ if ( this.failures.length > 1 || this.others.length > 1 ) {
126
+ fs.writeFileSync(
127
+ scope.paths.failures,
128
+ this.title + this.getPrintableUnexpected( scope )
129
+ );
130
+ }
131
+ // Save to reports.txt (worry about optimization later)
132
+ fs.writeFileSync( scope.paths.report, this.getPrintableReport( scope ) );
133
+
134
+ return scenario;
135
+ }; // Ends reports.saveFinalScenarioData()
136
+
97
137
 
98
138
  reports.setReportScenarioStatus = function( scope, { status=`PASSED` }) {
99
139
  /** Add final status of scenario to scenario report object - passed, failed, etc. */
100
140
  scope.report.get( scope.scenario_id ).status = status;
141
+ return scope.report.get( scope.scenario_id );
101
142
  }; // Ends reports.setReportScenarioStatus()
102
143
 
103
144
  reports.convertToOriginalStoryTableRow = function( scope, { row_data }) {
@@ -124,34 +165,38 @@ let trimJSON = function( str=`` ) {
124
165
  }; // Ends trimJSON()
125
166
 
126
167
  reports.getPrintableReport = function( scope ) {
127
- /** Return a string generated from test report data. */
128
- let report = `Assembly Line Kiln Automated Testing Report - ${ (new Date()).toUTCString() }\n`;
129
-
130
- // First list failed scenarios, then non-passed scenarios, then passed scenarios
131
- let failed_reports = ``;
132
- let passed_reports = ``;
133
- let other_reports = ``;
134
- for ( let scenario of scope.report ) {
135
-
136
- let report = reports.getPrintableScenario( scenario );
137
- let [ scenario_id, data ] = scenario;
138
- if ( data.status === `FAILED` ) { failed_reports += report; }
139
- else if ( data.status === `PASSED` ) { passed_reports += report; }
140
- else { other_reports += report; }
141
- }; // ends for every scenario
142
-
143
- if ( failed_reports !== `` ) { report += `\n\n===============================\n===============================\n🤕 Failed scenarios:\n${ failed_reports }`; }
144
- if ( other_reports !== `` ) { report += `\n\n===============================\n===============================\n🔎 Scenarios that did not pass:\n${ other_reports }`; }
145
- if ( passed_reports !== `` ) { report += `\n\n===============================\n===============================\n🌈 Passed scenarios:\n${ passed_reports }`; }
168
+ /** Return a string generated from test report data.
169
+ *
170
+ * First list failed scenarios, then non-passed scenarios, then passed scenarios. */
171
+ let report = this.getTitle( scope );
172
+
173
+ if ( this.failures.length > 1 ) { report += this.failures.join( `` ); }
174
+ if ( this.successes.length > 1 ) { report += this.successes.join( `` ); }
175
+ // if ( this.warnings.length > 1 ) {}
176
+ // if ( this.undefineds.length > 1 ) {}
177
+ if ( this.others.length > 1 ) { report += this.others.join( `` ); }
146
178
 
147
179
  return report;
148
180
  }; // Ends reports.getPrintableReport()
149
181
 
182
+ reports.getTitle = function( scope ) { return this.title; }
183
+
184
+ reports.getPrintableUnexpected = function( scope ) {
185
+ // Note about `> 1`: The first line of the report section always exists
186
+ let output = ``;
187
+ if ( this.failures.length > 1 ) {
188
+ output += this.failures.join(``);
189
+ }
190
+ if ( this.others.length > 1 ) {
191
+ output += this.others.join(``);
192
+ }
193
+ return output;
194
+ }; // Ends reports.getPrintableUnexpected()
195
+
150
196
  reports.getPrintableScenario = function( scenario ) {
151
197
  /** Return a string generated from scenario list of report items. */
152
- let [ scenario_id, data ] = scenario;
153
198
  let report = ``;
154
- for ( let line of data.lines ) {
199
+ for ( let line of scenario.lines ) {
155
200
  let { type, code, value } = line;
156
201
  report += `${ getLineText({ type, code, value }) }\n`;
157
202
  }
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.11.2",
3
+ "version": "5.12.0-delete2",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
7
7
  "test": "npm run unit && npm run codes && npm run cucumber",
8
8
  "cucumber": "./lib/run_cucumber.js",
9
9
  "local": "npm run setup && npm run cucumber; npm run takedown",
10
+ "pass": "npm run cucumber 'not @error and not @temp_error'",
11
+ "fail": "npm run cucumber '@error'",
10
12
  "setup": "./lib/docassemble/setup.js",
11
13
  "takedown": "./lib/docassemble/takedown.js",
12
14
  "server_install": "./lib/docassemble/server_install.js",
@@ -30,7 +32,7 @@
30
32
  "bugs": {
31
33
  "url": "https://github.com/SuffolkLITLab/ALKiln/issues"
32
34
  },
33
- "homepage": "https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/automated_integrated_testing/",
35
+ "homepage": "https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/intro",
34
36
  "dependencies": {
35
37
  "@axe-core/puppeteer": "4.7.3",
36
38
  "@cucumber/cucumber": "9.3.0",
package/setup.py CHANGED
@@ -50,7 +50,7 @@ setup(name='docassemble.ALKilnTests',
50
50
  author='plocket',
51
51
  author_email='example@example.com',
52
52
  license='The MIT License (MIT)',
53
- url='https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln',
53
+ url='https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/intro',
54
54
  packages=find_packages(),
55
55
  namespace_packages=['docassemble'],
56
56
  install_requires=['docassemble.ALToolbox>=0.8.2', 'docassemble.AssemblyLine>=2.24.0'],
@@ -106,7 +106,8 @@ ALK0026
106
106
  ALK0027
107
107
  ALK0028
108
108
  ALK0030
109
- ALK0049"
109
+ ALK0049
110
+ ALK0184"
110
111
 
111
112
  # Use a sorted list. `uniq` only detects consecutive duplicates
112
113
  duplicates=$(echo "$sorted" | uniq -d)