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

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-10"
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 @e6
95
92
  shell: bash
96
93
 
97
94
  # run: alkiln-run ${{ github.event.inputs.tags && format('{0}', github.event.inputs.tags) }}
@@ -1,12 +1,14 @@
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
8
8
  # The rerun of the test completed that step just fine, though it took less time
9
9
  # Took 120 and was fine: https://github.com/SuffolkLITLab/ALKiln/actions/runs/5913167036/job/16037288791
10
+ # 150:
11
+ # https://github.com/SuffolkLITLab/ALKiln/actions/runs/5914677262/job/16040233419
10
12
 
11
13
  inputs:
12
14
  CONFIG_CONTENTS:
@@ -24,6 +26,12 @@ outputs:
24
26
  SERVER_URL:
25
27
  description: "Use this inside `with:` for the ALKiln step. URL of the temporary docassemble server."
26
28
  value: "http://localhost"
29
+ DA_ADMIN_EMAIL:
30
+ #value: ${{ steps.api_key_output_step.outputs.DA_ADMIN_EMAIL }}
31
+ value: "admin@example.com"
32
+ DA_ADMIN_PASSWORD:
33
+ #value: ${{ steps.api_key_output_step.outputs.DA_ADMIN_PASSWORD }}
34
+ value: "password"
27
35
 
28
36
 
29
37
  runs:
@@ -36,9 +44,14 @@ runs:
36
44
  echo "CLONE_URL=${{ github.server_url }}/${{ github.repository }}.git" >> $GITHUB_ENV
37
45
  echo "OWNER_AND_REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV
38
46
  echo "BRANCH_REF=${{ github.ref }}" >> $GITHUB_ENV
47
+ echo "DA_ADMIN_EMAIL=admin@example.com" >> $GITHUB_ENV
48
+ echo "DA_ADMIN_PASSWORD=password" >> $GITHUB_ENV
39
49
  shell: bash
40
50
  - id: api_key_output_step
41
- run: echo "::set-output name=DOCASSEMBLE_DEVELOPER_API_KEY::$DA_ADMIN_API_KEY"
51
+ run: |
52
+ echo "::set-output name=DOCASSEMBLE_DEVELOPER_API_KEY::$DA_ADMIN_API_KEY"
53
+ echo "::set-output name=DA_ADMIN_EMAIL::$DA_ADMIN_EMAIL"
54
+ echo "::set-output name=DA_ADMIN_PASSWORD::$DA_ADMIN_PASSWORD"
42
55
  shell: bash
43
56
  - name: "github_server: Download and start docker"
44
57
  run: |
@@ -71,8 +84,8 @@ runs:
71
84
  break
72
85
  fi
73
86
 
74
- ## Set the variable to a new string value in each iteration
75
- #result=$(curl -s localhost)
87
+ # Set the variable to a new string value in each iteration
88
+ result=$(curl -s localhost)
76
89
 
77
90
  # Check if the string includes the desired text
78
91
  if [[ ! $result == *"Docassemble is starting"* ]]; then
@@ -88,19 +101,19 @@ runs:
88
101
 
89
102
  - name: Install the package
90
103
  run: |
91
- echo $CLONE_URL
104
+ echo "CLONE_URL is $CLONE_URL"
92
105
  git clone $CLONE_URL
93
106
 
94
107
  # Split the full repository name by '/' and get the last element (repo name)
95
108
  IFS='/' read -ra repo_parts <<< "$OWNER_AND_REPO_NAME"
96
109
  repo_name=${repo_parts[-1]}
97
- echo $repo_name
110
+ echo "repo_name is $repo_name"
98
111
  cd $repo_name
99
112
 
100
- echo "branch ref $BRANCH_REF"
113
+ echo "BRANCH_REF is $BRANCH_REF"
101
114
  ref_name=$BRANCH_REF
102
115
  branch_name="${ref_name#refs/heads/}"
103
- echo "branch name: $branch_name"
116
+ echo "branch name is $branch_name"
104
117
  git checkout -b $branch_name
105
118
  git fetch origin $branch_name
106
119
  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
package/lib/utils/log.js CHANGED
@@ -42,7 +42,7 @@ log.error = function ({ type='', pre='', data='', post='' }) {
42
42
 
43
43
  log.debug = function ({ type='', pre='', data='', post='' }) {
44
44
  /* If debugging is turned on, log a message that includes `ALKiln` and `debug` */
45
- if ( session_vars.get_debug() ) {
45
+ if ( session_vars.get_debug() || session_vars.get_dangerous_debug() ) {
46
46
  let start = create_msg_start([ type, 'debug' ], pre );
47
47
  // Log them each on a separate line
48
48
  console.log( `ALKiln ${ type } debug: ${ pre }` );
@@ -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-10",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
package/setup.py CHANGED
@@ -53,7 +53,7 @@ setup(name='docassemble.ALKiln',
53
53
  url='https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/automated_integrated_testing',
54
54
  packages=find_packages(),
55
55
  namespace_packages=['docassemble'],
56
- install_requires=['docassemble.ALToolbox>=0.5.1'],
56
+ install_requires=['docassemble.ALToolbox>=0.8.2', 'docassemble.AssemblyLine>=2.24.0'],
57
57
  zip_safe=False,
58
58
  package_data=find_package_data(where='docassemble/ALKiln/', package='docassemble.ALKiln'),
59
59
  )