@datagrok/hit-triage 1.10.9 → 1.11.0

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.
Files changed (123) hide show
  1. package/.grokignore +2 -0
  2. package/.turbo/turbo-build.log +25 -3
  3. package/CHANGELOG.md +78 -0
  4. package/CLAUDE.md +87 -10
  5. package/README_HD.md +14 -14
  6. package/README_HT.md +6 -6
  7. package/README_PH.md +110 -0
  8. package/bdd/bdd.config.json +3 -1
  9. package/bdd/bindings/campaign.ts +626 -0
  10. package/bdd/bindings/hit-design.ts +36 -42
  11. package/bdd/bindings/landing.ts +839 -0
  12. package/bdd/bindings/pepti-hit.ts +35 -0
  13. package/bdd/features/campaign/crumbs.feature +22 -0
  14. package/bdd/features/campaign/grid.feature +56 -0
  15. package/bdd/features/campaign/merge.feature +105 -0
  16. package/bdd/features/campaign/molecule-vid.feature +40 -0
  17. package/bdd/features/campaign/permissions.feature +46 -0
  18. package/bdd/features/campaign/progress-tracker.feature +89 -0
  19. package/bdd/features/campaign/refresh-hint.feature +33 -0
  20. package/bdd/features/campaign/ribbon.feature +49 -0
  21. package/bdd/features/campaign/stage-choices.feature +39 -0
  22. package/bdd/features/campaign/submit.feature +135 -0
  23. package/bdd/features/campaign/tracker-cards.feature +46 -0
  24. package/bdd/features/campaign/view-only.feature +37 -0
  25. package/bdd/features/landing/campaign-deep-links.feature +61 -0
  26. package/bdd/features/landing/hit-design-campaigns-fixes.feature +116 -0
  27. package/bdd/features/landing/hit-design-campaigns.feature +153 -0
  28. package/bdd/features/landing/hit-triage-campaigns.feature +99 -0
  29. package/bdd/features/landing/new-campaign.feature +69 -0
  30. package/bdd/features/landing/pep-triage-campaigns.feature +41 -0
  31. package/bdd/features/landing/pepti-hit-landing.feature +132 -0
  32. package/bdd/features/pepti-hit/helm-edit.feature +47 -0
  33. package/bdd/features/templates/template-editor.feature +130 -0
  34. package/bdd/features/templates/template-picker.feature +112 -0
  35. package/bdd/features/templates/triage-forms.feature +59 -0
  36. package/bdd/fixtures/bar-chart.layout +1 -0
  37. package/bdd/fixtures/merge-local.csv +2 -0
  38. package/bdd/generated/campaign/crumbs.test.ts +33 -0
  39. package/bdd/generated/campaign/grid.test.ts +79 -0
  40. package/bdd/generated/campaign/merge.test.ts +134 -0
  41. package/bdd/generated/campaign/molecule-vid.test.ts +52 -0
  42. package/bdd/generated/campaign/permissions.test.ts +58 -0
  43. package/bdd/generated/campaign/progress-tracker.test.ts +129 -0
  44. package/bdd/generated/campaign/refresh-hint.test.ts +44 -0
  45. package/bdd/generated/campaign/ribbon.test.ts +65 -0
  46. package/bdd/generated/campaign/stage-choices.test.ts +55 -0
  47. package/bdd/generated/campaign/submit.test.ts +167 -0
  48. package/bdd/generated/campaign/tracker-cards.test.ts +49 -0
  49. package/bdd/generated/campaign/view-only.test.ts +51 -0
  50. package/bdd/generated/hit-design/campaign-column-metadata.test.ts +1 -0
  51. package/bdd/generated/landing/campaign-deep-links.test.ts +68 -0
  52. package/bdd/generated/landing/hit-design-campaigns-fixes.test.ts +99 -0
  53. package/bdd/generated/landing/hit-design-campaigns.test.ts +160 -0
  54. package/bdd/generated/landing/hit-triage-campaigns.test.ts +107 -0
  55. package/bdd/generated/landing/new-campaign.test.ts +78 -0
  56. package/bdd/generated/landing/pep-triage-campaigns.test.ts +52 -0
  57. package/bdd/generated/landing/pepti-hit-landing.test.ts +130 -0
  58. package/bdd/generated/pepti-hit/helm-edit.test.ts +64 -0
  59. package/bdd/generated/templates/template-editor.test.ts +137 -0
  60. package/bdd/generated/templates/template-picker.test.ts +119 -0
  61. package/bdd/generated/templates/triage-forms.test.ts +68 -0
  62. package/css/hit-triage.css +27 -23
  63. package/dist/package-test.js +690 -4
  64. package/dist/package-test.js.map +1 -1
  65. package/dist/package.js +318 -73
  66. package/dist/package.js.map +1 -1
  67. package/package.json +11 -7
  68. package/queries/locks.sql +37 -0
  69. package/src/app/accordeons/layout-input.ts +52 -44
  70. package/src/app/accordeons/new-campaign-accordeon.ts +91 -54
  71. package/src/app/accordeons/new-hit-design-campaign-accordeon.ts +3 -67
  72. package/src/app/accordeons/new-pep-triage-template-accordeon.ts +39 -41
  73. package/src/app/accordeons/new-template-accordeon.ts +41 -24
  74. package/src/app/ai/view-functions.ts +22 -19
  75. package/src/app/base-view.ts +99 -8
  76. package/src/app/consts.ts +8 -5
  77. package/src/app/dialogs/functions-dialog.ts +14 -9
  78. package/src/app/dialogs/merge-table-dialog.ts +181 -325
  79. package/src/app/hit-app-base.ts +61 -90
  80. package/src/app/hit-design-app.ts +481 -886
  81. package/src/app/hit-design-views/info-view.ts +57 -407
  82. package/src/app/hit-design-views/submit-view.ts +216 -111
  83. package/src/app/hit-design-views/tiles-view.ts +168 -123
  84. package/src/app/hit-design-views/utils.css +0 -8
  85. package/src/app/hit-triage-app.ts +69 -38
  86. package/src/app/hit-triage-views/info-view.ts +70 -371
  87. package/src/app/pep-triage-app.ts +2 -2
  88. package/src/app/pep-triage-views/info-view.ts +42 -83
  89. package/src/app/pepti-hit-app.ts +32 -183
  90. package/src/app/pepti-hits-views/info-view.ts +15 -37
  91. package/src/app/shared/campaign-catalog.ts +408 -0
  92. package/src/app/shared/campaign-session.ts +557 -0
  93. package/src/app/shared/compute-editor.ts +274 -0
  94. package/src/app/shared/hit-home.ts +45 -0
  95. package/src/app/shared/new-campaign-form.ts +90 -0
  96. package/src/app/shared/permissions-editor.ts +93 -0
  97. package/src/app/shared/template-editor.ts +331 -0
  98. package/src/app/shared/template-picker.ts +154 -0
  99. package/src/app/utils/merge-table.ts +183 -78
  100. package/src/app/utils.ts +34 -325
  101. package/src/package-api.ts +29 -8
  102. package/src/package-test.ts +17 -2
  103. package/src/package.g.ts +12 -8
  104. package/src/package.ts +19 -7
  105. package/src/tests/ai.ts +244 -0
  106. package/src/tests/campaign-layout.ts +82 -0
  107. package/src/tests/campaign-session.ts +168 -0
  108. package/src/tests/campaigns.ts +23 -0
  109. package/src/tests/catalog.ts +156 -0
  110. package/src/tests/compat.ts +482 -0
  111. package/src/tests/compute.ts +165 -0
  112. package/src/tests/fixtures.ts +359 -0
  113. package/src/tests/merge.ts +149 -0
  114. package/src/tests/owners.ts +11 -0
  115. package/src/tests/save-lock.ts +932 -0
  116. package/src/tests/storage.ts +106 -0
  117. package/src/tests/template-editor.ts +538 -0
  118. package/src/tests/templates.ts +143 -0
  119. package/src/tests/triage-start.ts +81 -0
  120. package/src/tests/u2-guards.ts +384 -0
  121. package/src/tests/vid.ts +77 -0
  122. package/src/app/accordeons/new-hit-design-template-accordeon.ts +0 -238
  123. package/src/app/dialogs/permissions-dialog.ts +0 -66
