All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.cypress-utils.utils.organization.js.map Maven / Gradle / Ivy

Go to download

A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.

There is a newer version: 4.12.3
Show newest version
{"version":3,"file":"organization.js","names":["env","requestApis","commonSelectors","signUpSelectors","signUpTexts","extractSubdomainFromError","inputString","regex","matches","match","updateSubdomainIfExists","appName","cy","ifExist","subdomainError","get","invoke","then","text","intercept","url","subdomainAvailability","times","as","newOrganizationName","clearAndType","subdomainNameTextField","wait","ifNotExist","task","key","value","newBaseUrl","concat","tld","Cypress","config","organizationNameTextField","createOrganization","_ref","email","businessName","subdomainName","firstName","lastName","isMailosaurEmail","includes","defaultOtp","appNameInLowerCase","toLowerCase","isNeetoAuth","authUrl","visit","emailTextField","signUp","submitButton","click","getEmailContent","sentTo","subject","loginCode","emailBody","otp","html","codes","otpTextBox","type","countries","organizationSubmitButton","timeout","should","profile","firstNameTextField","lastNameTextField","checkbox","profileSubmitButton"],"sources":["../../../src/cypress-utils/utils/organization.js"],"sourcesContent":["import { env } from \"./common\";\n\nimport { requestApis } from \"../constants/routes\";\nimport { commonSelectors } from \"../constants/selectors/common\";\nimport { signUpSelectors } from \"../constants/selectors/signUp\";\nimport { signUpTexts } from \"../constants/texts/signUp\";\n\nconst extractSubdomainFromError = inputString => {\n  const regex = /cpt[a-zA-Z0-9-]+/g;\n  const matches = inputString.match(regex);\n\n  return matches[1];\n};\n\nconst updateSubdomainIfExists = appName => {\n  cy.ifExist(signUpSelectors.subdomainError, () => {\n    cy.get(signUpSelectors.subdomainError)\n      .invoke(\"text\")\n      .then(text => {\n        cy.intercept({ url: requestApis.subdomainAvailability, times: 1 }).as(\n          \"subdomainRequest\"\n        );\n        const newOrganizationName = extractSubdomainFromError(text);\n        cy.clearAndType(\n          signUpSelectors.subdomainNameTextField,\n          newOrganizationName\n        );\n        cy.wait(\"@subdomainRequest\");\n\n        cy.ifNotExist(signUpSelectors.subdomainError, () => {\n          cy.task(\"updateGlobalState\", {\n            key: \"subdomainName\",\n            value: newOrganizationName,\n          });\n\n          cy.task(\"updateGlobalState\", {\n            key: \"businessName\",\n            value: newOrganizationName,\n          });\n          const newBaseUrl = `https://${newOrganizationName}.${appName}.${env.tld}`;\n          Cypress.config(\"baseUrl\", newBaseUrl);\n          cy.clearAndType(\n            signUpSelectors.organizationNameTextField,\n            newOrganizationName\n          );\n        });\n      });\n\n    cy.ifExist(signUpSelectors.subdomainError, () =>\n      updateSubdomainIfExists(appName)\n    );\n  });\n};\n\nexport const createOrganization = ({\n  email,\n  businessName,\n  subdomainName,\n  firstName,\n  lastName,\n  appName,\n}) => {\n  const isMailosaurEmail = email.includes(\"mailosaur\");\n  const defaultOtp = \"123456\";\n  const appNameInLowerCase = appName.toLowerCase();\n  const isNeetoAuth = appNameInLowerCase === \"neetoauth\";\n  const authUrl = `https://app.neetoauth.${env.tld}/signups/new`;\n  isNeetoAuth\n    ? cy.visit(authUrl)\n    : cy.visit(`${authUrl}?redirect_uri=${appNameInLowerCase}.${env.tld}`);\n  cy.clearAndType(signUpSelectors.emailTextField, email);\n  cy.intercept({ url: requestApis.signUp, times: 2 }).as(\"signupRequest\");\n  cy.get(signUpSelectors.submitButton).click();\n  cy.wait(\"@signupRequest\");\n  if (isMailosaurEmail) {\n    cy.getEmailContent({ sentTo: email, subject: signUpTexts.loginCode }).then(\n      emailBody => {\n        const otp = emailBody.html.codes[0].value;\n        cy.get(signUpSelectors.otpTextBox).type(otp);\n      }\n    );\n  } else cy.get(signUpSelectors.otpTextBox).type(defaultOtp);\n\n  cy.wait(\"@signupRequest\");\n  cy.intercept({ url: requestApis.subdomainAvailability, times: 1 }).as(\n    \"subdomainRequest\"\n  );\n  cy.clearAndType(signUpSelectors.organizationNameTextField, businessName);\n  cy.clearAndType(signUpSelectors.subdomainNameTextField, subdomainName);\n  cy.wait(\"@subdomainRequest\");\n  updateSubdomainIfExists(appNameInLowerCase);\n\n  cy.intercept({ url: requestApis.signUp, times: 1 }).as(\"signupRequest\");\n  cy.intercept({ url: requestApis.countries, times: 1 }).as(\"fetchCountries\");\n  cy.get(signUpSelectors.organizationSubmitButton).click();\n  cy.wait(\"@signupRequest\");\n  cy.url({ timeout: 15000 }).should(\"include\", signUpTexts.profile);\n  cy.wait(\"@fetchCountries\");\n  cy.clearAndType(signUpSelectors.firstNameTextField, firstName);\n  cy.clearAndType(signUpSelectors.lastNameTextField, lastName);\n  cy.get(commonSelectors.checkbox).click();\n  cy.intercept({ url: requestApis.signUp, times: 1 }).as(\"setupProfile\");\n  cy.get(signUpSelectors.profileSubmitButton).click();\n  cy.wait(\"@setupProfile\");\n};\n"],"mappings":"AAAA,SAASA,GAAG;AAEZ,SAASC,WAAW;AACpB,SAASC,eAAe;AACxB,SAASC,eAAe;AACxB,SAASC,WAAW;AAEpB,IAAMC,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAGC,WAAW,EAAI;EAC/C,IAAMC,KAAK,GAAG,mBAAmB;EACjC,IAAMC,OAAO,GAAGF,WAAW,CAACG,KAAK,CAACF,KAAK,CAAC;EAExC,OAAOC,OAAO,CAAC,CAAC,CAAC;AACnB,CAAC;AAED,IAAME,wBAAuB,GAAG,SAA1BA,uBAAuBA,CAAGC,OAAO,EAAI;EACzCC,EAAE,CAACC,OAAO,CAACV,eAAe,CAACW,cAAc,EAAE,YAAM;IAC/CF,EAAE,CAACG,GAAG,CAACZ,eAAe,CAACW,cAAc,CAAC,CACnCE,MAAM,CAAC,MAAM,CAAC,CACdC,IAAI,CAAC,UAAAC,IAAI,EAAI;MACZN,EAAE,CAACO,SAAS,CAAC;QAAEC,GAAG,EAAEnB,WAAW,CAACoB,qBAAqB;QAAEC,KAAK,EAAE;MAAE,CAAC,CAAC,CAACC,EAAE,CACnE,kBACF,CAAC;MACD,IAAMC,mBAAmB,GAAGnB,yBAAyB,CAACa,IAAI,CAAC;MAC3DN,EAAE,CAACa,YAAY,CACbtB,eAAe,CAACuB,sBAAsB,EACtCF,mBAC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