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","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","getCountFromText","countText","Number","text","trim","split","env","exports","isDevelopment","Cypress","environment","development","isReview","review","isStaging","staging","isProduction","production","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,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAA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