package.cjs.cypress-utils.utils.organization.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":"organization.js","names":["_common","require","_routes","_common2","_signUp","_signUp2","extractSubdomainFromError","inputString","regex","matches","match","updateSubdomainIfExists","appName","cy","ifExist","signUpSelectors","subdomainError","get","invoke","then","text","intercept","url","requestApis","subdomainAvailability","times","as","newOrganizationName","clearAndType","subdomainNameTextField","wait","ifNotExist","task","key","value","newBaseUrl","concat","env","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","signUpTexts","loginCode","emailBody","otp","html","codes","otpTextBox","type","countries","organizationSubmitButton","timeout","should","profile","firstNameTextField","lastNameTextField","commonSelectors","checkbox","profileSubmitButton","exports"],"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,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAMK,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,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAGC,OAAO,EAAI;EACzCC,EAAE,CAACC,OAAO,CAACC,uBAAe,CAACC,cAAc,EAAE,YAAM;IAC/CH,EAAE,CAACI,GAAG,CAACF,uBAAe,CAACC,cAAc,CAAC,CACnCE,MAAM,CAAC,MAAM,CAAC,CACdC,IAAI,CAAC,UAAAC,IAAI,EAAI;MACZP,EAAE,CAACQ,SAAS,CAAC;QAAEC,GAAG,EAAEC,mBAAW,CAACC,qBAAqB;QAAEC,KAAK,EAAE;MAAE,CAAC,CAAC,CAACC,EAAE,CACnE,kBAAkB,CACnB;MACD,IAAMC,mBAAmB,GAAGrB,yBAAyB,CAACc,IAAI,CAAC;MAC3DP,EAAE,CAACe,YAAY,CACbb,uBA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