@@ -0,0 +1,59 @@
1
+ @journey
2
+ Feature: Hit Triage and PepTriage forms: START and CREATE refuse what they cannot use
3
+ Hit Triage and PepTriage keep their own new-campaign form and template editor. START and CREATE are disabled while
4
+ the form is invalid, with the reason shown: START while a required field is empty; the editor shows its name error
5
+ under the input, and its CREATE is disabled while the name or the key is empty or taken (PepTriage: or the sequence
6
+ column is empty), the reason as its tooltip, so an empty name writes no templates/.json and an existing template's
7
+ name overwrites nothing.
8
+
9
+ A Hit Triage template "BDD HT Form" (a required String field Owner, data from a file) is made for the feature
10
+ through the JS API (bindings/landing.ts). No scenario clicks START or CREATE: they write. The editor of Hit
11
+ Triage is the parent of its landing (parentView), and grok.shell.closeAll then ends on the landing rather than Home,
12
+ so the scenarios do not close every view between them. The editors open while the descriptors cannot be listed
13
+ (template-editor.feature); they log that they could not (bdd.config.json allows that one error).
14
+
15
+ Background:
16
+ Given user is logged in
17
+ And the descriptors cannot be listed, put back at feature end
18
+ And the "Hit Triage" templates are on the server:
19
+ | name | key | fields |
20
+ | BDD HT Form {time} | BDDHTF{time} | Owner: String required |
21
+ And user opens the "Hit Triage" app
22
+
23
+ Scenario: While a required field is empty, START is disabled
24
+ When user selects "BDD HT Form {time}" in Template input
25
+ Then "Owner" input should be visible
26
+ And Start button should be disabled
27
+
28
+ Scenario: The editor shows its error while the name is empty or an existing template's
29
+ When user clicks on "New Template" icon
30
+ Then the "New Template" view should be current
31
+ When user types "BDD HT Form {time}" into template name input
32
+ Then the template editor should show the error "Template name is empty or already exists"
33
+ When user types "BDD HT Free {time}" into template name input
34
+ Then the template editor should not show the error "Template name is empty or already exists"
35
+ When user clears template name input
36
+ Then the template editor should show the error "Template name is empty or already exists"
37
+ When user clicks on Cancel button
38
+ Then the "Hit Triage" view should be current
39
+
40
+ Scenario: CREATE is disabled while the name is empty or an existing template's
41
+ When user clicks on "New Template" icon
42
+ Then the "New Template" view should be current
43
+ And template name input should have the value ""
44
+ And Create button should be disabled
45
+ When user types "BDD HT Form {time}" into template name input
46
+ Then the template editor should show the error "Template name is empty or already exists"
47
+ And Create button should be disabled
48
+ When user clicks on Cancel button
49
+ Then the "Hit Triage" view should be current
50
+
51
+ Scenario: In PepTriage, CREATE is disabled while the name is empty
52
+ Given the "Bio" package is installed
53
+ When user opens the "PepTriage" app
54
+ And user clicks on "New Template" icon
55
+ Then the "New Template" view should be current
56
+ And template name input should have the value ""
57
+ And Create button should be disabled
58
+ When user clicks on Cancel button
59
+ Then the "PepTriage" view should be current
@@ -0,0 +1 @@
1
+ {"#type":"ViewLayout","viewStateMap":{"containerType":"horizontal","state":{"width":1147,"height":1024},"children":[{"containerType":"fill","state":{"width":572,"height":1024,"documentManager":true},"children":[{"containerType":"panel","state":{"width":572,"height":1024,"element":{"id":"2518a890-bde0-11f1-aedb-b51566ad73da","type":"Grid","look":{"#type":"GridLook","showAddNewRowIcon":true,"addNewRowOnLastRowEdit":true,"topLevelDefaultMenu":true,"allowColumnMenu":true,"columns":[{"width":20,"backgroundColor":4294440951,"customName":"","cellType":"row header","headerCellStyle":{"textWrap":"words"}},{"width":79,"columnName":"Molecule","headerCellStyle":{"textWrap":"words"}},{"width":59,"columnName":"Stage","headerCellStyle":{"textWrap":"words"}},{"width":49,"columnName":"V-iD","headerCellStyle":{"textWrap":"words"}}]},"title":"Table","default":true},"isActive":true},"children":[]}]},{"containerType":"panel","state":{"width":573,"height":1024,"element":{"id":"2518cfa0-bde0-11f1-ed5c-b7aee24ad09a","type":"Bar chart","look":{"#type":"BarChartLook","splitColumnName":"Stage","valueColumnName":"Molecule","valueAggrType":"count","barSortType":"by value","barSortOrder":"desc","legendPosition":"Auto"},"title":"Bar chart"}},"children":[]}],"floating":[],"tableId":"24c35ca0-bde0-11f1-864a-8f85625e9b62","tableName":"Table"},"type":"TableView","columns":[{"name":"Stage","type":"string","id":"2518cfa3-bde0-11f1-864a-8f85625e9b62","friendlyName":"Stage","metaParams":{}},{"name":"Molecule","type":"string","id":"2518cfa4-bde0-11f1-864a-8f85625e9b62","friendlyName":"Molecule","metaParams":{}}],"id":"2518cfa0-bde0-11f1-864a-8f85625e9b62","name":"Table","friendlyName":"Table"}
@@ -0,0 +1,2 @@
1
+ V-iD,Priority
2
+ V900001,Urgent
@@ -0,0 +1,33 @@
1
+ /* eslint-disable max-len */
2
+ /* eslint-disable comma-spacing */
3
+ /* eslint-disable quotes */
4
+ /* ---
5
+ generated: features/campaign/crumbs.feature
6
+ generator: @datagrok-libraries/bdd — do not edit; run `grok-bdd compile` to regenerate
7
+ --- */
8
+ import {test} from '@playwright/test';
9
+ import '../../bindings/landing.js';
10
+ import '@datagrok-libraries/bdd/bindings/common/kinds';
11
+ import '@datagrok-libraries/bdd/bindings/common/parameter-types';
12
+ import '@datagrok-libraries/bdd/bindings/platform/datasets';
13
+ import '@datagrok-libraries/bdd/bindings/platform/elements';
14
+ import {backByCrumb, hitDesignCampaign, openByLink} from '../../bindings/campaign.js';
15
+ import {loggedIn} from '@datagrok-libraries/bdd/bindings/common/session';
16
+ import {urlShouldContain, urlShouldNotContain, viewIsCurrent} from '@datagrok-libraries/bdd/bindings/platform/steps';
17
+ import {openTableViewsExactly} from '@datagrok-libraries/bdd/bindings/platform/workspace';
18
+ import {feature} from '@datagrok-libraries/bdd/runtime';
19
+
20
+ test.describe("The crumbs of a Hit Design campaign view go back to the landing", () => {
21
+ const session = feature(test, "features/campaign/crumbs.feature", import.meta.url);
22
+ test("The first crumb goes back to the landing and closes the campaign", async ({browser}) => {
23
+ const page = await session.page(browser);
24
+ await session.step(11, "Given user is logged in", () => loggedIn(page));
25
+ await session.step(12, "And the Hit Design campaign \"BDD Crumbs\" with the stages \"Idea\" and a table of:", () => hitDesignCampaign(page, "BDD Crumbs", "Idea", [["Molecule","Stage","V-iD","MW"],["CCO","Idea","","46.07"]]), [["Molecule","Stage","V-iD","MW"],["CCO","Idea","","46.07"]]);
26
+ await session.step(15, "When user opens the campaign \"BDD Crumbs\" by its link", () => openByLink(page, "BDD Crumbs"));
27
+ await session.step(18, "Then the page address should contain \"campaignId=BDDBDDCRUMBS-1\"", () => urlShouldContain(page, "campaignId=BDDBDDCRUMBS-1"));
28
+ await session.step(19, "When user goes back by the \"Hit Design\" crumb of the campaign \"BDD Crumbs\"", () => backByCrumb(page, "Hit Design", "BDD Crumbs"));
29
+ await session.step(20, "Then the \"Hit Design\" view should be current", () => viewIsCurrent(page, "Hit Design"));
30
+ await session.step(21, "And the open table views should be exactly \"\"", () => openTableViewsExactly(page, ""));
31
+ await session.step(22, "And the page address should not contain \"campaignId\"", () => urlShouldNotContain(page, "campaignId"));
32
+ });
33
+ });
@@ -0,0 +1,79 @@
1
+ /* eslint-disable max-len */
2
+ /* eslint-disable comma-spacing */
3
+ /* eslint-disable quotes */
4
+ /* ---
5
+ generated: features/campaign/grid.feature
6
+ generator: @datagrok-libraries/bdd — do not edit; run `grok-bdd compile` to regenerate
7
+ --- */
8
+ import {test} from '@playwright/test';
9
+ import '../../bindings/landing.js';
10
+ import '@datagrok-libraries/bdd/bindings/common/kinds';
11
+ import '@datagrok-libraries/bdd/bindings/common/parameter-types';
12
+ import '@datagrok-libraries/bdd/bindings/platform/datasets';
13
+ import '@datagrok-libraries/bdd/bindings/platform/elements';
14
+ import {hitDesignCampaign, openByLink, savedCellMatching, valueMatching} from '../../bindings/campaign.js';
15
+ import {loggedIn} from '@datagrok-libraries/bdd/bindings/common/session';
16
+ import {clickOn, shouldBe} from '@datagrok-libraries/bdd/bindings/common/steps';
17
+ import {valueInRow} from '@datagrok-libraries/bdd/bindings/platform/columns';
18
+ import {rowCount} from '@datagrok-libraries/bdd/bindings/platform/data';
19
+ import {closeContextMenu, menuDoesNotList, menuLists, noBalloons, pickFromAreaContextMenu, rightClickArea} from '@datagrok-libraries/bdd/bindings/tiers/viewers/steps';
20
+ import {el, feature} from '@datagrok-libraries/bdd/runtime';
21
+
22
+ test.describe("Rows and cells of a Hit Design campaign", () => {
23
+ const session = feature(test, "features/campaign/grid.feature", import.meta.url);
24
+ test("Add new row gives the new row the first stage and opens the sketcher on its empty molecule", async ({browser}) => {
25
+ const page = await session.page(browser);
26
+ await session.step(15, "Given user is logged in", () => loggedIn(page));
27
+ await session.step(16, "And the Hit Design campaign \"BDD Grid\" with the stages \"Idea, Design, Make\" and a table of:", () => hitDesignCampaign(page, "BDD Grid", "Idea, Design, Make", [["Molecule","Stage","V-iD","MW"],["CCO","Design","","46.07"],["c1ccccc1","Design","",""]]), [["Molecule","Stage","V-iD","MW"],["CCO","Design","","46.07"],["c1ccccc1","Design","",""]]);
28
+ await session.step(20, "When user opens the campaign \"BDD Grid\" by its link", () => openByLink(page, "BDD Grid"));
29
+ await session.step(21, "Then the table should have 2 rows", () => rowCount(page, 2));
30
+ await session.step(24, "When user clicks on \"Add new row\" icon in toolbar", () => clickOn(page, el("\"Add new row\" icon in toolbar")));
31
+ await session.step(25, "Then sketcher dialog should be visible", () => shouldBe(page, el("sketcher dialog"), "visible"));
32
+ await session.step(26, "And the table should have 3 rows", () => rowCount(page, 3));
33
+ await session.step(27, "And the value of \"Stage\" column in row 3 should be \"Idea\"", () => valueInRow(page, "Stage", 3, "Idea"));
34
+ await session.step(28, "And the value of \"Stage\" column in row 1 should be \"Design\"", () => valueInRow(page, "Stage", 1, "Design"));
35
+ await session.step(29, "When user clicks on CANCEL button in sketcher dialog", () => clickOn(page, el("CANCEL button in sketcher dialog")));
36
+ await session.step(30, "Then sketcher dialog should be absent", () => shouldBe(page, el("sketcher dialog"), "absent"));
37
+ await session.step(31, "And the table should have 3 rows", () => rowCount(page, 3));
38
+ });
39
+ test("A Molecule cell's menu adds the package's row actions, and another column's menu does not", async ({browser}) => {
40
+ const page = await session.page(browser);
41
+ await session.step(15, "Given user is logged in", () => loggedIn(page));
42
+ await session.step(16, "And the Hit Design campaign \"BDD Grid\" with the stages \"Idea, Design, Make\" and a table of:", () => hitDesignCampaign(page, "BDD Grid", "Idea, Design, Make", [["Molecule","Stage","V-iD","MW"],["CCO","Design","","46.07"],["c1ccccc1","Design","",""]]), [["Molecule","Stage","V-iD","MW"],["CCO","Design","","46.07"],["c1ccccc1","Design","",""]]);
43
+ await session.step(20, "When user opens the campaign \"BDD Grid\" by its link", () => openByLink(page, "BDD Grid"));
44
+ await session.step(21, "Then the table should have 2 rows", () => rowCount(page, 2));
45
+ await session.step(34, "When user right-clicks on the \"cell 1 of Molecule\" area of grid", () => rightClickArea(page, "cell 1 of Molecule", el("grid")));
46
+ await session.step(35, "Then the open menu should list \"Add new row\"", () => menuLists(page, "Add new row"));
47
+ await session.step(36, "And the open menu should list \"Duplicate molecule\"", () => menuLists(page, "Duplicate molecule"));
48
+ await session.step(37, "And the open menu should list \"Re-Run Calculations\"", () => menuLists(page, "Re-Run Calculations"));
49
+ await session.step(38, "When user closes the context menu", () => closeContextMenu(page));
50
+ await session.step(39, "And user right-clicks on the \"cell 1 of Stage\" area of grid", () => rightClickArea(page, "cell 1 of Stage", el("grid")));
51
+ await session.step(40, "Then the open menu should list \"Sort...\"", () => menuLists(page, "Sort..."));
52
+ await session.step(41, "And the open menu should not list \"Duplicate molecule\"", () => menuDoesNotList(page, "Duplicate molecule"));
53
+ await session.step(42, "And the open menu should not list \"Re-Run Calculations\"", () => menuDoesNotList(page, "Re-Run Calculations"));
54
+ });
55
+ test("Duplicate molecule appends the cell's molecule as a new row in the first stage", async ({browser}) => {
56
+ const page = await session.page(browser);
57
+ await session.step(15, "Given user is logged in", () => loggedIn(page));
58
+ await session.step(16, "And the Hit Design campaign \"BDD Grid\" with the stages \"Idea, Design, Make\" and a table of:", () => hitDesignCampaign(page, "BDD Grid", "Idea, Design, Make", [["Molecule","Stage","V-iD","MW"],["CCO","Design","","46.07"],["c1ccccc1","Design","",""]]), [["Molecule","Stage","V-iD","MW"],["CCO","Design","","46.07"],["c1ccccc1","Design","",""]]);
59
+ await session.step(20, "When user opens the campaign \"BDD Grid\" by its link", () => openByLink(page, "BDD Grid"));
60
+ await session.step(21, "Then the table should have 2 rows", () => rowCount(page, 2));
61
+ await session.step(45, "When user picks \"Duplicate molecule\" from the context menu of the \"cell 1 of Molecule\" area of grid", () => pickFromAreaContextMenu(page, "Duplicate molecule", "cell 1 of Molecule", el("grid")));
62
+ await session.step(46, "Then the table should have 3 rows", () => rowCount(page, 3));
63
+ await session.step(47, "And the value of \"Molecule\" column in row 3 should be \"CCO\"", () => valueInRow(page, "Molecule", 3, "CCO"));
64
+ await session.step(48, "And the value of \"Stage\" column in row 3 should be \"Idea\"", () => valueInRow(page, "Stage", 3, "Idea"));
65
+ });
66
+ test("Re-Run Calculations computes the template's property for that row alone and saves it", async ({browser}) => {
67
+ const page = await session.page(browser);
68
+ await session.step(15, "Given user is logged in", () => loggedIn(page));
69
+ await session.step(16, "And the Hit Design campaign \"BDD Grid\" with the stages \"Idea, Design, Make\" and a table of:", () => hitDesignCampaign(page, "BDD Grid", "Idea, Design, Make", [["Molecule","Stage","V-iD","MW"],["CCO","Design","","46.07"],["c1ccccc1","Design","",""]]), [["Molecule","Stage","V-iD","MW"],["CCO","Design","","46.07"],["c1ccccc1","Design","",""]]);
70
+ await session.step(20, "When user opens the campaign \"BDD Grid\" by its link", () => openByLink(page, "BDD Grid"));
71
+ await session.step(21, "Then the table should have 2 rows", () => rowCount(page, 2));
72
+ await session.step(51, "Then the value of \"MW\" column in row 2 should be \"\"", () => valueInRow(page, "MW", 2, ""));
73
+ await session.step(52, "When user picks \"Re-Run Calculations\" from the context menu of the \"cell 2 of Molecule\" area of grid", () => pickFromAreaContextMenu(page, "Re-Run Calculations", "cell 2 of Molecule", el("grid")));
74
+ await session.step(53, "Then the campaign \"BDD Grid\" should be saved with a value matching \"^78[.]1\" in row 2 of the \"MW\" column", () => savedCellMatching(page, "BDD Grid", "^78[.]1", 2, "MW"));
75
+ await session.step(54, "And the value of \"MW\" column in row 2 should match \"^78[.]1\"", () => valueMatching(page, "MW", 2, "^78[.]1"));
76
+ await session.step(55, "And the value of \"MW\" column in row 1 should match \"^46[.]0[67]\"", () => valueMatching(page, "MW", 1, "^46[.]0[67]"));
77
+ await session.step(56, "And no error or warning balloon should have been shown", () => noBalloons(page));
78
+ });
79
+ });
@@ -0,0 +1,134 @@
1
+ /* eslint-disable max-len */
2
+ /* eslint-disable comma-spacing */
3
+ /* eslint-disable quotes */
4
+ /* ---
5
+ generated: features/campaign/merge.feature
6
+ generator: @datagrok-libraries/bdd — do not edit; run `grok-bdd compile` to regenerate
7
+ --- */
8
+ import {test} from '@playwright/test';
9
+ import '../../bindings/landing.js';
10
+ import '@datagrok-libraries/bdd/bindings/common/kinds';
11
+ import '@datagrok-libraries/bdd/bindings/common/parameter-types';
12
+ import '@datagrok-libraries/bdd/bindings/platform/datasets';
13
+ import '@datagrok-libraries/bdd/bindings/platform/elements';
14
+ import {chooseProjectFile, enterUserFilePath, hitDesignCampaign, holdsUserFilePath, openByLink, savedCell, savedRows, savedToMergeNoFile, savedToMergeUserFile, userFileHolds, valueMatching} from '../../bindings/campaign.js';
15
+ import {loggedIn} from '@datagrok-libraries/bdd/bindings/common/session';
16
+ import {check, clickOn, doubleClickOn, isExpanded, selectIn, shouldBe, shouldContainText, shouldHaveValue} from '@datagrok-libraries/bdd/bindings/common/steps';
17
+ import {valueInRow} from '@datagrok-libraries/bdd/bindings/platform/columns';
18
+ import {rowCount} from '@datagrok-libraries/bdd/bindings/platform/data';
19
+ import {infoBalloonText} from '@datagrok-libraries/bdd/bindings/tiers/viewers/steps';
20
+ import {el, feature} from '@datagrok-libraries/bdd/runtime';
21
+
22
+ test.describe("Merging a table from the user's files into a Hit Design campaign", () => {
23
+ const session = feature(test, "features/campaign/merge.feature", import.meta.url);
24
+ test("OK stays disabled, saying why, until the dialog has what the merge needs", async ({browser}) => {
25
+ const page = await session.page(browser);
26
+ await session.step(18, "Given user is logged in", () => loggedIn(page));
27
+ await session.step(19, "And the Hit Design campaign \"BDD Merge\" with the stages \"Idea, Design\" and a table of:", () => hitDesignCampaign(page, "BDD Merge", "Idea, Design", [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]), [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]);
28
+ await session.step(23, "And the user's file \"bdd-merge-by-smiles.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-smiles.csv", [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]), [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]);
29
+ await session.step(27, "And the user's file \"bdd-merge-by-vid.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-vid.csv", [["V-iD","Priority"],["V900002","High"]]), [["V-iD","Priority"],["V900002","High"]]);
30
+ await session.step(30, "When user opens the campaign \"BDD Merge\" by its link", () => openByLink(page, "BDD Merge"));
31
+ await session.step(31, "And user clicks on \"Merge another table into the campaign\" icon in toolbar", () => clickOn(page, el("\"Merge another table into the campaign\" icon in toolbar")));
32
+ await session.step(32, "Then \"Merge with table\" dialog should be visible", () => shouldBe(page, el("\"Merge with table\" dialog"), "visible"));
33
+ await session.step(35, "Then OK button in \"Merge with table\" dialog should be disabled", () => shouldBe(page, el("OK button in \"Merge with table\" dialog"), "disabled"));
34
+ await session.step(36, "And \"Merge with table\" dialog should contain text \"Pick a source file to merge from.\"", () => shouldContainText(page, el("\"Merge with table\" dialog"), "Pick a source file to merge from."));
35
+ await session.step(37, "And CANCEL button in \"Merge with table\" dialog should be enabled", () => shouldBe(page, el("CANCEL button in \"Merge with table\" dialog"), "enabled"));
36
+ await session.step(38, "When user enters the path of the user's file \"bdd-merge-by-smiles.csv\" into \"Source file\" input in \"Merge with table\" dialog", () => enterUserFilePath(page, "bdd-merge-by-smiles.csv", el("\"Source file\" input in \"Merge with table\" dialog")));
37
+ await session.step(39, "Then \"Merge with table\" dialog should contain text \"Pick the V-iD column from the incoming table.\"", () => shouldContainText(page, el("\"Merge with table\" dialog"), "Pick the V-iD column from the incoming table."));
38
+ await session.step(40, "And OK button in \"Merge with table\" dialog should be disabled", () => shouldBe(page, el("OK button in \"Merge with table\" dialog"), "disabled"));
39
+ await session.step(41, "When user selects \"By canonical SMILES\" in \"Merge by\" input in \"Merge with table\" dialog", () => selectIn(page, "By canonical SMILES", el("\"Merge by\" input in \"Merge with table\" dialog")));
40
+ await session.step(42, "Then OK button in \"Merge with table\" dialog should be enabled", () => shouldBe(page, el("OK button in \"Merge with table\" dialog"), "enabled"));
41
+ await session.step(43, "When user selects \"(none)\" in \"Molecule column (incoming)\" input in \"Merge with table\" dialog", () => selectIn(page, "(none)", el("\"Molecule column (incoming)\" input in \"Merge with table\" dialog")));
42
+ await session.step(44, "Then \"Merge with table\" dialog should contain text \"Pick the molecule column from the incoming table.\"", () => shouldContainText(page, el("\"Merge with table\" dialog"), "Pick the molecule column from the incoming table."));
43
+ await session.step(45, "And OK button in \"Merge with table\" dialog should be disabled", () => shouldBe(page, el("OK button in \"Merge with table\" dialog"), "disabled"));
44
+ await session.step(46, "When user clicks on CANCEL button in \"Merge with table\" dialog", () => clickOn(page, el("CANCEL button in \"Merge with table\" dialog")));
45
+ await session.step(47, "Then \"Merge with table\" dialog should be absent", () => shouldBe(page, el("\"Merge with table\" dialog"), "absent"));
46
+ await session.step(48, "And the table should have 2 rows", () => rowCount(page, 2));
47
+ });
48
+ test("By canonical SMILES, the matching row takes the file's values and the new molecule comes in with a stage, a V-iD and MW", async ({browser}) => {
49
+ const page = await session.page(browser);
50
+ await session.step(18, "Given user is logged in", () => loggedIn(page));
51
+ await session.step(19, "And the Hit Design campaign \"BDD Merge\" with the stages \"Idea, Design\" and a table of:", () => hitDesignCampaign(page, "BDD Merge", "Idea, Design", [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]), [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]);
52
+ await session.step(23, "And the user's file \"bdd-merge-by-smiles.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-smiles.csv", [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]), [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]);
53
+ await session.step(27, "And the user's file \"bdd-merge-by-vid.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-vid.csv", [["V-iD","Priority"],["V900002","High"]]), [["V-iD","Priority"],["V900002","High"]]);
54
+ await session.step(30, "When user opens the campaign \"BDD Merge\" by its link", () => openByLink(page, "BDD Merge"));
55
+ await session.step(31, "And user clicks on \"Merge another table into the campaign\" icon in toolbar", () => clickOn(page, el("\"Merge another table into the campaign\" icon in toolbar")));
56
+ await session.step(32, "Then \"Merge with table\" dialog should be visible", () => shouldBe(page, el("\"Merge with table\" dialog"), "visible"));
57
+ await session.step(51, "When user enters the path of the user's file \"bdd-merge-by-smiles.csv\" into \"Source file\" input in \"Merge with table\" dialog", () => enterUserFilePath(page, "bdd-merge-by-smiles.csv", el("\"Source file\" input in \"Merge with table\" dialog")));
58
+ await session.step(52, "And user selects \"By canonical SMILES\" in \"Merge by\" input in \"Merge with table\" dialog", () => selectIn(page, "By canonical SMILES", el("\"Merge by\" input in \"Merge with table\" dialog")));
59
+ await session.step(53, "And user clicks on OK button in \"Merge with table\" dialog", () => clickOn(page, el("OK button in \"Merge with table\" dialog")));
60
+ await session.step(54, "Then an info balloon containing \"Table merged into campaign\" should have been shown", () => infoBalloonText(page, "Table merged into campaign"));
61
+ await session.step(55, "And the campaign \"BDD Merge\" should be saved with 3 rows", () => savedRows(page, "BDD Merge", 3));
62
+ await session.step(56, "And the table should have 3 rows", () => rowCount(page, 3));
63
+ await session.step(57, "And the value of \"Score\" column in row 1 should be \"5\"", () => valueInRow(page, "Score", 1, "5"));
64
+ await session.step(58, "And the value of \"Score\" column in row 2 should be \"\"", () => valueInRow(page, "Score", 2, ""));
65
+ await session.step(59, "And the value of \"Molecule\" column in row 3 should be \"NCCCCCCCCCCCCCCCCCCCCCCCCO\"", () => valueInRow(page, "Molecule", 3, "NCCCCCCCCCCCCCCCCCCCCCCCCO"));
66
+ await session.step(60, "And the value of \"Stage\" column in row 3 should be \"Idea\"", () => valueInRow(page, "Stage", 3, "Idea"));
67
+ await session.step(61, "And the value of \"V-iD\" column in row 3 should match \"^V[0-9]{6}$\"", () => valueMatching(page, "V-iD", 3, "^V[0-9]{6}$"));
68
+ await session.step(62, "And the value of \"MW\" column in row 3 should match \"^369[.]6\"", () => valueMatching(page, "MW", 3, "^369[.]6"));
69
+ await session.step(63, "And the campaign \"BDD Merge\" should be saved with \"5\" in row 1 of the \"Score\" column", () => savedCell(page, "BDD Merge", "5", 1, "Score"));
70
+ });
71
+ test("By V-iD, the row of that V-iD takes the file's values and no row is added", async ({browser}) => {
72
+ const page = await session.page(browser);
73
+ await session.step(18, "Given user is logged in", () => loggedIn(page));
74
+ await session.step(19, "And the Hit Design campaign \"BDD Merge\" with the stages \"Idea, Design\" and a table of:", () => hitDesignCampaign(page, "BDD Merge", "Idea, Design", [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]), [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]);
75
+ await session.step(23, "And the user's file \"bdd-merge-by-smiles.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-smiles.csv", [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]), [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]);
76
+ await session.step(27, "And the user's file \"bdd-merge-by-vid.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-vid.csv", [["V-iD","Priority"],["V900002","High"]]), [["V-iD","Priority"],["V900002","High"]]);
77
+ await session.step(30, "When user opens the campaign \"BDD Merge\" by its link", () => openByLink(page, "BDD Merge"));
78
+ await session.step(31, "And user clicks on \"Merge another table into the campaign\" icon in toolbar", () => clickOn(page, el("\"Merge another table into the campaign\" icon in toolbar")));
79
+ await session.step(32, "Then \"Merge with table\" dialog should be visible", () => shouldBe(page, el("\"Merge with table\" dialog"), "visible"));
80
+ await session.step(66, "When user enters the path of the user's file \"bdd-merge-by-vid.csv\" into \"Source file\" input in \"Merge with table\" dialog", () => enterUserFilePath(page, "bdd-merge-by-vid.csv", el("\"Source file\" input in \"Merge with table\" dialog")));
81
+ await session.step(67, "Then \"V-iD column (incoming)\" input in \"Merge with table\" dialog should have value \"V-iD\"", () => shouldHaveValue(page, el("\"V-iD column (incoming)\" input in \"Merge with table\" dialog"), "V-iD"));
82
+ await session.step(68, "And OK button in \"Merge with table\" dialog should be enabled", () => shouldBe(page, el("OK button in \"Merge with table\" dialog"), "enabled"));
83
+ await session.step(69, "When user clicks on OK button in \"Merge with table\" dialog", () => clickOn(page, el("OK button in \"Merge with table\" dialog")));
84
+ await session.step(70, "Then an info balloon containing \"Table merged into campaign\" should have been shown", () => infoBalloonText(page, "Table merged into campaign"));
85
+ await session.step(71, "And the campaign \"BDD Merge\" should be saved with \"High\" in row 2 of the \"Priority\" column", () => savedCell(page, "BDD Merge", "High", 2, "Priority"));
86
+ await session.step(72, "And the table should have 2 rows", () => rowCount(page, 2));
87
+ await session.step(73, "And the value of \"Priority\" column in row 2 should be \"High\"", () => valueInRow(page, "Priority", 2, "High"));
88
+ await session.step(74, "And the value of \"Priority\" column in row 1 should be \"\"", () => valueInRow(page, "Priority", 1, ""));
89
+ });
90
+ test("A file picked from Files is merged and remembered with the campaign, and the dialog opens on it again", async ({browser}) => {
91
+ const page = await session.page(browser);
92
+ await session.step(18, "Given user is logged in", () => loggedIn(page));
93
+ await session.step(19, "And the Hit Design campaign \"BDD Merge\" with the stages \"Idea, Design\" and a table of:", () => hitDesignCampaign(page, "BDD Merge", "Idea, Design", [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]), [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]);
94
+ await session.step(23, "And the user's file \"bdd-merge-by-smiles.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-smiles.csv", [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]), [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]);
95
+ await session.step(27, "And the user's file \"bdd-merge-by-vid.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-vid.csv", [["V-iD","Priority"],["V900002","High"]]), [["V-iD","Priority"],["V900002","High"]]);
96
+ await session.step(30, "When user opens the campaign \"BDD Merge\" by its link", () => openByLink(page, "BDD Merge"));
97
+ await session.step(31, "And user clicks on \"Merge another table into the campaign\" icon in toolbar", () => clickOn(page, el("\"Merge another table into the campaign\" icon in toolbar")));
98
+ await session.step(32, "Then \"Merge with table\" dialog should be visible", () => shouldBe(page, el("\"Merge with table\" dialog"), "visible"));
99
+ await session.step(79, "When user clicks on \"Add file from Files\" icon in \"Source file\" input in \"Merge with table\" dialog", () => clickOn(page, el("\"Add file from Files\" icon in \"Source file\" input in \"Merge with table\" dialog")));
100
+ await session.step(80, "Then \"Select a file\" dialog should be visible", () => shouldBe(page, el("\"Select a file\" dialog"), "visible"));
101
+ await session.step(81, "Given \"My files\" tree node in \"Select a file\" dialog is expanded", () => isExpanded(page, el("\"My files\" tree node in \"Select a file\" dialog")));
102
+ await session.step(82, "When user double-clicks on \"bdd-merge-by-vid.csv\" tree node in \"Select a file\" dialog", () => doubleClickOn(page, el("\"bdd-merge-by-vid.csv\" tree node in \"Select a file\" dialog")));
103
+ await session.step(83, "Then \"Select a file\" dialog should be absent", () => shouldBe(page, el("\"Select a file\" dialog"), "absent"));
104
+ await session.step(84, "And \"Source file\" input in \"Merge with table\" dialog should hold the path of the user's file \"bdd-merge-by-vid.csv\"", () => holdsUserFilePath(page, el("\"Source file\" input in \"Merge with table\" dialog"), "bdd-merge-by-vid.csv"));
105
+ await session.step(85, "And \"V-iD column (incoming)\" input in \"Merge with table\" dialog should have value \"V-iD\"", () => shouldHaveValue(page, el("\"V-iD column (incoming)\" input in \"Merge with table\" dialog"), "V-iD"));
106
+ await session.step(86, "When user checks \"Auto-merge on campaign open\" input in \"Merge with table\" dialog", () => check(page, el("\"Auto-merge on campaign open\" input in \"Merge with table\" dialog")));
107
+ await session.step(87, "And user clicks on OK button in \"Merge with table\" dialog", () => clickOn(page, el("OK button in \"Merge with table\" dialog")));
108
+ await session.step(88, "Then an info balloon containing \"Table merged into campaign\" should have been shown", () => infoBalloonText(page, "Table merged into campaign"));
109
+ await session.step(89, "And the campaign \"BDD Merge\" should be saved with \"High\" in row 2 of the \"Priority\" column", () => savedCell(page, "BDD Merge", "High", 2, "Priority"));
110
+ await session.step(90, "And the campaign \"BDD Merge\" should be saved to merge the user's file \"bdd-merge-by-vid.csv\" on every open", () => savedToMergeUserFile(page, "BDD Merge", "bdd-merge-by-vid.csv"));
111
+ await session.step(91, "When user clicks on \"Merge another table into the campaign\" icon in toolbar", () => clickOn(page, el("\"Merge another table into the campaign\" icon in toolbar")));
112
+ await session.step(92, "Then \"Source file\" input in \"Merge with table\" dialog should hold the path of the user's file \"bdd-merge-by-vid.csv\"", () => holdsUserFilePath(page, el("\"Source file\" input in \"Merge with table\" dialog"), "bdd-merge-by-vid.csv"));
113
+ await session.step(93, "And \"V-iD column (incoming)\" input in \"Merge with table\" dialog should have value \"V-iD\"", () => shouldHaveValue(page, el("\"V-iD column (incoming)\" input in \"Merge with table\" dialog"), "V-iD"));
114
+ await session.step(94, "And \"Auto-merge on campaign open\" input in \"Merge with table\" dialog should be checked", () => shouldBe(page, el("\"Auto-merge on campaign open\" input in \"Merge with table\" dialog"), "checked"));
115
+ });
116
+ test("A file uploaded from the computer is merged once, with Auto-merge on campaign open off", async ({browser}) => {
117
+ const page = await session.page(browser);
118
+ await session.step(18, "Given user is logged in", () => loggedIn(page));
119
+ await session.step(19, "And the Hit Design campaign \"BDD Merge\" with the stages \"Idea, Design\" and a table of:", () => hitDesignCampaign(page, "BDD Merge", "Idea, Design", [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]), [["Molecule","Stage","V-iD","MW"],["CCO","Design","V900001","46.07"],["c1ccccc1","Design","V900002","78.11"]]);
120
+ await session.step(23, "And the user's file \"bdd-merge-by-smiles.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-smiles.csv", [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]), [["Molecule","Score"],["OCC","5"],["NCCCCCCCCCCCCCCCCCCCCCCCCO","7"]]);
121
+ await session.step(27, "And the user's file \"bdd-merge-by-vid.csv\" holds the table:", () => userFileHolds(page, "bdd-merge-by-vid.csv", [["V-iD","Priority"],["V900002","High"]]), [["V-iD","Priority"],["V900002","High"]]);
122
+ await session.step(30, "When user opens the campaign \"BDD Merge\" by its link", () => openByLink(page, "BDD Merge"));
123
+ await session.step(31, "And user clicks on \"Merge another table into the campaign\" icon in toolbar", () => clickOn(page, el("\"Merge another table into the campaign\" icon in toolbar")));
124
+ await session.step(32, "Then \"Merge with table\" dialog should be visible", () => shouldBe(page, el("\"Merge with table\" dialog"), "visible"));
125
+ await session.step(98, "When user clicks on \"Open file\" icon in \"Source file\" input in \"Merge with table\" dialog and chooses the \"fixtures/merge-local.csv\" file of the project", () => chooseProjectFile(page, el("\"Open file\" icon in \"Source file\" input in \"Merge with table\" dialog"), "fixtures/merge-local.csv"));
126
+ await session.step(99, "Then \"V-iD column (incoming)\" input in \"Merge with table\" dialog should have value \"V-iD\"", () => shouldHaveValue(page, el("\"V-iD column (incoming)\" input in \"Merge with table\" dialog"), "V-iD"));
127
+ await session.step(100, "And \"Auto-merge on campaign open\" input in \"Merge with table\" dialog should be disabled", () => shouldBe(page, el("\"Auto-merge on campaign open\" input in \"Merge with table\" dialog"), "disabled"));
128
+ await session.step(101, "When user clicks on OK button in \"Merge with table\" dialog", () => clickOn(page, el("OK button in \"Merge with table\" dialog")));
129
+ await session.step(102, "Then an info balloon containing \"Table merged into campaign\" should have been shown", () => infoBalloonText(page, "Table merged into campaign"));
130
+ await session.step(103, "And the campaign \"BDD Merge\" should be saved with \"Urgent\" in row 1 of the \"Priority\" column", () => savedCell(page, "BDD Merge", "Urgent", 1, "Priority"));
131
+ await session.step(104, "And the campaign \"BDD Merge\" should be saved to merge no file on open", () => savedToMergeNoFile(page, "BDD Merge"));
132
+ await session.step(105, "And the value of \"Priority\" column in row 1 should be \"Urgent\"", () => valueInRow(page, "Priority", 1, "Urgent"));
133
+ });
134
+ });
@@ -0,0 +1,52 @@
1
+ /* eslint-disable max-len */
2
+ /* eslint-disable comma-spacing */
3
+ /* eslint-disable quotes */
4
+ /* ---
5
+ generated: features/campaign/molecule-vid.feature
6
+ generator: @datagrok-libraries/bdd — do not edit; run `grok-bdd compile` to regenerate
7
+ --- */
8
+ import {test} from '@playwright/test';
9
+ import '../../bindings/landing.js';
10
+ import '@datagrok-libraries/bdd/bindings/common/kinds';
11
+ import '@datagrok-libraries/bdd/bindings/common/parameter-types';
12
+ import '@datagrok-libraries/bdd/bindings/platform/datasets';
13
+ import '@datagrok-libraries/bdd/bindings/platform/elements';
14
+ import {enterMoleculeInSketcher, hitDesignCampaign, noLockHeld, openByLink, savedCellMatching, valueMatching} from '../../bindings/campaign.js';
15
+ import {loggedIn} from '@datagrok-libraries/bdd/bindings/common/session';
16
+ import {clickOn, expand, finishedUpdating, shouldBe, shouldContainText} from '@datagrok-libraries/bdd/bindings/common/steps';
17
+ import {currentColumnIs} from '@datagrok-libraries/bdd/bindings/platform/data';
18
+ import {contextPanelOpen, contextPanelShowsCurrentCell, sketcherIs} from '@datagrok-libraries/bdd/bindings/platform/steps';
19
+ import {clickArea, doubleClickArea, noBalloons} from '@datagrok-libraries/bdd/bindings/tiers/viewers/steps';
20
+ import {el, feature} from '@datagrok-libraries/bdd/runtime';
21
+
22
+ test.describe("A molecule edited in a Hit Design campaign gets its V-iD", () => {
23
+ const session = feature(test, "features/campaign/molecule-vid.feature", import.meta.url);
24
+ test("A molecule typed into the sketcher gets a V-iD and the template's property, is saved, and its V-iD's pane lists the campaign", async ({browser}) => {
25
+ const page = await session.page(browser);
26
+ await session.step(12, "Given user is logged in", () => loggedIn(page));
27
+ await session.step(13, "And the molecule sketcher is \"OpenChemLib\"", () => sketcherIs(page, "OpenChemLib"));
28
+ await session.step(14, "And the Hit Design campaign \"BDD Vid\" with the stages \"Idea, Design\" and a table of:", () => hitDesignCampaign(page, "BDD Vid", "Idea, Design", [["Molecule","Stage","V-iD","MW"],["CCO","Idea","","46.07"]]), [["Molecule","Stage","V-iD","MW"],["CCO","Idea","","46.07"]]);
29
+ await session.step(17, "When user opens the campaign \"BDD Vid\" by its link", () => openByLink(page, "BDD Vid"));
30
+ await session.step(20, "When user double-clicks on the \"cell 1 of Molecule\" area of grid", () => doubleClickArea(page, "cell 1 of Molecule", el("grid")));
31
+ await session.step(21, "Then sketcher dialog should be visible", () => shouldBe(page, el("sketcher dialog"), "visible"));
32
+ await session.step(22, "When user enters the molecule \"NCCCCCCCCCCCCCCCCCCCCCCCCO\" into sketcher dialog", () => enterMoleculeInSketcher(page, "NCCCCCCCCCCCCCCCCCCCCCCCCO"));
33
+ await session.step(23, "And user clicks on OK button in sketcher dialog", () => clickOn(page, el("OK button in sketcher dialog")));
34
+ await session.step(24, "Then sketcher dialog should be absent", () => shouldBe(page, el("sketcher dialog"), "absent"));
35
+ await session.step(25, "And the campaign \"BDD Vid\" should be saved with a value matching \"^V[0-9]{6}$\" in row 1 of the \"V-iD\" column", () => savedCellMatching(page, "BDD Vid", "^V[0-9]{6}$", 1, "V-iD"));
36
+ await session.step(26, "And the value of \"V-iD\" column in row 1 should match \"^V[0-9]{6}$\"", () => valueMatching(page, "V-iD", 1, "^V[0-9]{6}$"));
37
+ await session.step(27, "And the value of \"MW\" column in row 1 should match \"^369[.]6\"", () => valueMatching(page, "MW", 1, "^369[.]6"));
38
+ await session.step(28, "And the campaign \"BDD Vid\" should be saved with a value matching \"^369[.]6\" in row 1 of the \"MW\" column", () => savedCellMatching(page, "BDD Vid", "^369[.]6", 1, "MW"));
39
+ await session.step(29, "And no error or warning balloon should have been shown", () => noBalloons(page));
40
+ await session.step(30, "And the campaign \"BDD Vid\" should hold no lock on the server", () => noLockHeld(page, "BDD Vid"));
41
+ await session.step(31, "And grid should have finished updating", () => finishedUpdating(page, el("grid")));
42
+ await session.step(32, "Given the context panel is open", () => contextPanelOpen(page));
43
+ await session.step(33, "When user clicks on the \"cell 1 of V-iD\" area of grid", () => clickArea(page, "cell 1 of V-iD", el("grid")));
44
+ await session.step(34, "Then the current column should be \"V-iD\"", () => currentColumnIs(page, "V-iD"));
45
+ await session.step(35, "And the context panel should show the current cell", () => contextPanelShowsCurrentCell(page));
46
+ await session.step(36, "And \"Hit Design V-iD\" section should be visible", () => shouldBe(page, el("\"Hit Design V-iD\" section"), "visible"));
47
+ await session.step(37, "When user expands \"Hit Design V-iD\" section", () => expand(page, el("\"Hit Design V-iD\" section")));
48
+ await session.step(38, "Then \"Hit Design V-iD\" section should contain text \"Hit Design Campaigns\"", () => shouldContainText(page, el("\"Hit Design V-iD\" section"), "Hit Design Campaigns"));
49
+ await session.step(39, "And \"Hit Design V-iD\" section should contain text \"BDDBDDVID-1\"", () => shouldContainText(page, el("\"Hit Design V-iD\" section"), "BDDBDDVID-1"));
50
+ await session.step(40, "And \"Hit Design V-iD\" section should contain text \"{login}\"", () => shouldContainText(page, el("\"Hit Design V-iD\" section"), session.text("{login}")));
51
+ });
52
+ });
@@ -0,0 +1,58 @@
1
+ /* eslint-disable max-len */
2
+ /* eslint-disable comma-spacing */
3
+ /* eslint-disable quotes */
4
+ /* ---
5
+ generated: features/campaign/permissions.feature
6
+ generator: @datagrok-libraries/bdd — do not edit; run `grok-bdd compile` to regenerate
7
+ --- */
8
+ import {test} from '@playwright/test';
9
+ import '../../bindings/landing.js';
10
+ import '@datagrok-libraries/bdd/bindings/common/kinds';
11
+ import '@datagrok-libraries/bdd/bindings/common/parameter-types';
12
+ import '@datagrok-libraries/bdd/bindings/platform/datasets';
13
+ import '@datagrok-libraries/bdd/bindings/platform/elements';
14
+ import {grantSharingUserEdit, groupPicture, hitDesignCampaign, namesSharingUser, openByLink, sharingUserMayEdit, sharingUserPicture} from '../../bindings/campaign.js';
15
+ import {loggedIn} from '@datagrok-libraries/bdd/bindings/common/session';
16
+ import {clickOn, shouldBe, shouldContainText} from '@datagrok-libraries/bdd/bindings/common/steps';
17
+ import {infoBalloonText} from '@datagrok-libraries/bdd/bindings/tiers/viewers/steps';
18
+ import {el, feature} from '@datagrok-libraries/bdd/runtime';
19
+
20
+ test.describe("Editing a Hit Design campaign's permissions from its ribbon", () => {
21
+ const session = feature(test, "features/campaign/permissions.feature", import.meta.url);
22
+ test("A user given edit access is saved with the campaign and shown when the dialog opens again", async ({browser}) => {
23
+ const page = await session.page(browser);
24
+ await session.step(14, "Given user is logged in", () => loggedIn(page));
25
+ await session.step(15, "And the Hit Design campaign \"BDD Permissions\" with the stages \"Idea\" and a table of:", () => hitDesignCampaign(page, "BDD Permissions", "Idea", [["Molecule","Stage","V-iD","MW"],["CCO","Idea","","46.07"]]), [["Molecule","Stage","V-iD","MW"],["CCO","Idea","","46.07"]]);
26
+ await session.step(18, "When user opens the campaign \"BDD Permissions\" by its link", () => openByLink(page, "BDD Permissions"));
27
+ await session.step(21, "When user clicks on \"Edit campaign permissions\" icon in toolbar", () => clickOn(page, el("\"Edit campaign permissions\" icon in toolbar")));
28
+ await session.step(22, "Then \"Edit Permissions\" dialog should be visible", () => shouldBe(page, el("\"Edit Permissions\" dialog"), "visible"));
29
+ await session.step(23, "And \"Edit Permissions\" dialog should contain text \"Can View\"", () => shouldContainText(page, el("\"Edit Permissions\" dialog"), "Can View"));
30
+ await session.step(24, "And \"Edit Permissions\" dialog should contain text \"Can Edit\"", () => shouldContainText(page, el("\"Edit Permissions\" dialog"), "Can Edit"));
31
+ await session.step(25, "And \"Edit Permissions\" dialog should contain text \"All users\"", () => shouldContainText(page, el("\"Edit Permissions\" dialog"), "All users"));
32
+ await session.step(26, "And CANCEL button in \"Edit Permissions\" dialog should be enabled", () => shouldBe(page, el("CANCEL button in \"Edit Permissions\" dialog"), "enabled"));
33
+ await session.step(27, "When user lets the sharing user edit in \"Edit Permissions\" dialog", () => grantSharingUserEdit(page, el("\"Edit Permissions\" dialog")));
34
+ await session.step(28, "And user clicks on OK button in \"Edit Permissions\" dialog", () => clickOn(page, el("OK button in \"Edit Permissions\" dialog")));
35
+ await session.step(29, "Then \"Edit Permissions\" dialog should be absent", () => shouldBe(page, el("\"Edit Permissions\" dialog"), "absent"));
36
+ await session.step(30, "And an info balloon containing \"Campaign saved successfully\" should have been shown", () => infoBalloonText(page, "Campaign saved successfully"));
37
+ await session.step(31, "And the campaign \"BDD Permissions\" should let the sharing user edit it on the server", () => sharingUserMayEdit(page, "BDD Permissions"));
38
+ await session.step(32, "When user clicks on \"Edit campaign permissions\" icon in toolbar", () => clickOn(page, el("\"Edit campaign permissions\" icon in toolbar")));
39
+ await session.step(33, "Then \"Edit Permissions\" dialog should be visible", () => shouldBe(page, el("\"Edit Permissions\" dialog"), "visible"));
40
+ await session.step(34, "And \"Edit Permissions\" dialog should name the sharing user", () => namesSharingUser(page, el("\"Edit Permissions\" dialog")));
41
+ await session.step(35, "And the sharing user's row of \"Edit Permissions\" dialog should show the user's picture", () => sharingUserPicture(page, el("\"Edit Permissions\" dialog")));
42
+ await session.step(36, "When user clicks on CANCEL button in \"Edit Permissions\" dialog", () => clickOn(page, el("CANCEL button in \"Edit Permissions\" dialog")));
43
+ await session.step(37, "Then \"Edit Permissions\" dialog should be absent", () => shouldBe(page, el("\"Edit Permissions\" dialog"), "absent"));
44
+ });
45
+ test("A group row shows the group icon, a user added from the picker the user's picture", async ({browser}) => {
46
+ const page = await session.page(browser);
47
+ await session.step(14, "Given user is logged in", () => loggedIn(page));
48
+ await session.step(15, "And the Hit Design campaign \"BDD Permissions\" with the stages \"Idea\" and a table of:", () => hitDesignCampaign(page, "BDD Permissions", "Idea", [["Molecule","Stage","V-iD","MW"],["CCO","Idea","","46.07"]]), [["Molecule","Stage","V-iD","MW"],["CCO","Idea","","46.07"]]);
49
+ await session.step(18, "When user opens the campaign \"BDD Permissions\" by its link", () => openByLink(page, "BDD Permissions"));
50
+ await session.step(40, "When user clicks on \"Edit campaign permissions\" icon in toolbar", () => clickOn(page, el("\"Edit campaign permissions\" icon in toolbar")));
51
+ await session.step(41, "Then \"Edit Permissions\" dialog should be visible", () => shouldBe(page, el("\"Edit Permissions\" dialog"), "visible"));
52
+ await session.step(42, "And the \"All users\" row of \"Edit Permissions\" dialog should show a group icon", () => groupPicture(page, "All users", el("\"Edit Permissions\" dialog")));
53
+ await session.step(43, "When user lets the sharing user edit in \"Edit Permissions\" dialog", () => grantSharingUserEdit(page, el("\"Edit Permissions\" dialog")));
54
+ await session.step(44, "Then the sharing user's row of \"Edit Permissions\" dialog should show the user's picture", () => sharingUserPicture(page, el("\"Edit Permissions\" dialog")));
55
+ await session.step(45, "When user clicks on CANCEL button in \"Edit Permissions\" dialog", () => clickOn(page, el("CANCEL button in \"Edit Permissions\" dialog")));
56
+ await session.step(46, "Then \"Edit Permissions\" dialog should be absent", () => shouldBe(page, el("\"Edit Permissions\" dialog"), "absent"));
57
+ });
58
+ });