@suffolklitlab/alkiln 5.0.0-pre-11 → 5.0.1
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/.github/workflows/test_tests.yml +0 -8
- package/CHANGELOG.md +8 -1
- package/CONTRIBUTING.md +1 -1
- package/action.yml +3 -21
- package/lib/scope.js +2 -25
- package/npm-shrinkwrap.json +2 -3
- package/package.json +2 -6
- package/tests/unit_tests/getSafeScenarioBaseFilename.test.js +0 -14
- package/tests/unit_tests/getSafeScenarioFilename.test.js +1 -1
- package/lib/utils/langs.js +0 -51
|
@@ -4,10 +4,6 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
workflow_dispatch:
|
|
6
6
|
inputs:
|
|
7
|
-
extra_languages:
|
|
8
|
-
required: False
|
|
9
|
-
description: 'Optional. A list of comma separated language names visible on buttons or links that change the language of the interview. Overrides the EXTRA_LANGUAGES repo secret.'
|
|
10
|
-
default: ''
|
|
11
7
|
tags:
|
|
12
8
|
required: False
|
|
13
9
|
description: 'Optional. Use a "tag expression" specify which tagged tests to run (https://cucumber.io/docs/cucumber/api/#tag-expressions)'
|
|
@@ -28,7 +24,6 @@ jobs:
|
|
|
28
24
|
PLAYGROUND_PASSWORD: ${{ secrets.PLAYGROUND_PASSWORD }}
|
|
29
25
|
PLAYGROUND_ID: ${{ secrets.PLAYGROUND_ID }}
|
|
30
26
|
DOCASSEMBLE_DEVELOPER_API_KEY: ${{ secrets.DOCASSEMBLE_DEVELOPER_API_KEY }}
|
|
31
|
-
EXTRA_LANGUAGES: ${{ secrets.EXTRA_LANGUAGES }}
|
|
32
27
|
USER1_EMAIL: ${{ secrets.USER1_EMAIL }}
|
|
33
28
|
USER1_PASSWORD: ${{ secrets.USER1_PASSWORD }}
|
|
34
29
|
SECRET_VAR1: secret-var1-value
|
|
@@ -47,9 +42,6 @@ jobs:
|
|
|
47
42
|
run: |
|
|
48
43
|
echo "ARTIFACT_NAME=alkiln-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
|
|
49
44
|
echo "UNIT_TESTS_ARTIFACT_NAME=_alkiln-misc-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
|
|
50
|
-
- name: Set languages
|
|
51
|
-
run: echo "EXTRA_LANGUAGES=${{ github.event.inputs.extra_languages }}" >> $GITHUB_ENV
|
|
52
|
-
if: ${{ github.event.inputs.extra_languages != '' }}
|
|
53
45
|
# For the testing repo, the `REPO_URL` is that of a different repo and is created in `env:`
|
|
54
46
|
- run: echo "Repo address is $REPO_URL"
|
|
55
47
|
- name: Checkout
|
package/CHANGELOG.md
CHANGED
|
@@ -38,7 +38,13 @@ Format:
|
|
|
38
38
|
### Security
|
|
39
39
|
-
|
|
40
40
|
-->
|
|
41
|
-
## [Unreleased]
|
|
41
|
+
<!-- ## [Unreleased] -->
|
|
42
|
+
|
|
43
|
+
## [5.0.1] - 2023-07-18
|
|
44
|
+
### Changed
|
|
45
|
+
- Increment version of ALKiln that action.yml is using.
|
|
46
|
+
|
|
47
|
+
## [5.0.0] - 2023-07-18
|
|
42
48
|
### Added
|
|
43
49
|
- added additional functionality to the sign method to allow developers to take a name argument to sign on canvas: issue #596
|
|
44
50
|
- A new script: `alkiln-run`, which acts like `npm run cucumber`, but can
|
|
@@ -51,6 +57,7 @@ Format:
|
|
|
51
57
|
### Changed
|
|
52
58
|
- BREAKING: the github action no longer runs `npm run XYZ`; it directly calls scripts,
|
|
53
59
|
e.g. `alkiln-setup`, `alkiln-run`, `alkiln-takedown`
|
|
60
|
+
- BREAKING: Remove EXTRA_LANGUAGES env var as languages are being handled through cucumber `Examples` now.
|
|
54
61
|
- upgraded cucumber v8.6.0
|
|
55
62
|
- using cucumber's JS API to run tests. For more details on how it works,
|
|
56
63
|
see [the cucumber-js docs](https://github.com/cucumber/cucumber-js/blob/main/docs/javascript_api.md).
|
package/CONTRIBUTING.md
CHANGED
|
@@ -204,7 +204,7 @@ If you want to know the commands, you can go to the [instructions for running te
|
|
|
204
204
|
|
|
205
205
|
### Files that you don't need to look at
|
|
206
206
|
|
|
207
|
-
`index.js` and `world.js` are short files that cucumber needs.
|
|
207
|
+
`index.js` and `world.js` are short files that cucumber needs.
|
|
208
208
|
|
|
209
209
|
## Footnotes
|
|
210
210
|
|
package/action.yml
CHANGED
|
@@ -17,17 +17,13 @@ inputs:
|
|
|
17
17
|
DOCASSEMBLE_DEVELOPER_API_KEY:
|
|
18
18
|
description: 'API key of the testing account with developer permissions on your docassemble server.'
|
|
19
19
|
required: true
|
|
20
|
-
EXTRA_LANGUAGES:
|
|
21
|
-
description: 'Other languages you want to test. This should be in your GitHub SECRETS or the SECRETS of your org.'
|
|
22
|
-
required: false
|
|
23
|
-
default: ''
|
|
24
20
|
# This is necessary to test pre-releases at the very least. It does seem
|
|
25
21
|
# strange considering we're controlling everything through the action, but
|
|
26
22
|
# that actually doesn't touch the npm version that's pulled in.
|
|
27
23
|
ALKILN_VERSION:
|
|
28
24
|
description: 'Version of ALKiln to get from npm.'
|
|
29
25
|
required: false
|
|
30
|
-
default: '^
|
|
26
|
+
default: '^5.0.0'
|
|
31
27
|
MAX_SECONDS_FOR_SETUP:
|
|
32
28
|
description: "Amount of time to give the Project to upload your package's GitHub code."
|
|
33
29
|
required: false
|
|
@@ -38,20 +34,10 @@ runs:
|
|
|
38
34
|
steps:
|
|
39
35
|
# Set environment variables
|
|
40
36
|
- name: "ALKiln: Set environment variables"
|
|
41
|
-
# If extra languages were set manually, override the repository
|
|
42
|
-
# EXTRA_LANGUAGES secret with the manually set values
|
|
43
37
|
# Human-readable date/time:
|
|
44
38
|
# https://www.shell-tips.com/linux/how-to-format-date-and-time-in-linux-macos-and-bash/#how-to-format-a-date-in-bash
|
|
45
39
|
run: |
|
|
46
40
|
echo "ARTIFACT_NAME=alkiln-$(date +'%Y-%m-%d at %Hh%Mm%Ss' -u)UTC" >> $GITHUB_ENV
|
|
47
|
-
if ${{ github.event.inputs.extra_languages != '' }}
|
|
48
|
-
then
|
|
49
|
-
echo "Manually set languages: ${{ github.event.inputs.extra_languages }}"
|
|
50
|
-
echo "EXTRA_LANGUAGES=${{ github.event.inputs.extra_languages }}" >> $GITHUB_ENV
|
|
51
|
-
else
|
|
52
|
-
echo "Use EXTRA_LANGUAGES secret: ${{ inputs.EXTRA_LANGUAGES }}"
|
|
53
|
-
echo "EXTRA_LANGUAGES=${{ inputs.EXTRA_LANGUAGES }}" >> $GITHUB_ENV
|
|
54
|
-
fi
|
|
55
41
|
echo "REPO_URL=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_ENV
|
|
56
42
|
echo "BRANCH_PATH=${{ github.ref }}" >> $GITHUB_ENV
|
|
57
43
|
echo "BASE_URL=${{ inputs.SERVER_URL }}" >> $GITHUB_ENV
|
|
@@ -65,8 +51,7 @@ runs:
|
|
|
65
51
|
shell: bash
|
|
66
52
|
- name: "ALKiln: confirm info"
|
|
67
53
|
run: |
|
|
68
|
-
echo -e "\nRepo is $REPO_URL\nBranch ref is $BRANCH_PATH\
|
|
69
|
-
echo -e "\nALKiln version is $ALKILN_VERSION\nRepo is $REPO_URL\nBranch ref is $BRANCH_PATH\nMAX_SECONDS_FOR_SETUP is $MAX_SECONDS_FOR_SETUP\nManually added languages are $EXTRA_LANGUAGES\n"
|
|
54
|
+
echo -e "\nALKiln version is $ALKILN_VERSION\nRepo is $REPO_URL\nBranch ref is $BRANCH_PATH\nMAX_SECONDS_FOR_SETUP is $MAX_SECONDS_FOR_SETUP\n"
|
|
70
55
|
shell: bash
|
|
71
56
|
|
|
72
57
|
# Install node
|
|
@@ -76,7 +61,7 @@ runs:
|
|
|
76
61
|
node-version: "18"
|
|
77
62
|
- name: Install ALKiln directly from npm
|
|
78
63
|
run: |
|
|
79
|
-
npm install -g
|
|
64
|
+
npm install -g @suffolklitlab/alkiln
|
|
80
65
|
shell: bash
|
|
81
66
|
|
|
82
67
|
# Run tests
|
|
@@ -113,9 +98,6 @@ runs:
|
|
|
113
98
|
# push:
|
|
114
99
|
# workflow_dispatch:
|
|
115
100
|
# inputs:
|
|
116
|
-
# extra_languages:
|
|
117
|
-
# description: 'Optional. A list of comma separated language names visible on buttons or links in the interview that change the language of the interview. Overrides the EXTRA_LANGUAGES GitHub secret.'
|
|
118
|
-
# default: ''
|
|
119
101
|
# tags:
|
|
120
102
|
# description: 'Optional. Use a "tag expression" specify which tagged tests to run. See https://cucumber.io/docs/cucumber/api/#tag-expressions for syntax.'
|
|
121
103
|
# default: ''
|
package/lib/scope.js
CHANGED
|
@@ -230,17 +230,9 @@ module.exports = {
|
|
|
230
230
|
|
|
231
231
|
getSafeScenarioBaseFilename: async function( scope, { scenario }) {
|
|
232
232
|
/** Return a string that's safe to be a filename. Include the Scenario
|
|
233
|
-
* description
|
|
233
|
+
* description and tags.
|
|
234
234
|
*/
|
|
235
|
-
let
|
|
236
|
-
|
|
237
|
-
// Try to order filenames by language if possible/needed
|
|
238
|
-
if ( scope.language ) {
|
|
239
|
-
name_parts.push( scope.language );
|
|
240
|
-
}
|
|
241
|
-
name_parts.push( scenario.pickle.name );
|
|
242
|
-
|
|
243
|
-
let filename = name_parts.join(`-`);
|
|
235
|
+
let filename = scenario.pickle.name;
|
|
244
236
|
let safe_name = safe_filename( filename, { replacement: `_` });
|
|
245
237
|
// Allow room for extensions, date, etc.
|
|
246
238
|
let short_name = `${ safe_name }`.substring(0, 70);
|
|
@@ -854,21 +846,6 @@ module.exports = {
|
|
|
854
846
|
return result;
|
|
855
847
|
}, // Ends scope.getLoadData()
|
|
856
848
|
|
|
857
|
-
setLanguage: async function ( scope, { language }) {
|
|
858
|
-
// Tap the language button if given
|
|
859
|
-
let lang_url = null;
|
|
860
|
-
if ( language ) {
|
|
861
|
-
|
|
862
|
-
let [lang_link] = await scope.page.$x(`//a[text()="${ language }"]`);
|
|
863
|
-
|
|
864
|
-
let msg = `Could not find the link with the text "${ language }"`;
|
|
865
|
-
if ( !lang_link ) { await scope.addToReport(scope, { type: `error`, value: msg }); }
|
|
866
|
-
expect( lang_link, msg ).to.exist; // Cause test failure
|
|
867
|
-
|
|
868
|
-
await scope.tapElement( scope, lang_link );
|
|
869
|
-
}
|
|
870
|
-
}, // Ends scope.setLanguage()
|
|
871
|
-
|
|
872
849
|
normalizeTable: async function ( scope, { var_data=null, raw_var_data=null }) {
|
|
873
850
|
/* Return data derived from cucumber variable-setting data, from either an object format
|
|
874
851
|
* (var_data) or an array format (raw_var_data). `var_data` only is used when calling
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suffolklitlab/alkiln",
|
|
3
|
-
"version": "5.0.0",
|
|
3
|
+
"version": "5.0.0-pre-11",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@suffolklitlab/alkiln",
|
|
9
|
-
"version": "5.0.0",
|
|
9
|
+
"version": "5.0.0-pre-11",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@axe-core/puppeteer": "4.7.3",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"uuid": "8.3.2"
|
|
27
27
|
},
|
|
28
28
|
"bin": {
|
|
29
|
-
"alkiln-langs": "lib/utils/langs.js",
|
|
30
29
|
"alkiln-run": "lib/run_cucumber.js",
|
|
31
30
|
"alkiln-setup": "lib/docassemble/setup.js",
|
|
32
31
|
"alkiln-takedown": "lib/docassemble/takedown.js"
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suffolklitlab/alkiln",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "npm run unit && npm run
|
|
7
|
+
"test": "npm run unit && npm run cucumber",
|
|
8
8
|
"cucumber": "./lib/run_cucumber.js",
|
|
9
|
-
"langs": "npm run langs_setup && npm run cucumber",
|
|
10
|
-
"langs_setup": "./lib/utils/langs.js 'docassemble/*/data/sources/*.feature'",
|
|
11
|
-
"langs_local": "npm run langs_setup && npm run local",
|
|
12
9
|
"local": "npm run setup && npm run cucumber; npm run takedown",
|
|
13
10
|
"setup": "./lib/docassemble/setup.js",
|
|
14
11
|
"takedown": "./lib/docassemble/takedown.js",
|
|
@@ -52,7 +49,6 @@
|
|
|
52
49
|
"bin": {
|
|
53
50
|
"alkiln-setup": "./lib/docassemble/setup.js",
|
|
54
51
|
"alkiln-takedown": "./lib/docassemble/takedown.js",
|
|
55
|
-
"alkiln-langs": "./lib/utils/langs.js",
|
|
56
52
|
"alkiln-run": "./lib/run_cucumber.js"
|
|
57
53
|
}
|
|
58
54
|
}
|
|
@@ -16,11 +16,6 @@ let mock_scenario = function ( description ) {
|
|
|
16
16
|
|
|
17
17
|
describe(`When I use scope.getSafeScenarioBaseFilename()`, function() {
|
|
18
18
|
|
|
19
|
-
beforeEach(function() {
|
|
20
|
-
scope.language = undefined;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// No language
|
|
24
19
|
it(`preserves spaces`, async function() {
|
|
25
20
|
let scenario = mock_scenario( names.with_spaces );
|
|
26
21
|
let result = await getSafeScenarioBaseFilename( scope, { scenario });
|
|
@@ -45,13 +40,4 @@ describe(`When I use scope.getSafeScenarioBaseFilename()`, function() {
|
|
|
45
40
|
expect( result ).to.equal( names.long_output );
|
|
46
41
|
});
|
|
47
42
|
|
|
48
|
-
// language
|
|
49
|
-
it(`adds a language correctly to a description`, async function() {
|
|
50
|
-
scope.language = names.non_english_chars;
|
|
51
|
-
let scenario = mock_scenario( names.with_spaces );
|
|
52
|
-
let result = await getSafeScenarioBaseFilename( scope, { scenario });
|
|
53
|
-
let expected = `${ names.non_english_chars }-${ names.with_spaces }`;
|
|
54
|
-
expect( result ).to.equal( expected );
|
|
55
|
-
});
|
|
56
|
-
|
|
57
43
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
const getSafeScenarioFilename = scope.getSafeScenarioFilename;
|
|
8
8
|
|
|
9
9
|
let test_filename = function ( expected_prefix, result ) {
|
|
10
|
-
/* Test a name to see if it's valid output with a
|
|
10
|
+
/* Test a name to see if it's valid output with a prefix defined, like `aXe`. */
|
|
11
11
|
let expected_name_regex_str = `^${ expected_prefix }-${ names.description }-\.{13}$`;
|
|
12
12
|
if ( expected_prefix == `` ) {
|
|
13
13
|
expected_name_regex_str = `^${ names.description }-\.{13}$`;
|
package/lib/utils/langs.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
let _path = require('path');
|
|
4
|
-
let fs = require('fs');
|
|
5
|
-
const fg = require('fast-glob');
|
|
6
|
-
|
|
7
|
-
let session_vars = require('./session_vars');
|
|
8
|
-
|
|
9
|
-
// Get the glob filepaths to find all the test files
|
|
10
|
-
let dir_root = process.env.INIT_CWD; // Path to root of project
|
|
11
|
-
let test_glob = process.argv[2]; // String of glob (regex for filepaths)
|
|
12
|
-
let filepaths = fg.sync( _path.resolve( dir_root, test_glob ) );
|
|
13
|
-
let flag = '_lang_';
|
|
14
|
-
|
|
15
|
-
let langs = session_vars.get_languages();
|
|
16
|
-
|
|
17
|
-
// Generate new language files
|
|
18
|
-
for ( let full_path of filepaths ) { // Handle old language files before creating new ones.
|
|
19
|
-
|
|
20
|
-
// Don't apply this to the example test that this package always provides
|
|
21
|
-
if ( full_path.includes( 'example_test.feature' )) { continue; }
|
|
22
|
-
|
|
23
|
-
// Delete already existing non-default language files and skip the rest of this. For example,
|
|
24
|
-
// if 3 languages were tested previously and now only two are being tested.
|
|
25
|
-
if ( full_path.includes( flag )) {
|
|
26
|
-
fs.unlinkSync( full_path );
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
for ( let lang of langs ) { // Create new language files
|
|
31
|
-
// Get and change the text from the file to add the language to it
|
|
32
|
-
let data = fs.readFileSync( full_path, 'utf8' );
|
|
33
|
-
let result = data.replace(/(Given I start the interview.*$)/gm, `$1 in lang "${ lang }"`);
|
|
34
|
-
|
|
35
|
-
// Unicode category for NOT language characters \P{L}
|
|
36
|
-
const lang_escaped = lang.replace(/(\P{L})+/gu, '_');
|
|
37
|
-
|
|
38
|
-
// append generated language tags to existing Feature tags if they exist
|
|
39
|
-
const tags_regex = /(?:(?<tags>@.*)\n)?(?=Feature:)/;
|
|
40
|
-
result = result.replace(tags_regex, (_, tags) => `${tags ? tags + ' ' : ''}@generated @lang @${ lang_escaped }\n`);
|
|
41
|
-
|
|
42
|
-
// Save the file to the same folder with a new name indicating the language
|
|
43
|
-
let test_dir = _path.dirname( full_path );
|
|
44
|
-
// Put it alphabetically next to its matching tests by starting with the same name (discuss)
|
|
45
|
-
let orig_filename = _path.basename( full_path ).replace('.feature', '');
|
|
46
|
-
let filename = `${ orig_filename }${ flag }${ lang_escaped }.feature`;
|
|
47
|
-
let fullPath = _path.resolve( test_dir, filename );
|
|
48
|
-
// Always overwrite previous versions of the file if they exist
|
|
49
|
-
fs.writeFileSync(fullPath, result, { encoding:'utf8', flag:'w' });
|
|
50
|
-
}
|
|
51
|
-
}
|