@suffolklitlab/alkiln 5.8.1-feat2columns5 → 5.9.0-feat-url1

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.
@@ -3,7 +3,7 @@ name: GitHub server installation
3
3
  on:
4
4
  push:
5
5
  # Default "opened", "reopened", "synchronize". "edited" fires when the PR title gets edited, etc.
6
- pull_request_target:
6
+ pull_request:
7
7
  workflow_dispatch:
8
8
  inputs:
9
9
  tags:
@@ -42,13 +42,14 @@ jobs:
42
42
 
43
43
  - name: ALKiln - Start the isolated temporary docassemble server on GitHub
44
44
  id: github_server
45
- #### Developer note: you'll need to replace `.` with the path to
46
- #### the repo and branch. For example:
45
+ #### Developer note: you'll need to replace `.` with the path to ALKiln’s
46
+ #### repo and branch. For example, for version 5, put
47
47
  #### suffolkLITLab/ALKiln/action_for_github_server@v5
48
+ #### Come back and update this version later if you want the latest
48
49
  uses: ./action_for_github_server
49
50
  with:
50
51
  CONFIG_CONTENTS: "${{ secrets.CONFIG_CONTENTS }}"
51
- #### Developer note: Set this to True to show docker logs and
52
+ #### Developer note: Set this to true to show docker logs and
52
53
  #### allow ALKiln to create the docker logs output artifact.
53
54
  SHOW_DOCKER_OUTPUT: "${{ github.event.inputs.show_docker_output }}"
54
55
  - run: echo "ALKiln finished starting the isolated GitHub docassemble server"
@@ -77,9 +78,10 @@ jobs:
77
78
 
78
79
  - name: "Run ALKiln tests"
79
80
  if: ${{ success() }}
80
- #### Developer note: you'll need to replace `.` with the path to
81
- #### the repo and branch and leave off the trailing `/`
82
- #### For example suffolkLITLab/ALKiln@v5
81
+ #### Developer note: you'll need to replace `.` with the path to ALKiln’s
82
+ #### repo and branch and leave off the trailing `/`
83
+ #### For example, for version 5 put suffolkLITLab/ALKiln@v5
84
+ #### Come back and update this version later if you want the latest
83
85
  uses: ./
84
86
  with:
85
87
  SERVER_URL: "${{ steps.github_server.outputs.SERVER_URL }}"
@@ -87,6 +89,7 @@ jobs:
87
89
  INSTALL_METHOD: "server"
88
90
  #### Developer note: Useful for temporarily shortening ALKiln tests
89
91
  #### to debug the docker install step
92
+ #### Use a "tag expression" to specify which tagged tests to run (https://cucumber.io/docs/cucumber/api/#tag-expressions)
90
93
  # ALKILN_TAG_EXPRESSION: @a_tag_expression
91
- ALKILN_VERSION: 2columns
94
+ ALKILN_VERSION: url
92
95
 
@@ -3,7 +3,7 @@ name: Playground installation
3
3
  on:
4
4
  push:
5
5
  # Default: opened, reopened, synchronize. "edited" is not what we want.
6
- pull_request_target:
6
+ pull_request:
7
7
  workflow_dispatch:
8
8
  inputs:
9
9
  tags:
@@ -55,4 +55,4 @@ jobs:
55
55
  #### to debug the docker install step
56
56
  # ALKILN_TAG_EXPRESSION: @a_tag_expression
57
57
  #### Developer note: you probalby don't need this
58
- ALKILN_VERSION: 2columns
58
+ ALKILN_VERSION: url
package/CHANGELOG.md CHANGED
@@ -45,9 +45,22 @@ Format:
45
45
 
46
46
  <!-- ## [Unreleased] -->
47
47
 
48
+ ## [5.9.0] - 2024-02-11
49
+
48
50
  ### Added
49
51
 
