@suffolklitlab/alkiln 5.0.0-pre-6 → 5.0.0-pre-7

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/CHANGELOG.md CHANGED
@@ -56,11 +56,13 @@ Format:
56
56
  - don't print the ["publish this cucumber report" message](https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#options)
57
57
  - Adjusted validation of some environment variables to account for Playground vs. GitHub or local test runs. [Issue #661](https://github.com/SuffolkLITLab/ALKiln/issues/661)
58
58
  - Docassemble Project name prefix now includes ALKiln in it for clarity
59
+ - Change interface for testing languages. See [#713](https://github.com/SuffolkLITLab/ALKiln/issues/713).
59
60
 
60
61
  ### Fixed
61
62
  - Projects created in da each have a unique name. https://github.com/SuffolkLITLab/ALKiln/issues/663
62
63
  - Shorten path names to try to accommodate limitations of windows systems while still keeping enough useful information to help devs identify the test outputs. https://github.com/SuffolkLITLab/ALKiln/issues/618
63
64
  - Updated field decoding to handle new object field encoding. See [#711](https://github.com/SuffolkLITLab/ALKiln/issues/711)
65
+ - Allow multiple languages to be tested again. See [#713](https://github.com/SuffolkLITLab/ALKiln/issues/713).
64
66
 
65
67
  ### Security
66
68
  - Pass docassemble API keys through HTTP headers instead of as parameters.
@@ -33,20 +33,23 @@ const cucumber_api = require('@cucumber/cucumber/api');
33
33
  }
34
34
 
35
35
  if (tags.length > 0) {
36
+ let joined_tags = '';
36
37
  // Cucumber expects tags in boolean expressions, like (@a0 or @a1) and @random.
37
38
  // If we get a list of only tags, then "or" them all together
38
39
  if (tags.every((val) => val.startsWith("@"))) {
39
- provided_config.tags = tags.join(' or ');
40
+ joined_tags = tags.join(' or ');
40
41
  }
41
42
  // If we get a list of seemingly no tags, assume they meant to use tags
42
43
  else if (tags.every((val) => !val.startsWith("@"))) {
43
- provided_config.tags = tags.map((val) => "@" + val).join(' or ');
44
+ joined_tags = tags.map((val) => "@" + val).join(' or ');
44
45
  }
45
46
  // If it's a mix of tags and no tags, it's probably a boolean expression!
46
47
  else {
47
- provided_config.tags = tags.join(' ');
48
+ joined_tags = tags.join(' ');
48
49
  }
49
- }
50
+
51
+ provided_config.tags = joined_tags;
52
+ } // end if there are tags
50
53
 
51
54
  const { runConfiguration } = await cucumber_api.loadConfiguration({
52
55
  provided: provided_config
package/lib/steps.js CHANGED
@@ -160,7 +160,7 @@ Before(async (scenario) => {
160
160
  //#####################################
161
161
  //#####################################
162
162
 
163
- Given(/I start the interview at "([^"]+)"(?: in lang "([^"]+)")?/, {timeout: -1}, async (file_name, language) => { // √
163
+ Given(/I start the interview at "([^"]+)"/, {timeout: -1}, async (file_name) => { // √
164
164
 
165
165
  // Load the right interview page
166
166
  await scope.load( scope, file_name );
@@ -180,7 +180,7 @@ Given(/I start the interview at "([^"]+)"(?: in lang "([^"]+)")?/, {timeout: -1}
180
180
  // I've seen stuff take an extra moment or two. Shame to have it everywhere
181
181
  try {
182
182
  // Interview files should get downloaded to downloads folder
183
- await scope.page._client.send('Page.setDownloadBehavior', {
183
+ await scope.page._client().send('Page.setDownloadBehavior', {
184
184
  behavior: 'allow',
185
185
  downloadPath: path.resolve( scope.paths.scenario ), // Save in root of this scenario
186
186
  });
@@ -203,7 +203,7 @@ Given(/I start the interview at "([^"]+)"(?: in lang "([^"]+)")?/, {timeout: -1}
203
203
  // at any one time since each step completes synchronously
204
204
 
205
205
  // If response has a file in it that matches the file we are downloading
206
- if ( response._headers['content-disposition'] && (response._headers['content-disposition']).includes(`attachment;filename=${scope.toDownload}`) ) {
206
+ if ( response.headers()['content-disposition'] && (response.headers()['content-disposition']).includes(`attachment;filename=${scope.toDownload}`) ) {
207
207
  // We're choosing to avoid removing the event listener in case removal
208
208
  // would prevent downloading other files. The listener should get
209
209
  // destroyed when the page closes anyway.
@@ -211,7 +211,7 @@ Given(/I start the interview at "([^"]+)"(?: in lang "([^"]+)")?/, {timeout: -1}
211
211
  // Watch event on download folder or file
212
212
  await fs.watchFile( scope.paths.scenario, function (curr, prev) {
213
213
  // If current size eq to size from response then close
214
- if (parseInt(curr.size) === parseInt(response._headers['content-length'])) {
214
+ if (parseInt(curr.size) === parseInt(response.headers()['content-length'])) {
215
215
  // Lets the related function in `scope` know that the download
216
216
  // is done so that the next step can start.
217
217
  scope.downloadComplete = true;
@@ -224,25 +224,6 @@ Given(/I start the interview at "([^"]+)"(?: in lang "([^"]+)")?/, {timeout: -1}
224
224
  } // ends if this is the file the developer expected
225
225
  }); // ends page.on 'response'
226
226
 
227
-
228
- // TODO: Move language into a different step
229
- scope.language = language;
230
- let custom_lang_timeout = new Promise(async ( resolve, reject ) => {
231
- let page_timeout = setTimeout(function() { reject( `It took to long to try to set the language "${ language }".` ); }, scope.timeout);
232
- // self-invoke an anonymous async function so we don't have to
233
- // abstract the details of resolving and rejecting.
234
- (async function() {
235
- try {
236
- await scope.setLanguage( scope, { language });
237
- resolve();
238
- } catch ( err ) { reject( err ); }
239
- // prevent temporary hang at end of tests
240
- finally { clearTimeout( page_timeout ); }
241
- })();
242
- }); // ends custom_lang_timeout
243
- await custom_lang_timeout;
244
-
245
-
246
227
  let custom_afterStep_timeout = new Promise(async ( resolve, reject ) => {
247
228
  let page_timeout = setTimeout(function() { reject(`\`afterStep()\` took too long.`); }, scope.timeout);
248
229
  // self-invoke an anonymous async function so we don't have to