@suffolklitlab/alkiln 5.0.2-feat-github-server-8 → 5.0.2-feat-github-server-9

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.
@@ -8,10 +8,10 @@ on:
8
8
  tags:
9
9
  required: False
10
10
  description: 'Optional. Use a "tag expression" specify which tagged tests to run (https://cucumber.io/docs/cucumber/api/#tag-expressions)'
11
- # Only test 2 tests - one uses an env var, the other uses AL.
12
- # They test if env vars get set correctly and depencencies get
13
- # pulled in correctly.
14
- default: '@e6 or @al1'
11
+ # # Only test 2 tests - one uses an env var, the other uses AL.
12
+ # # They test if env vars get set correctly and depencencies get
13
+ # # pulled in correctly.
14
+ # default: '@al1'
15
15
  enable_tmate:
16
16
  type: boolean
17
17
  description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
@@ -33,6 +33,7 @@ jobs:
33
33
  SECRET_VAR1: secret-var1-value
34
34
  SECRET_VAR2: secret-var2-value
35
35
  SECRET_FOR_MISSING_FIELD: secret for missing field
36
+ _ALKILN_DANGEROUS_DEBUG: true
36
37
 
37
38
  steps:
38
39
  - uses: actions/checkout@v3
@@ -49,10 +50,6 @@ jobs:
49
50
  CONFIG_CONTENTS: "${{ secrets.CONFIG_CONTENTS }}"
50
51
  - run: echo "Finished starting the GitHub server"
51
52
 
52
- ## Temp
53
- #- name: Setup tmate session
54
- # uses: mxschmitt/action-tmate@v3
55
-
56
53
  - name: "Run ALKiln tests"
57
54
  if: ${{ success() }}
58
55
  uses: ./
@@ -60,6 +57,7 @@ jobs:
60
57
  SERVER_URL: "${{ steps.github_server.outputs.SERVER_URL }}"
61
58
  DOCASSEMBLE_DEVELOPER_API_KEY: "${{ steps.github_server.outputs.DOCASSEMBLE_DEVELOPER_API_KEY }}"
62
59
  INSTALL_METHOD: "server"
63
- ALKILN_VERSION: "5.0.2-feat-github-server-8"
60
+ # TODO: See what happens if this is an empty string
61
+ ALKILN_VERSION: "5.0.2-feat-github-server-9"
64
62
  - run: echo "Finished running ALKiln tests"
65
63
 
package/action.yml CHANGED
@@ -81,17 +81,14 @@ runs:
81
81
  if: ${{ inputs.INSTALL_METHOD == 'server' && failure() }}
82
82
  shell: bash
83
83
 
84
- ## debugging
85
- #- name: Setup tmate session
86
- # uses: mxschmitt/action-tmate@v3
87
-
88
84
  ############
89
85
  ##### !!! WARNING: RESTORE CODE FOR TAGS
90
86
  ############
91
87
  # run tests
92
88
  - name: "ALKiln: Run tests"
93
89
  if: ${{ success() }}
94
- run: alkiln-run @e6 or @al1
90
+ # run: alkiln-run @e6 or @al1
91
+ run: alkiln-run @al1
95
92
  shell: bash
96
93
 
97
94
  # run: alkiln-run ${{ github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
@@ -1,7 +1,7 @@
1
1
  name: "ALKiln/github_server: Isolated docassemble tests"
2
2
  description: "Download and start up a temporary docassemble server on GitHub's servers, in an isolated environment. Avoids docassemble reload errors and other external factors."
3
3
 
4
- # Wat?
4
+ # Wat? Exit with 52?
5
5
  # https://github.com/SuffolkLITLab/ALKiln/actions/runs/5912900256/job/16036751264#step:4:188
6
6
  # Had no completion messages, but it exited with an error anyway
7
7
  # Took 121 seconds
@@ -71,8 +71,8 @@ runs:
71
71
  break
72
72
  fi
73
73
 
74
- ## Set the variable to a new string value in each iteration
75
- #result=$(curl -s localhost)
74
+ # Set the variable to a new string value in each iteration
75
+ result=$(curl -s localhost)
76
76
 
77
77
  # Check if the string includes the desired text
78
78
  if [[ ! $result == *"Docassemble is starting"* ]]; then
@@ -88,19 +88,19 @@ runs:
88
88
 
89
89
  - name: Install the package
90
90
  run: |
91
- echo $CLONE_URL
91
+ echo "CLONE_URL is $CLONE_URL"
92
92
  git clone $CLONE_URL
93
93
 
94
94
  # Split the full repository name by '/' and get the last element (repo name)
95
95
  IFS='/' read -ra repo_parts <<< "$OWNER_AND_REPO_NAME"
96
96
  repo_name=${repo_parts[-1]}
97
- echo $repo_name
97
+ echo "repo_name is $repo_name"
98
98
  cd $repo_name
99
99
 
100
- echo "branch ref $BRANCH_REF"
100
+ echo "BRANCH_REF is $BRANCH_REF"
101
101
  ref_name=$BRANCH_REF