50
- - 2-column Story Tables that work without the trigger variable. Now column 1, "var", should only contain the actual variable name with no proxies (x, i, j, etc). For example, instead of `x[i].name.first` the var column should now contain `users[0].name.first`. Column 2 is the same as it was before - the answer for the field. See [#582](https://github.com/SuffolkLITLab/ALKiln/issues/582).
52
+ - New feature: 2-column Story Tables that work without the trigger variable. Now column 1, "var", should only contain the actual variable name with no proxies (x, i, j, etc). For example, instead of `x[i].name.first` the var column should now contain `users[0].name.first`. Column 2 is the same as it was before - the answer for the field. See [#582](https://github.com/SuffolkLITLab/ALKiln/issues/582).
53
+ - Added console logs enhancing the "progress dots". You don't usually see those till after the tests run. Now more of them should show up during the test run and the name of the Scenario being tested should appear there as well. Unfortunately, the first Scenario behaves differently. We're consulting with the creators of cucumber to understand why that's happening.
54
+
55
+ ### Changed
56
+ - Reduced a couple error messages. See [#573](https://github.com/SuffolkLITLab/ALKiln/issues/573) and [#452](https://github.com/SuffolkLITLab/ALKiln/issues/452).
57
+
58
+ ### Internal
59
+ - Internal tests: Fixed Scenarios that had failed but had correct reports were instead passing.
60
+ - Internal tests: Allow more types of "expected status" for when we test dealing with "undefined", "skipped", etc.
61
+ - Internal tests: Changed name suffix values in tests. Assembly Line changed its punctuation a while ago.
62
+ - Added doc explaining what internal test results we expect to see as people new to the project are surprised by all our red Fs and yet passing tests.
63
+ - Changed our workflow's `on: pull_request_target` to `on: pull_request`. When the former runs tests, `checkout` checks out the target branch's files. It was unhelpful to test the files of the old branch with the new version of ALKiln. The latter checks out the head branch's files. We should be good now.
51
64
 
52
65
  ## [5.8.1] - 2023-12-28
53
66
 
@@ -1,3 +1,4 @@
1
+ // TODO: Add the error message to the report. Would have to pass in `scope`.
1
2
  module.exports = async function wrapPromiseWithTimeout (
2
3
  promise,
3
4
  timeoutInMilliseconds,
package/lib/scope.js CHANGED
@@ -626,7 +626,7 @@ module.exports = {
626
626
 
627
627
  reports.addToReport(scope,{
628
628
  type: `row`,
629
- value: `Trying to load the interview at "${interview_url}"`
629
+ value: `Trying to load the interview at "${ interview_url }"`
630
630
  });
631
631
 
632
632
  if ( !scope.page ) { scope.page = await scope.browser.newPage(); }
@@ -641,8 +641,9 @@ module.exports = {
641
641
  // If the page didn't load because it took to long to load
642
642
  if ( error.name === `TimeoutError` ) {
643
643
 
644
- let non_reload_report_msg = `Timeout error occurred when ALKiln tried to go to the interview url`;
644
+ let non_reload_report_msg = `Timeout error occurred when ALKiln tried to go to the interview at ${ interview_url }`;
645
645
  await scope.handle_page_timeout_error( scope, { non_reload_report_msg, error });
646
+ // TODO: Should this throw to avoid multiple error messages?
646
647
 
647
648
  // If the page didn't load because of any other reason
648
649
  } else {
@@ -650,7 +651,7 @@ module.exports = {
650
651
  // Throw any non-timeout error
651
652
  reports.addToReport( scope, {
652
653
  type: `error`,
653
- value: `Error occurred when ALKiln tried to go to the interview url`
654
+ value: `Error occurred when ALKiln tried to go to the interview at ${ interview_url }`
654
655
  });
655
656
  throw( error );
656
657
  } // ends if error is timeout error
@@ -658,10 +659,12 @@ module.exports = {
658
659
  } // ends try/catch
659
660
 
660
661
  let load_result = await scope.getLoadData( scope );
661
- // Errors, or reaching timeout, causes an exception and is shown to the developer at the end
662
+ // da page invalidation errors or timeout will show an error to the developer at the end
662
663
  if ( load_result.error ) {
663
- reports.addToReport(scope, { type: `error`, value: `On final attempt to load interview, got "${ load_result.error }"` });
664
+ reports.addToReport(scope, { type: `error`, value: `On final attempt to load interview at "${ interview_url }", got "${ load_result.error }"` });
664
665
  expect( load_result.error ).to.equal( '' );
666
+ } else {
667
+ reports.addToReport(scope, { type: `info`, value: `Successfully found the interview at "${ interview_url }"` });
665
668
  }
666
669
 
667
670
  return scope.page;
@@ -693,6 +696,11 @@ module.exports = {
693
696
 
694
697
  // or if they cause some other kind of error
695
698
  } else {
699
+ reports.addToReport(scope, {
700
+ type: `error`,
701
+ value: `ALKiln got an error when it tried to load the interview page`,
702
+ data: error
703
+ });
696
704
  throw error;
697
705
  } // ends if error.name.includes(`TimeoutError`)
698
706
  }); // ends Promise.race()
package/lib/steps.js CHANGED
@@ -177,12 +177,14 @@ Given(/I start the interview at "([^"]+)"/, {timeout: -1}, async (file_name) =>
177
177
  // Load the right interview page
178
178
  await scope.load( scope, file_name );
179
179
 
180
+ // TODO: Move this above loading? Put it in `Before()` instead?
180
181
  // The page timeout is set in here too in case someone set a custom timeout
181
182
  // before a page was loaded.
182
183
  // The function itself won't really timeout here, so we don't need to wrap it in
183
184
  // a custom timeout
184
185
  await scope.page.setDefaultTimeout( scope.timeout ); // overrides outer default timeout
185
186
 
187
+ // TODO: Move this to the `download` Step and only do it once per scenario
186
188
  // Allow developer to save download files
187
189
  let custom_download_behavior_timeout = new Promise(async ( resolve, reject ) => {
188
190
  let page_timeout = setTimeout(function() {reject( `Took too long to set download behavior.` ); }, scope.timeout);
@@ -236,6 +238,8 @@ Given(/I start the interview at "([^"]+)"/, {timeout: -1}, async (file_name) =>
236
238
  } // ends if this is the file the developer expected
237
239
  }); // ends page.on 'response'
238
240
 
241
+ // TODO: Wrap everything in this step in this timeout? Or is this Step's timeout different?
242
+ // Wait for navigation
239
243
  let custom_afterStep_timeout = new Promise(async ( resolve, reject ) => {
240
244
  let page_timeout = setTimeout(function() { reject(`\`afterStep()\` took too long.`); }, scope.timeout);
241
245
  // self-invoke an anonymous async function so we don't have to
@@ -251,6 +255,22 @@ Given(/I start the interview at "([^"]+)"/, {timeout: -1}, async (file_name) =>
251
255
  await custom_afterStep_timeout;
252
256
  });
253
257
 
258
+ Given(/I go to "([^"]+)"/i, {timeout: -1}, async ( url ) => {
259
+ /** Navigate to an arbitrary url. What you do after that depends on you. There's
260
+ * a limited amount ALKiln can do on a non-docassemble page or a very customized
261
+ * docassemble page.
262
+ *
263
+ * @params {string} A valid url */
264
+ let result = await wrapPromiseWithTimeout(
265
+ scope.page.goto( url, { waitUntil: 'domcontentloaded', timeout: scope.timeout }),
266
+ scope.timeout,
267
+ `It took to long to get to "${ url }"`
268
+ );
269
+
270
+ reports.addToReport(scope, { type: `info`, value: `Successfully went to "${ url }"` });
271
+ return result;
272
+ });
273
+
254
274
  Given(/I (?:sign|log) ?(?:in)?(?:on)?(?:to the server)? with(?: the email)? "([^"]+)" and(?: the password)? "([^"]+)"(?: SECRETs)?/i, {timeout: -1}, async ( email, password ) => {
255
275
  /** Uses the names of environment variables (most often GitHub SECRETs) to
256
276
  * log into an account on the user's server. Must be SECRETs to stay secure.
@@ -294,7 +294,7 @@ session_vars.set_sources_paths = function ( paths ) {
294
294
  }
295
295
 
296
296
  console.info(
297
- `ALKiln info: Did find "sources" folder(s) at "${ existing_paths.join('", "') }".`
297
+ `ALKiln SUCCESS: Did find "sources" file(s) at "${ existing_paths.join('", "') }".`
298
298
  )
299
299
 
300
300
  // Otherwise, store valid paths
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.8.1-feat2columns5",
3
+ "version": "5.9.0-feat-url1",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {