package.cjs.cypress-utils.utils.common.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
{"version":3,"file":"common.js","names":["_constants","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","getCountFromText","countText","Number","text","trim","split","env","isDevelopment","Cypress","environment","development","isReview","review","isStaging","staging","isProduction","production","exports","isNightlyRun","tld","isStagingEnv","dataCy","value","suffix","undefined","concat","dataTestId","setListCount","countSelector","alias","cy","get","then","wrap","as","verifyListCount","count","should","getUrl","path","getTestTitle","ctx","mocha","getRunner","suite","currentTest","parent","title","joinHyphenCase","_len","args","Array","_key","join","replace","toLowerCase","hyphenize","input","fallbackString","String","initializeCredentials","stagingData","task","state","newState","businessName","currentUserName","email","firstName","lastName","subdomainName","skipSetup","baseUrl","domain","config"],"sources":["../../../../src/cypress-utils/utils/common.js"],"sourcesContent":["import { environment } from \"../constants\";\n\nconst getCountFromText = countText =>\n Number(countText.text().trim().split(\" \")[0]);\n\nconst env = {\n isDevelopment: Cypress.env(\"configFile\") === environment.development,\n isReview: Cypress.env(\"configFile\") === environment.review,\n isStaging: Cypress.env(\"configFile\") === environment.staging,\n isProduction: Cypress.env(\"configFile\") === environment.production,\n};\nenv.isNightlyRun = env.isProduction || env.isStaging;\nenv.tld = env.isProduction ? \"com\" : \"net\";\n\nconst isStagingEnv = Cypress.env(\"configFile\") === environment.staging;\n\nconst dataCy = (value, suffix = \"\") => `[data-cy='${value}']${suffix}`;\n\nconst dataTestId = (value, suffix = \"\") => `[data-testid='${value}']${suffix}`;\n\nconst setListCount = (countSelector, alias) =>\n cy.get(countSelector).then(countText => {\n cy.wrap(getCountFromText(countText)).as(alias);\n });\n\nconst verifyListCount = (countSelector, count) =>\n cy.get(countSelector).then(countText => {\n cy.wrap(getCountFromText(countText)).should(\"eq\", count);\n });\n\nconst getUrl = path => `/api/v1/${path}`;\n\nconst getTestTitle = () => {\n const { ctx } = Cypress.mocha.getRunner().suite;\n\n return ctx.currentTest.parent.title;\n};\n\nconst joinHyphenCase = (...args) =>\n args.join(\" \").replace(/\\s+/g, \"-\").toLowerCase();\n\nconst hyphenize = input => {\n const fallbackString = \"\";\n if (typeof input === \"number\") return String(input);\n\n if (input && typeof input === \"string\" && input.replace) {\n return input\n .replace(/[\\s_]/g, \"-\")\n .replace(/([a-z])([A-Z])/g, \"$1-$2\")\n .replace(/-+/g, \"-\")\n .toLowerCase();\n }\n\n return fallbackString;\n};\n\nconst initializeCredentials = stagingData => {\n cy.task(\"getGlobalState\").then(state => {\n const newState = {\n ...state,\n businessName: state.businessName || stagingData.businessName,\n currentUserName: state.currentUserName || stagingData.currentUserName,\n email: state.email || stagingData.email,\n firstName: state.firstName || stagingData.firstName,\n lastName: state.lastName || stagingData.lastName,\n subdomainName: state.subdomainName || stagingData.subdomainName,\n skipSetup: state.skipSetup,\n };\n if (isStagingEnv) {\n const baseUrl = `https://${newState.subdomainName}.${stagingData.domain}`;\n Cypress.config(\"baseUrl\", baseUrl);\n }\n cy.task(\"bulkUpdateGlobalState\", newState);\n });\n};\n\nexport {\n env,\n isStagingEnv,\n dataCy,\n dataTestId,\n setListCount,\n verifyListCount,\n getUrl,\n getTestTitle,\n joinHyphenCase,\n hyphenize,\n initializeCredentials,\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAA2C,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAA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