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","exports","_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"],"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,wBAAuB,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,kBACF,CAAC;MACD,IAAMC,mBAAmB,GAAGrB,yBAAyB,CAACc,IAAI,CAAC;MAC3DP,EAAE,CAACe,YAAY,CACbb,uBAAe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