@testim/testim-cli 3.275.0 → 3.279.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.
@@ -15,6 +15,7 @@ const hash = require('object-hash');
15
15
  const { ArgError } = require('../errors');
16
16
 
17
17
  const DEFAULT_REQUEST_RETRY = 3;
18
+ const GRID_PATH = '/grid';
18
19
 
19
20
  function getTokenHeader() {
20
21
  return testimCustomToken.getCustomTokenV3()
@@ -553,6 +554,25 @@ function updateRemoteRunFailure(body) {
553
554
  return httpRequest.post({ url: `${config.SERVICES_HOST}/result/remoteRunFailure`, body });
554
555
  }
555
556
 
557
+ /**
558
+ * @param {string} projectType
559
+ * @param {string} gridId
560
+ * @param {string} companyId
561
+ * @param {string} selectors
562
+ * @return {Promise<Array[import('../../../services/src/grid/mobileGridService').MobileDevice] | null>}
563
+ */
564
+
565
+ async function getMobileDevicesFromGrid({ projectType, gridId, companyId, selectors }) {
566
+ let url = `${GRID_PATH}/mobileDevices/${gridId}/${companyId}?projectType=${projectType}`;
567
+ url = selectors ? `${url}&selectors=${encodeURIComponent(selectors)}` : url;
568
+ try {
569
+ return pRetry(() => getWithAuth({ url }), { retries: DEFAULT_REQUEST_RETRY });
570
+ } catch (err) {
571
+ logger.warn('could\'nt get devices from headspin grid.', { err });
572
+ return null;
573
+ }
574
+ }
575
+
556
576
  module.exports = {
557
577
  getAppDetails,
558
578
  getS3Artifact,
@@ -591,4 +611,5 @@ module.exports = {
591
611
  forceUpdateCloudflareTunnelRoutes,
592
612
  deleteCloudflareTunnel,
593
613
  updateRemoteRunFailure,
614
+ getMobileDevicesFromGrid,
594
615
  };