@suffolklitlab/alkiln 5.9.0-feat-url4 → 5.9.0-feat-url7
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/playground.yml +5 -0
- package/CHANGELOG.md +9 -1
- package/lib/cucumber_8_shim.js +1 -1
- package/lib/scope.js +10 -17
- package/lib/steps.js +1 -2
- package/package.json +1 -1
- package/tests/unit_tests/fields.fixtures.js +70 -0
- package/tests/unit_tests/getAllFields.test.js +10 -2
- package/tests/unit_tests/html.fixtures.js +56 -1
|
@@ -44,6 +44,11 @@ jobs:
|
|
|
44
44
|
# relative paths to action files
|
|
45
45
|
- uses: actions/checkout@v3
|
|
46
46
|
|
|
47
|
+
- name: Pause between triggers
|
|
48
|
+
if: (github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork)
|
|
49
|
+
shell: bash
|
|
50
|
+
run: sleep 30
|
|
51
|
+
|
|
47
52
|
#### Developer note: you'll need to replace `.` with the path to
|
|
48
53
|
#### the repo and branch and leave off the trailing `/`
|
|
49
54
|
#### For example suffolkLITLab/ALKiln@v5
|
package/CHANGELOG.md
CHANGED
|
@@ -48,7 +48,15 @@ Format:
|
|
|
48
48
|
### Added
|
|
49
49
|
|
|
50
50
|
- New Step: 'I go to ""' to go to any arbitrary url, not just arbitrary interview urls.
|
|
51
|
-
- New navigation report messages
|
|
51
|
+
- New navigation report messages.
|
|
52
|
+
- Avoid waiting for "success" on sign in. Not everyone has it.
|
|
53
|
+
- Allow non-local environments to get debug logs.
|
|
54
|
+
|
|
55
|
+
### Internal
|
|
56
|
+
|
|
57
|
+
- Handle non-existence of `elem` more robustly when checking for `elem.disabled`
|
|
58
|
+
- Add a pause between pull request tests and push tests when the PR is coming from our own repo
|
|
59
|
+
- Make getting page field values more robust by doing more to ensure that undefined values don't cause errors
|
|
52
60
|
|
|
53
61
|
## [5.9.0] - 2024-02-11
|
|
54
62
|
|
package/lib/cucumber_8_shim.js
CHANGED
package/lib/scope.js
CHANGED
|
@@ -991,6 +991,7 @@ module.exports = {
|
|
|
991
991
|
/* Return variable names and values combined in ways that can
|
|
992
992
|
* try to match table rows. Tables can have two properties:
|
|
993
993
|
* variable name and value. */
|
|
994
|
+
if ( session_vars.get_debug() ) { console.log(`scope.getPossibleTableRowMatchers() var_names:`, var_names, `values:`, values); }
|
|
994
995
|
let possible_table_rows = [];
|
|
995
996
|
for ( let var_name of var_names ) {
|
|
996
997
|
// Inputs like textareas don't have values
|
|
@@ -1001,7 +1002,8 @@ module.exports = {
|
|
|
1001
1002
|
// Modified from https://stackoverflow.com/a/8571649/11416267
|
|
1002
1003
|
// DA doesn't use `==` to pad base 64
|
|
1003
1004
|
// TODO: How are 'None', 'True', and 'False' being handled?
|
|
1004
|
-
if (value !==
|
|
1005
|
+
if (value !== undefined && value !== null
|
|
1006
|
+
&& value !== 'None' && value !== 'True' && value !== 'False'
|
|
1005
1007
|
&& value.match(da_base64_regex)) {
|
|
1006
1008
|
let value_decoded = fromBase64(value);
|
|
1007
1009
|
let values_decoded = scope.decodeFully( scope, { expr_str: value_decoded });
|
|
@@ -1254,7 +1256,10 @@ module.exports = {
|
|
|
1254
1256
|
let options = [];
|
|
1255
1257
|
let option_nodes = $select.find( `option` );
|
|
1256
1258
|
for ( let opt of option_nodes ) {
|
|
1257
|
-
options
|
|
1259
|
+
// Some options don't have a value, like for ajax comboboxes
|
|
1260
|
+
if ( opt.attribs.value !== undefined ) {
|
|
1261
|
+
options.push( opt.attribs.value );
|
|
1262
|
+
}
|
|
1258
1263
|
// Dropdowns created w/ objects are base64 encoded; but it's handled in getPossibleTableRowMatchers
|
|
1259
1264
|
}
|
|
1260
1265
|
return options;
|
|
@@ -1499,7 +1504,6 @@ module.exports = {
|
|
|
1499
1504
|
|
|
1500
1505
|
let handle = await scope.get_handle_from_field( scope, { field: field });
|
|
1501
1506
|
// TODO: expect elem to exist
|
|
1502
|
-
expect(handle).to.exist; // I don't think this is sufficient. Maybe in function called above instead
|
|
1503
1507
|
|
|
1504
1508
|
// After each previous input, figure out if this input is (now/still) disabled
|
|
1505
1509
|
// TODO: Consider testing for disabled this before we get the matching row
|
|
@@ -1508,18 +1512,12 @@ module.exports = {
|
|
|
1508
1512
|
// sometimes it blocks nodes from clicks. Scroll item to the bottom instead.
|
|
1509
1513
|
// Note: I'm not sure how we'd get in here if `elem` didn't exist, but
|
|
1510
1514
|
// I once got an error here that I couldn't read `.disabled` of `null`.
|
|
1511
|
-
|
|
1512
|
-
// if ( elem && !elem.disabled ) {
|
|
1513
|
-
// elem.scrollIntoView(false);
|
|
1514
|
-
// return elem.disabled;
|
|
1515
|
-
// } else {
|
|
1516
|
-
// return false;
|
|
1517
|
-
// }
|
|
1518
|
-
|
|
1519
1515
|
if ( elem && !elem.disabled ) {
|
|
1520
1516
|
elem.scrollIntoView(false);
|
|
1517
|
+
return elem.disabled;
|
|
1518
|
+
} else {
|
|
1519
|
+
return false;
|
|
1521
1520
|
}
|
|
1522
|
-
return elem.disabled;
|
|
1523
1521
|
});
|
|
1524
1522
|
|
|
1525
1523
|
// If field is disabled, don't set it yet
|
|
@@ -2860,11 +2858,6 @@ module.exports = {
|
|
|
2860
2858
|
let elem = await scope.page.$( `button[name="submit"]` );
|
|
2861
2859
|
await scope.tapElementAndNavigate( scope, { elem });
|
|
2862
2860
|
|
|
2863
|
-
// Wait to see the success message.
|
|
2864
|
-
// This is a bit of an assumption and needs success and failure testing
|
|
2865
|
-
// TODO: use a Promise.race to fail faster.
|
|
2866
|
-
await scope.page.waitForSelector( `.datopcenter .alert-success` );
|
|
2867
|
-
|
|
2868
2861
|
reports.addToReport( scope, {
|
|
2869
2862
|
type: `row`,
|
|
2870
2863
|
value: `Signed into ${ session_vars.get_da_server_url() }/user/sign-in successfully.`
|
package/lib/steps.js
CHANGED
|
@@ -177,9 +177,8 @@ 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?
|
|
181
180
|
// The page timeout is set in here too in case someone set a custom timeout
|
|
182
|
-
// before a page was loaded.
|
|
181
|
+
// just before a page was loaded for the Scenario. Move this to just after page creation?
|
|
183
182
|
// The function itself won't really timeout here, so we don't need to wrap it in
|
|
184
183
|
// a custom timeout
|
|
185
184
|
await scope.page.setDefaultTimeout( scope.timeout ); // overrides outer default timeout
|
package/package.json
CHANGED
|
@@ -1108,6 +1108,76 @@ fields.object_multiselect = [
|
|
|
1108
1108
|
},
|
|
1109
1109
|
];
|
|
1110
1110
|
|
|
1111
|
+
// ============================
|
|
1112
|
+
// Ajax combobox
|
|
1113
|
+
// ============================
|
|
1114
|
+
fields.ajax = [
|
|
1115
|
+
{
|
|
1116
|
+
"selector": "#daquestion input[name=\"ZmF2b3JpdGVfd29yZA\"]",
|
|
1117
|
+
"tag": "input",
|
|
1118
|
+
"guesses": [
|
|
1119
|
+
{
|
|
1120
|
+
"var": "ZmF2b3JpdGVfd29yZA",
|
|
1121
|
+
"value": ""
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
"var": "favorite_word",
|
|
1125
|
+
"value": ""
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
"type": "hidden",
|
|
1129
|
+
"trigger": ""
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
"selector": "#daquestion input[id=\"ZmF2b3JpdGVfd29yZA\"][class=\"form-control da-ajax-combobox\"]",
|
|
1133
|
+
"tag": "input",
|
|
1134
|
+
"guesses": [
|
|
1135
|
+
{
|
|
1136
|
+
"var": "ZmF2b3JpdGVfd29yZA",
|
|
1137
|
+
"value": ""
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
"var": "favorite_word",
|
|
1141
|
+
"value": ""
|
|
1142
|
+
}
|
|
1143
|
+
],
|
|
1144
|
+
"type": "text",
|
|
1145
|
+
"trigger": ""
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
"selector": "#daquestion select[id=\"ZmF2b3JpdGVfd29yZAcombobox\"][class=\"form-control da-ajax-combobox\"]",
|
|
1149
|
+
"tag": "select",
|
|
1150
|
+
"guesses": [
|
|
1151
|
+
{
|
|
1152
|
+
"var": "ZmF2b3JpdGVfd29yZAcombobox",
|
|
1153
|
+
"value": ""
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
"var": "favorite_word\u0007(��\u001b�",
|
|
1157
|
+
"value": ""
|
|
1158
|
+
}
|
|
1159
|
+
],
|
|
1160
|
+
"type": "",
|
|
1161
|
+
"trigger": ""
|
|
1162
|
+
},
|
|
1163
|
+
{
|
|
1164
|
+
"selector": "#daquestion button[id=\"da-continue-button\"][class=\"btn btn-da btn-primary\"]",
|
|
1165
|
+
"tag": "button",
|
|
1166
|
+
"guesses": [
|
|
1167
|
+
{
|
|
1168
|
+
"var": "da-continue-button",
|
|
1169
|
+
"value": ""
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
"var": "u���{b��n�m�",
|
|
1173
|
+
"value": ""
|
|
1174
|
+
}
|
|
1175
|
+
],
|
|
1176
|
+
"type": "submit",
|
|
1177
|
+
"trigger": ""
|
|
1178
|
+
}
|
|
1179
|
+
];
|
|
1180
|
+
|
|
1111
1181
|
|
|
1112
1182
|
// ============================
|
|
1113
1183
|
// mixed quotes
|
|
@@ -33,8 +33,8 @@ chai.config.truncateThreshold = 0
|
|
|
33
33
|
it(`creates the right data for standard fields`, async function() {
|
|
34
34
|
// 18 fields (03/15/21)
|
|
35
35
|
let result = await getAllFields( scope, { html: html.standard });
|
|
36
|
-
//
|
|
37
|
-
//
|
|
36
|
+
// console.log(`=================\n${ JSON.stringify(fields.standard, null, 2) }`);
|
|
37
|
+
// console.log(`-----------------\n${ JSON.stringify(result, null, 2) }`);
|
|
38
38
|
expect( result ).to.deep.equalInAnyOrder( fields.standard );
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -148,6 +148,14 @@ it(`creates the right data for a dropdown created with an object`, async functio
|
|
|
148
148
|
expect( result ).to.deep.equalInAnyOrder(fields.object_dropdown );
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
+
// Ajax
|
|
152
|
+
it('creates the right data for an `ajax` combobox', async function() {
|
|
153
|
+
let result = await getAllFields( scope, { html: html.ajax });
|
|
154
|
+
console.log(`=================\n${ JSON.stringify(fields.ajax, null, 2) }`);
|
|
155
|
+
console.log(`-----------------\n${ JSON.stringify(result, null, 2) }`);
|
|
156
|
+
expect( result ).to.deep.equalInAnyOrder(fields.ajax );
|
|
157
|
+
});
|
|
158
|
+
|
|
151
159
|
// ============================
|
|
152
160
|
// DOM for mixed quotes test in getMatchingRows.test.js
|
|
153
161
|
// ============================
|
|
@@ -789,6 +789,62 @@ html.object_dropdown = `
|
|
|
789
789
|
</form>
|
|
790
790
|
</div>`;
|
|
791
791
|
|
|
792
|
+
html.ajax = `
|
|
793
|
+
<div id="daquestion" aria-labelledby="dapagetitle" role="main" class="tab-pane fade show active offset-lg-3 col-lg-6 offset-md-2 col-md-8">
|
|
794
|
+
<form aria-labelledby="daMainQuestion" action="/interview?i=docassemble.base:data/questions/examples/fields-ajax.yml" id="daform" class="form-horizontal daformfields" method="POST" novalidate="novalidate">
|
|
795
|
+
<div class="da-page-header">
|
|
796
|
+
<h1 class="h3" id="daMainQuestion">What is your favorite word?</h1>
|
|
797
|
+
<div class="daclear"></div>
|
|
798
|
+
</div>
|
|
799
|
+
<div
|
|
800
|
+
class="da-container da-form-group row darequired da-field-container da-field-container-datatype-text da-field-container-inputtype-ajax">
|
|
801
|
+
<label for="ZmF2b3JpdGVfd29yZA" class="col-md-4 col-form-label da-form-label datext-right" >Word</label>
|
|
802
|
+
<div class="col-md-8 dafieldpart">
|
|
803
|
+
<div class="combobox-container">
|
|
804
|
+
<input type="hidden" name="ZmF2b3JpdGVfd29yZA" value="" />
|
|
805
|
+
<div class="input-group">
|
|
806
|
+
<input type="text" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-activedescendant="" autocomplete="off" id="ZmF2b3JpdGVfd29yZA" aria-controls="ZmF2b3JpdGVfd29yZAmenu" aria-owns="ZmF2b3JpdGVfd29yZAmenu" placeholder="" required="required" class="form-control da-ajax-combobox"/>
|
|
807
|
+
<ul role="listbox" class="typeahead typeahead-long dropdown-menu" id="ZmF2b3JpdGVfd29yZAmenu"></ul>
|
|
808
|
+
<div class="input-group-append">
|
|
809
|
+
<button class="btn btn-outline-secondary dacomboboxtoggle" type="button" tabindex="-1" aria-label="Dropdown" aria-expanded="false" aria-controls="ZmF2b3JpdGVfd29yZAmenu">
|
|
810
|
+
<svg class="svg-inline--fa fa-caret-down"></svg
|
|
811
|
+
><!-- <span class="fas fa-xmark"></span> Font Awesome fontawesome.com -->
|
|
812
|
+
</button>
|
|
813
|
+
</div>
|
|
814
|
+
</div>
|
|
815
|
+
</div>
|
|
816
|
+
<select data-action="wordlist" data-trig="4" alt="Input box" class="form-control da-ajax-combobox" id="ZmF2b3JpdGVfd29yZAcombobox" required="" style="display: none;">
|
|
817
|
+
<option selected="selected"></option>
|
|
818
|
+
</select>
|
|
819
|
+
</div>
|
|
820
|
+
</div>
|
|
821
|
+
<fieldset class="da-button-set da-field-buttons">
|
|
822
|
+
<legend class="visually-hidden">
|
|
823
|
+
Press one of the following buttons:
|
|
824
|
+
</legend>
|
|
825
|
+
<button class="btn btn-da btn-primary" id="da-continue-button" type="submit">
|
|
826
|
+
Continue
|
|
827
|
+
</button>
|
|
828
|
+
</fieldset>
|
|
829
|
+
<input
|
|
830
|
+
type="hidden"
|
|
831
|
+
name="csrf_token"
|
|
832
|
+
value="ImI4NDAyMmI3Mjc4NGY3MDlkMTRiNGE5OTQzZDhmZTVhYWY5NzQwNzUi.ZdVoHQ.GLQUgOWjNag9f7jGSiO9ZvHDoEc"
|
|
833
|
+
/>
|
|
834
|
+
<input type="hidden" name="_question_name" value="Question_0" />
|
|
835
|
+
<input type="hidden" name="_tracker" value="2" />
|
|
836
|
+
<input type="hidden" name="_visible" value="" />
|
|
837
|
+
<input
|
|
838
|
+
type="hidden"
|
|
839
|
+
name="_varnames"
|
|
840
|
+
value="eyJYMlpwWld4a1h6QSI6ICJabUYyYjNKcGRHVmZkMjl5WkEifQ"
|
|
841
|
+
/>
|
|
842
|
+
</form>
|
|
843
|
+
</div>`;
|
|
844
|
+
|
|
845
|
+
// ============================
|
|
846
|
+
// quotes
|
|
847
|
+
// ============================
|
|
792
848
|
html.mixed_quotes = `
|
|
793
849
|
<div id="daquestion" aria-labelledby="dapagetitle" role="main" class="tab-pane fade show active offset-xl-3 offset-lg-3 col-xl-6 col-lg-6 offset-md-2 col-md-8">
|
|
794
850
|
<div data-variable="ZG91YmxlX3F1b3RlX2RpY3RbJ2RvdWJsZV9xdW90ZV9rZXknXQ" id="trigger" aria-hidden="true" style="display: none;"></div>
|
|
@@ -892,5 +948,4 @@ html.mixed_quotes = `
|
|
|
892
948
|
</form>
|
|
893
949
|
</div>`;
|
|
894
950
|
|
|
895
|
-
|
|
896
951
|
module.exports = html;
|