102
102
  branch_name="${ref_name#refs/heads/}"
103
- echo "branch name: $branch_name"
103
+ echo "branch name is $branch_name"
104
104
  git checkout -b $branch_name
105
105
  git fetch origin $branch_name
106
106
  git reset --hard origin/$branch_name
@@ -11,18 +11,12 @@ let get_base_interview_url = async function () {
11
11
  * when the user is not logged in.) We can't use `reset=2` because it caused an
12
12
  * 'Unable to locate interview session' error. */
13
13
  let server_url = session_vars.get_da_server_url();
14
- console.log(session_vars.get_install_type());
15
14
  if (session_vars.get_install_type() === "server") {
16
- let x = `${ server_url }/interview?new_session=1&i=docassemble.${session_vars.get_package_name().replace("-", ".")}%3Adata/questions/`;
17
- // e.g. http://localhost/interview?new_session=1&i=ALKiln%3A
18
- console.log(`base_interview_url: ${x}`)
19
- return x;
15
+ return `${ server_url }/interview?new_session=1&i=docassemble.${session_vars.get_package_name().replace("-", ".")}%3Adata/questions/`;
20
16
  } else {
21
17
  let dev_id = await docassemble_api_interface.get_dev_id();
22
18
  let project_name = session_vars.get_project_name();
23
- let x = `${ server_url }/interview?new_session=1&i=docassemble.playground${ dev_id }${ project_name }%3A`;
24
- console.log(`base_interview_url: ${x}`)
25
- return x;
19
+ return `${ server_url }/interview?new_session=1&i=docassemble.playground${ dev_id }${ project_name }%3A`;
26
20
  }
27
21
  };
28
22
 
package/lib/scope.js CHANGED
@@ -44,6 +44,9 @@ let printable_var_value = function(row) {
44
44
  /* `row` might be a row, a source row, or an original row. */
45
45
  let original = get_original_row(row);
46
46
  if ( is_secret_var(original) ) {
47
+ if ( session_vars.get_dangerous_debug() ) {
48
+ return `alkiln_dangerous ${ row.value }`;
49
+ }
47
50
  return original.flags.secret_name;
48
51
  }
49
52
  return row.value;
@@ -755,7 +758,7 @@ module.exports = {
755
758
  if ( session_vars.get_debug() ) { console.log( `interview_url:`, interview_url ); }
756
759
 
757
760
  if ( !scope.page ) { scope.page = await scope.browser.newPage(); }
758
-
761
+
759
762
  console.log(`interview_url:`, interview_url);
760
763
 
761
764
  // TODO: implement and use scope.handle_possible_timeout()
@@ -2522,6 +2525,10 @@ module.exports = {
2522
2525
  /** Sets a non-story table variable to a "secret" value (i.e. an env var) */
2523
2526
  // Prevent pictures of a screen with a secret.
2524
2527
  scope.disable_error_screenshot = true;
2528
+ if ( session_vars.get_dangerous_debug() ) {
2529
+ scope.disable_error_screenshot = false;
2530
+ }
2531
+
2525
2532
  let var_data = await scope.normalizeTable( scope, {
2526
2533
  var_data: [{
2527
2534
  var: var_name,
@@ -2665,7 +2672,10 @@ module.exports = {
2665
2672
  */
2666
2673
  // Don't take a picture of a failed login in case one of the inputs is correct
2667
2674
  scope.disable_error_screenshot = true;
2668
-
2675
+ if ( session_vars.get_dangerous_debug() ) {
2676
+ scope.disable_error_screenshot = false;
2677
+ }
2678
+
2669
2679
  // If there is no browser open, start a new one
2670
2680
  if (!scope.browser) {
2671
2681
  scope.browser = await scope.driver.launch({ headless: !session_vars.DEBUG });
@@ -2698,6 +2708,10 @@ module.exports = {
2698
2708
  let email = process.env[ email_secret_name ];
2699
2709
  let password = process.env[ password_secret_name ];
2700
2710
 
2711
+ if ( session_vars.get_dangerous_debug() ) {
2712
+ log.debug({ type: `unsafe`, data: `login: ${ email }, ${ password }` });
2713
+ }
2714
+
2701
2715
  // Give as many useful messages to the user as possible if the env vars
2702
2716
  // aren't defined. Eventually, just provide a link to the docs because
2703
2717
  // this is complex
@@ -23,6 +23,7 @@ module.exports = session_vars;
23
23
  // These default to null
24
24
  // TODO: How to isolate debug elsewhere so this file can use the logger?
25
25
  session_vars.get_debug = function () { return process.env.DEBUG || null; };
26
+ session_vars.get_dangerous_debug = function () { return process.env._ALKILN_DANGEROUS_DEBUG || null; };
26
27
  session_vars.is_dev_env = function () { return process.env.DEV || null; }
27
28
 
28
29
  session_vars.get_dev_api_key = function () { return process.env.DOCASSEMBLE_DEVELOPER_API_KEY || null; };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.0.2-feat-github-server-8",
3
+ "version": "5.0.2-feat-github-server-9",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {