@bigbinary/neeto-commons-frontend 2.0.131 → 2.0.133

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.
@@ -416,6 +416,8 @@ export const navigationUtils: {
416
416
  verifyChatWithUsTab: () => void;
417
417
  verifyMyProfileTab: (props: VerifyMyProfileTabPropTypes) => void;
418
418
  verifyOrganizationTab: () => void;
419
+ openProfileOrHelpCenter: (props: OpenProfileOrHelpCenterPropTypes) => void;
420
+ openWhatsNewPane: (props: OpenWhatsNewPanePropTypes) => void;
419
421
  };
420
422
 
421
423
  // exporting all selectors
package/cypress-utils.js CHANGED
@@ -390,7 +390,7 @@ var initCustomCommands = function initCustomCommands() {
390
390
  return win.location.href = newUrl;
391
391
  });
392
392
  });
393
- cy.get(selector).invoke("click");
393
+ cy.get(selector).click();
394
394
  cy.get("@".concat(alias)).should("be.called");
395
395
  cy.url().should("include", url);
396
396
  });
@@ -701,6 +701,195 @@ var profileTexts = {
701
701
  myOrganization: "My organization"
702
702
  };
703
703
 
704
+ var verifyTabMenu = function verifyTabMenu(_ref) {
705
+ var tabSelector = _ref.tabSelector,
706
+ _ref$alias = _ref.alias,
707
+ alias = _ref$alias === void 0 ? "fetchData" : _ref$alias,
708
+ _ref$requestCount = _ref.requestCount,
709
+ requestCount = _ref$requestCount === void 0 ? 1 : _ref$requestCount;
710
+ requestCount && cy.interceptApi(alias, requestCount);
711
+ cy.get(tabSelector).click();
712
+ requestCount && cy.waitForMultipleRequest("@".concat(alias), requestCount);
713
+ cy.verifyAttribute({
714
+ selector: tabSelector,
715
+ attr: "class",
716
+ value: "active"
717
+ });
718
+ };
719
+ var clickOnHelpSubTab = function clickOnHelpSubTab(tabSelector, tabText) {
720
+ openProfileOrHelpCenter({
721
+ tabSelector: helpIconSelectors.helpButton,
722
+ subTabLink: helpIconSelectors.whatsNewButton,
723
+ count: 5
724
+ });
725
+ cy.get(tabSelector).should("have.text", tabText).invoke("click");
726
+ };
727
+ var verifyHelpDocumentationLink = function verifyHelpDocumentationLink(_ref2) {
728
+ var articleTitle = _ref2.articleTitle,
729
+ alias = _ref2.alias,
730
+ _ref2$requestCount = _ref2.requestCount,
731
+ requestCount = _ref2$requestCount === void 0 ? 3 : _ref2$requestCount;
732
+ openProfileOrHelpCenter({
733
+ tabSelector: helpIconSelectors.helpButton,
734
+ subTabLink: helpIconSelectors.whatsNewButton,
735
+ count: 5
736
+ });
737
+ cy.clickByRemoveTargetAttr(helpIconSelectors.documentationButton);
738
+ cy.get(commonSelectors.articlePageTitle, {
739
+ timeout: 10000
740
+ }).should("have.text", articleTitle);
741
+ cy.interceptApi(alias, requestCount);
742
+ cy.go("back");
743
+ cy.waitForMultipleRequest("@".concat(alias), requestCount);
744
+ };
745
+ var verifyKeyboardShortcutsPane = function verifyKeyboardShortcutsPane() {
746
+ clickOnHelpSubTab(helpIconSelectors.keyboardShortcutButton, helpIconTexts.keyboardShortcuts);
747
+ cy.get(helpIconSelectors.keyboardShortcutPaneHeading).should("have.text", helpIconTexts.keyboardShortcuts);
748
+ cy.get(helpIconSelectors.keyboardShortcutPaneCrossIcon).click();
749
+ };
750
+ var verifyWhatsNewTab = function verifyWhatsNewTab(whatsNewHeading) {
751
+ openProfileOrHelpCenter({
752
+ tabSelector: helpIconSelectors.helpButton,
753
+ subTabLink: helpIconSelectors.whatsNewButton,
754
+ count: 5
755
+ });
756
+ cy.get(helpIconSelectors.whatsNewButton).should("contain.text", helpIconTexts.whatsNew);
757
+ openWhatsNewPane();
758
+ cy.get(helpIconSelectors.whatsNewWidgetInfo).should("have.text", whatsNewHeading);
759
+ cy.get(helpIconSelectors.whatsNewWidgetCloseButton).last().click();
760
+ cy.get(helpIconSelectors.whatsNewWidgetInfo).should("not.exist");
761
+ };
762
+ var waitForChatWidget = function waitForChatWidget() {
763
+ var timeOut = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
764
+ var defaultWait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
765
+ if (timeOut === 0) return;
766
+ cy.ifNotExist(chatWidgetSelectors.widgetIframe, function () {
767
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
768
+ cy.wait(defaultWait);
769
+ navigationUtils.clickOnHelpSubTab(helpIconSelectors.chatButton, helpIconTexts.liveChat);
770
+ cy.ifNotExist(chatWidgetSelectors.widgetIframe, function () {
771
+ waitForChatWidget(timeOut - 1);
772
+ });
773
+ });
774
+ };
775
+ var verifyChatWithUsTab = function verifyChatWithUsTab(_ref3) {
776
+ var alias = _ref3.alias,
777
+ _ref3$requestCount = _ref3.requestCount,
778
+ requestCount = _ref3$requestCount === void 0 ? 3 : _ref3$requestCount;
779
+ requestCount && cy.interceptNonVersionedApi({
780
+ url: requestApis.allChatPath,
781
+ alias: alias,
782
+ times: requestCount
783
+ });
784
+ clickOnHelpSubTab(helpIconSelectors.chatButton, helpIconTexts.liveChat);
785
+ requestCount && cy.waitForMultipleRequest("@".concat(alias), requestCount);
786
+ waitForChatWidget();
787
+ cy.withinIframe(chatWidgetSelectors.widgetIframe, function () {
788
+ requestCount && cy.interceptNonVersionedApi({
789
+ url: requestApis.allChatPath,
790
+ alias: alias,
791
+ times: requestCount
792
+ });
793
+ cy.get(chatWidgetSelectors.chatWidgetHomeCard, {
794
+ timeout: 10000
795
+ }).eq(0).should("have.text", helpIconTexts.newConversation).click();
796
+ requestCount && cy.wait("@".concat(alias), requestCount);
797
+ requestCount && cy.interceptNonVersionedApi({
798
+ url: requestApis.allChatPath,
799
+ alias: alias,
800
+ times: requestCount
801
+ });
802
+ cy.get(chatWidgetSelectors.widgetSubmitButton).click();
803
+ requestCount && cy.waitForMultipleRequest("@".concat(alias), requestCount);
804
+ cy.get(chatWidgetSelectors.chatBubbleMessage).should("have.text", helpIconTexts.chatMessage);
805
+ });
806
+ cy.get(chatWidgetSelectors.chatCloseButton).click();
807
+ cy.get(chatWidgetSelectors.widgetIframe).should("not.exist");
808
+ };
809
+ var verifyMyProfileTab = function verifyMyProfileTab(_ref4) {
810
+ var alias = _ref4.alias,
811
+ _ref4$requestCount = _ref4.requestCount,
812
+ requestCount = _ref4$requestCount === void 0 ? 2 : _ref4$requestCount;
813
+ openProfileOrHelpCenter({
814
+ tabSelector: profileSelectors.tab,
815
+ subTabLink: profileSelectors.logoutLink,
816
+ count: 5
817
+ });
818
+ cy.get(profileSelectors.myProfileButton).should("have.text", profileTexts.myProfile);
819
+ cy.globalState("subdomainName").then(function (subdomainName) {
820
+ cy.window().then(function (win) {
821
+ cy.stub(win, "open").as(alias).callsFake(function (newUrl) {
822
+ return win.location.href = newUrl;
823
+ });
824
+ });
825
+ cy.get(profileSelectors.myProfileButton).invoke("click");
826
+ cy.get("@".concat(alias)).should("be.called");
827
+ cy.url().should("include", requestApis.myProfilePath(subdomainName));
828
+ });
829
+ cy.get(commonSelectors.heading).should("have.text", profileTexts.profileSettings);
830
+ cy.globalState("subdomainName").then(function (subdomainName) {
831
+ return cy.url().should("include", requestApis.myProfilePath(subdomainName));
832
+ });
833
+ cy.interceptApi(alias, requestCount);
834
+ cy.go("back");
835
+ cy.waitForMultipleRequest("@".concat(alias), requestCount);
836
+ };
837
+ var verifyOrganizationTab = function verifyOrganizationTab() {
838
+ openProfileOrHelpCenter({
839
+ tabSelector: profileSelectors.tab,
840
+ subTabLink: profileSelectors.logoutLink,
841
+ count: 5
842
+ });
843
+ cy.get(profileSelectors.organizationSettingsButton).should("have.text", profileTexts.myOrganization);
844
+ cy.globalState("subdomainName").then(function (subdomainName) {
845
+ return cy.openInSameTabOnClick({
846
+ url: requestApis.settingsPath(subdomainName),
847
+ selector: profileSelectors.organizationSettingsButton,
848
+ alias: "navigateToSettings"
849
+ });
850
+ });
851
+ cy.get(commonSelectors.heading).should("have.text", commonTexts.settings);
852
+ cy.globalState("subdomainName").then(function (subdomainName) {
853
+ return cy.url().should("include", requestApis.settingsPath(subdomainName));
854
+ });
855
+ };
856
+ var openProfileOrHelpCenter = function openProfileOrHelpCenter(_ref5) {
857
+ var tabSelector = _ref5.tabSelector,
858
+ subTabLink = _ref5.subTabLink,
859
+ _ref5$count = _ref5.count,
860
+ count = _ref5$count === void 0 ? 1 : _ref5$count,
861
+ _ref5$timeout = _ref5.timeout,
862
+ timeout = _ref5$timeout === void 0 ? 2000 : _ref5$timeout;
863
+ if (count === 0) return;
864
+ cy.get(tabSelector).click();
865
+ cy.ifNotExist(subTabLink, function () {
866
+ cy.wait(timeout); // eslint-disable-line cypress/no-unnecessary-waiting
867
+ openProfileOrHelpCenter(count - 1);
868
+ });
869
+ };
870
+ var openWhatsNewPane = function openWhatsNewPane() {
871
+ var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
872
+ var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2000;
873
+ if (count === 0) return;
874
+ cy.get(helpIconSelectors.whatsNewButton).invoke("click");
875
+ cy.ifNotExist(helpIconSelectors.whatsNewWidgetInfo, function () {
876
+ cy.wait(timeout); // eslint-disable-line cypress/no-unnecessary-waiting
877
+ openWhatsNewPane(count - 1);
878
+ });
879
+ };
880
+ var navigationUtils = {
881
+ verifyTabMenu: verifyTabMenu,
882
+ clickOnHelpSubTab: clickOnHelpSubTab,
883
+ verifyHelpDocumentationLink: verifyHelpDocumentationLink,
884
+ verifyKeyboardShortcutsPane: verifyKeyboardShortcutsPane,
885
+ verifyWhatsNewTab: verifyWhatsNewTab,
886
+ verifyChatWithUsTab: verifyChatWithUsTab,
887
+ verifyMyProfileTab: verifyMyProfileTab,
888
+ verifyOrganizationTab: verifyOrganizationTab,
889
+ openProfileOrHelpCenter: openProfileOrHelpCenter,
890
+ openWhatsNewPane: openWhatsNewPane
891
+ };
892
+
704
893
  var verifySSOLoginPage = function verifySSOLoginPage() {
705
894
  cy.log("verify Login Page");
706
895
  cy.get(loginSelectors.githubAuthenticationButton).should("be.visible");
@@ -719,6 +908,11 @@ var verifySSOLoginPage = function verifySSOLoginPage() {
719
908
  };
720
909
  var logout = function logout(homeUrl) {
721
910
  cy.get(profileSelectors.loader).should("not.exist");
911
+ navigationUtils.openProfileOrHelpCenter({
912
+ tabSelector: profileSelectors.tab,
913
+ subTabLink: profileSelectors.logoutLink,
914
+ count: 5
915
+ });
722
916
  cy.get(profileSelectors.tab).click();
723
917
  cy.get(profileSelectors.logoutLink).should("have.text", commonTexts.logout).invoke("click");
724
918
  cy.url({
@@ -1199,146 +1393,5 @@ var verifyCrossSiteScript = function verifyCrossSiteScript(inputSelector, submit
1199
1393
  cy.get(commonSelectors.windowAlert).should("not.exist");
1200
1394
  };
1201
1395
 
1202
- var verifyTabMenu = function verifyTabMenu(_ref) {
1203
- var tabSelector = _ref.tabSelector,
1204
- toolTiptext = _ref.toolTiptext,
1205
- _ref$alias = _ref.alias,
1206
- alias = _ref$alias === void 0 ? "fetchData" : _ref$alias,
1207
- _ref$requestCount = _ref.requestCount,
1208
- requestCount = _ref$requestCount === void 0 ? 1 : _ref$requestCount;
1209
- cy.verifyTooltip(tabSelector, toolTiptext);
1210
- requestCount && cy.interceptApi(alias, requestCount);
1211
- cy.get(tabSelector).click();
1212
- requestCount && cy.waitForMultipleRequest("@".concat(alias), requestCount);
1213
- cy.verifyAttribute({
1214
- selector: tabSelector,
1215
- attr: "class",
1216
- value: "active"
1217
- });
1218
- };
1219
- var clickOnHelpSubTab = function clickOnHelpSubTab(tabSelector, tabText) {
1220
- cy.get(helpIconSelectors.helpButton).click();
1221
- cy.get(tabSelector).should("have.text", tabText).invoke("click");
1222
- };
1223
- var verifyHelpDocumentationLink = function verifyHelpDocumentationLink(_ref2) {
1224
- var articleTitle = _ref2.articleTitle,
1225
- alias = _ref2.alias,
1226
- _ref2$requestCount = _ref2.requestCount,
1227
- requestCount = _ref2$requestCount === void 0 ? 3 : _ref2$requestCount;
1228
- cy.get(helpIconSelectors.helpButton).invoke("click");
1229
- cy.clickByRemoveTargetAttr(helpIconSelectors.documentationButton);
1230
- cy.get(commonSelectors.articlePageTitle, {
1231
- timeout: 10000
1232
- }).should("have.text", articleTitle);
1233
- cy.interceptApi(alias, requestCount);
1234
- cy.go("back");
1235
- cy.waitForMultipleRequest("@".concat(alias), requestCount);
1236
- };
1237
- var verifyKeyboardShortcutsPane = function verifyKeyboardShortcutsPane() {
1238
- clickOnHelpSubTab(helpIconSelectors.keyboardShortcutButton, helpIconTexts.keyboardShortcuts);
1239
- cy.get(helpIconSelectors.keyboardShortcutPaneHeading).should("have.text", helpIconTexts.keyboardShortcuts);
1240
- cy.get(helpIconSelectors.keyboardShortcutPaneCrossIcon).click();
1241
- };
1242
- var verifyWhatsNewTab = function verifyWhatsNewTab(whatsNewHeading) {
1243
- cy.get(helpIconSelectors.helpButton).click();
1244
- cy.get(helpIconSelectors.whatsNewButton).should("contain.text", helpIconTexts.whatsNew).invoke("click");
1245
- cy.get(helpIconSelectors.whatsNewWidgetInfo).should("have.text", whatsNewHeading);
1246
- cy.get(helpIconSelectors.whatsNewWidgetCloseButton).last().click();
1247
- cy.get(helpIconSelectors.whatsNewWidgetInfo).should("not.exist");
1248
- };
1249
- var waitForChatWidget = function waitForChatWidget() {
1250
- var timeOut = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
1251
- var defaultWait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
1252
- if (timeOut === 0) return;
1253
- cy.ifNotExist(chatWidgetSelectors.widgetIframe, function () {
1254
- // eslint-disable-next-line cypress/no-unnecessary-waiting
1255
- cy.wait(defaultWait);
1256
- navigationUtils.clickOnHelpSubTab(helpIconSelectors.chatButton, helpIconTexts.liveChat);
1257
- cy.ifNotExist(chatWidgetSelectors.widgetIframe, function () {
1258
- waitForChatWidget(timeOut - 1);
1259
- });
1260
- });
1261
- };
1262
- var verifyChatWithUsTab = function verifyChatWithUsTab(_ref3) {
1263
- var alias = _ref3.alias,
1264
- _ref3$requestCount = _ref3.requestCount,
1265
- requestCount = _ref3$requestCount === void 0 ? 3 : _ref3$requestCount;
1266
- requestCount && cy.interceptNonVersionedApi({
1267
- url: requestApis.allChatPath,
1268
- alias: alias,
1269
- times: requestCount
1270
- });
1271
- clickOnHelpSubTab(helpIconSelectors.chatButton, helpIconTexts.liveChat);
1272
- requestCount && cy.waitForMultipleRequest("@".concat(alias), requestCount);
1273
- waitForChatWidget();
1274
- cy.withinIframe(chatWidgetSelectors.widgetIframe, function () {
1275
- requestCount && cy.interceptNonVersionedApi({
1276
- url: requestApis.allChatPath,
1277
- alias: alias,
1278
- times: requestCount
1279
- });
1280
- cy.get(chatWidgetSelectors.chatWidgetHomeCard, {
1281
- timeout: 10000
1282
- }).eq(0).should("have.text", helpIconTexts.newConversation).click();
1283
- requestCount && cy.wait("@".concat(alias), requestCount);
1284
- requestCount && cy.interceptNonVersionedApi({
1285
- url: requestApis.allChatPath,
1286
- alias: alias,
1287
- times: requestCount
1288
- });
1289
- cy.get(chatWidgetSelectors.widgetSubmitButton).click();
1290
- requestCount && cy.waitForMultipleRequest("@".concat(alias), requestCount);
1291
- cy.get(chatWidgetSelectors.chatBubbleMessage).should("have.text", helpIconTexts.chatMessage);
1292
- });
1293
- cy.get(chatWidgetSelectors.chatCloseButton).click();
1294
- cy.get(chatWidgetSelectors.widgetIframe).should("not.exist");
1295
- };
1296
- var verifyMyProfileTab = function verifyMyProfileTab(_ref4) {
1297
- var alias = _ref4.alias,
1298
- _ref4$requestCount = _ref4.requestCount,
1299
- requestCount = _ref4$requestCount === void 0 ? 2 : _ref4$requestCount;
1300
- cy.get(profileSelectors.tab).click();
1301
- cy.get(profileSelectors.myProfileButton).should("have.text", profileTexts.myProfile);
1302
- cy.globalState("subdomainName").then(function (subdomainName) {
1303
- return cy.openInSameTabOnClick({
1304
- url: requestApis.myProfilePath(subdomainName),
1305
- selector: profileSelectors.myProfileButton,
1306
- alias: alias
1307
- });
1308
- });
1309
- cy.get(commonSelectors.heading).should("have.text", profileTexts.profileSettings);
1310
- cy.globalState("subdomainName").then(function (subdomainName) {
1311
- return cy.url().should("include", requestApis.myProfilePath(subdomainName));
1312
- });
1313
- cy.interceptApi(alias, requestCount);
1314
- cy.go("back");
1315
- cy.waitForMultipleRequest("@".concat(alias), requestCount);
1316
- };
1317
- var verifyOrganizationTab = function verifyOrganizationTab() {
1318
- cy.get(profileSelectors.tab).click();
1319
- cy.get(profileSelectors.organizationSettingsButton).should("have.text", profileTexts.myOrganization);
1320
- cy.globalState("subdomainName").then(function (subdomainName) {
1321
- return cy.openInSameTabOnClick({
1322
- url: requestApis.settingsPath(subdomainName),
1323
- selector: profileSelectors.organizationSettingsButton,
1324
- alias: "navigateToSettings"
1325
- });
1326
- });
1327
- cy.get(commonSelectors.heading).should("have.text", commonTexts.settings);
1328
- cy.globalState("subdomainName").then(function (subdomainName) {
1329
- return cy.url().should("include", requestApis.settingsPath(subdomainName));
1330
- });
1331
- };
1332
- var navigationUtils = {
1333
- verifyTabMenu: verifyTabMenu,
1334
- clickOnHelpSubTab: clickOnHelpSubTab,
1335
- verifyHelpDocumentationLink: verifyHelpDocumentationLink,
1336
- verifyKeyboardShortcutsPane: verifyKeyboardShortcutsPane,
1337
- verifyWhatsNewTab: verifyWhatsNewTab,
1338
- verifyChatWithUsTab: verifyChatWithUsTab,
1339
- verifyMyProfileTab: verifyMyProfileTab,
1340
- verifyOrganizationTab: verifyOrganizationTab
1341
- };
1342
-
1343
1396
  export { authUtils, chatWidgetSelectors, commonSelectors, commonTexts, createOrganization, dataCy, dataTestId, dateUtils, env, environment, getTestTitle, getUrl, helpIconSelectors, helpIconTexts, initCustomCommands, initializeCredentials, isStagingEnv, joinHyphenCase, loginSelectors, memberFormErrorTexts, memberFormSelectors, memberSelectors, memberTableTexts, memberTexts, memberUtils, navigationUtils, profileSelectors, profileTexts, setListCount, signUpSelectors, signUpTexts, tableSelectors, verifyCrossSiteScript, verifyListCount };
1344
1397
  //# sourceMappingURL=cypress-utils.js.map