How to use getLanguage method in Playwright Internal

Best JavaScript code snippet using playwright-internal

msg.js

Source:msg.js Github

copy

Full Screen

...16// TODO: store all this in a db17exports.missingRequestParameter = (req, param) => {18 const fun = 'missingRequestParameter'19 try {20 switch (getLanguage()) {21 case 'en':22 case 'en-GB':23 case 'en-US':24 return `The parameter '${param}' should define in url '${req.url}' `25 case 'fr':26 case 'fr-FR':27 case 'fr-BE':28 return `Le paramètre '${param}' devrait être défini dans l'url '${req.url}' `29 default:30 return `${DEFAULT_MSG}: ${getLanguage()}`31 }32 } catch (err) {33 log.e(mod, fun, err)34 throw err35 }36}37exports.parameterExpected = (fun, param) => {38 switch (getLanguage()) {39 case 'en':40 case 'en-GB':41 case 'en-US':42 return `The function '${fun}' should be called with a parameter of'${param}' `43 case 'fr':44 case 'fr-FR':45 case 'fr-BE':46 return `La fonction '${fun}' devrait être appelée avec le paramètre '${param}' `47 default:48 return `${DEFAULT_MSG}: ${getLanguage()}`49 }50}51exports.parameterTypeExpected = (fun, expected, obj) => {52 switch (getLanguage()) {53 case 'en':54 case 'en-GB':55 case 'en-US':56 return `The function '${fun}' should be called with a parameter of type '${expected}' (got typeof '${typeof obj}')`57 case 'fr':58 case 'fr-FR':59 case 'fr-BE':60 return `La fonction '${fun}' devrait être appelée avec un paramètre de type '${expected}' (reçu: '${typeof obj}')`61 default:62 return `${DEFAULT_MSG}: ${getLanguage()}`63 }64}65exports.subPropNeededWhenPropSet = (prop, subProp) => {66 switch (getLanguage()) {67 case 'en':68 case 'en-GB':69 case 'en-US':70 return `Subproperty '${prop}.${subProp}' is required when parent property '${prop}' is set`.replace(71 /\\"/g,72 `'`73 )74 case 'fr':75 case 'fr-FR':76 case 'fr-BE':77 return `La propriété '${prop}.${subProp}' est requise lorsque la propriété parente '${prop}' est renseignée`.replace(78 /\\"/g,79 `'`80 )81 default:82 return `${DEFAULT_MSG}: ${getLanguage()}`83 }84}85exports.subPropNeededWhenPropSetToEnum = (prop, subProp, enumProp, enumVal) => {86 switch (getLanguage()) {87 case 'en':88 case 'en-GB':89 case 'en-US':90 return (91 `Subproperty '${prop}.${subProp}' is required when property '${prop}.${enumProp}' ` +92 `is set to '${enumVal}'`.replace(/\\"/g, `'`)93 )94 case 'fr':95 case 'fr-FR':96 case 'fr-BE':97 return (98 `La propriété '${prop}.${subProp}' est requise lorsque la propriété '${prop}.${enumProp}'` +99 ` vaut '${enumVal}'`.replace(/\\"/g, `'`)100 )101 default:102 return `${DEFAULT_MSG}: ${getLanguage()}`103 }104}105exports.incorrectValueForEnum = (property, incorrectValue) => {106 switch (getLanguage()) {107 case 'en':108 case 'en-GB':109 case 'en-US':110 return `Incorrect value for property '${property}': '${incorrectValue}' `111 case 'fr':112 case 'fr-FR':113 case 'fr-BE':114 return `Valeur incorrecte pour la propriété '${property}' : '${incorrectValue}' `115 default:116 return `${DEFAULT_MSG}: ${getLanguage()}`117 }118}119exports.missingObjectProperty = (jsonObject, property) => {120 switch (getLanguage()) {121 case 'en':122 case 'en-GB':123 case 'en-US':124 return `The property '${property}' must be defined for object: ${utils.beautify(125 jsonObject126 )} `.replace(/\\"/g, `'`)127 case 'fr':128 case 'fr-FR':129 case 'fr-BE':130 return `La propriété '${property}' doit être définie pour l'object : ${utils.beautify(131 jsonObject132 )} `.replace(/\\"/g, `'`)133 default:134 return `${DEFAULT_MSG}: ${getLanguage()}`135 }136}137exports.parametersMismatch = (paramUrl, paramBody) => {138 switch (getLanguage()) {139 case 'en':140 case 'en-GB':141 case 'en-US':142 return (143 `Parameters should be the same between body and URL call!\n- URL parameter:` +144 ` '${paramUrl}'\n- body parameter: '${paramBody}' `145 )146 case 'fr':147 case 'fr-FR':148 case 'fr-BE':149 return (150 `Les paramètres doivent être identiques entre le corps de la requête et` +151 ` l'URL\n- URL : '${paramUrl}'\n- requête : '${paramBody}' `152 )153 default:154 return `${DEFAULT_MSG}: ${getLanguage()}`155 }156}157exports.missingField = (fieldName) => {158 switch (getLanguage()) {159 case 'en':160 case 'en-GB':161 case 'en-US':162 return `The field '${fieldName}' must be defined `163 case 'fr':164 case 'fr-FR':165 case 'fr-BE':166 return `La propriété '${fieldName}' est requise `167 default:168 return `${DEFAULT_MSG}: ${getLanguage()}`169 }170}171// ------------------------------------------------------------------------------------------------172// Generic173// ------------------------------------------------------------------------------------------------174exports.objectTypeNotFound = (objectType) => {175 switch (getLanguage()) {176 case 'en':177 case 'en-GB':178 case 'en-US':179 return `This object type is not recognized: '${objectType}' `180 case 'fr':181 case 'fr-FR':182 case 'fr-BE':183 return `Ce type d'objet n'est pas reconnu : '${objectType}' `184 default:185 return `${DEFAULT_MSG}: ${getLanguage()}`186 }187}188exports.objectNotFound = (objectType, objectId) => {189 switch (getLanguage()) {190 case 'en':191 case 'en-GB':192 case 'en-US':193 return `No object of type '${objectType}' was found with id'${objectId}' `194 case 'fr':195 case 'fr-FR':196 case 'fr-BE':197 return `Aucun objet de type '${objectType}' n'a été trouvé pour l'identifiant : ${objectId} `198 default:199 return `${DEFAULT_MSG}: ${getLanguage()}`200 }201}202exports.objectAlreadyExists = (objectType, id) => {203 switch (getLanguage()) {204 case 'en':205 case 'en-GB':206 case 'en-US':207 return `An object of type '${objectType}' already exists for id: ${id} `208 case 'fr':209 case 'fr-FR':210 case 'fr-BE':211 return `Un objet de type '${objectType}' existe déjà pour l'identifiant : ${id} `212 default:213 return `${DEFAULT_MSG}: ${getLanguage()}`214 }215}216exports.objectAdded = (objectType, id) => {217 switch (getLanguage()) {218 case 'en':219 case 'en-GB':220 case 'en-US':221 return `New object of type '${objectType}' added with id: ${id} `222 case 'fr':223 case 'fr-FR':224 case 'fr-BE':225 return `Objet de type '${objectType}' créé avec l'identifiant : ${id} `226 default:227 return `${DEFAULT_MSG}: ${getLanguage()}`228 }229}230exports.objectNotDeletedBecauseUsed = (objectType, id) => {231 switch (getLanguage()) {232 case 'en':233 case 'en-GB':234 case 'en-US':235 return `The object of type '${objectType}' couldn't be deleted. Its identifier is referenced in a metadata: ${id} `236 case 'fr':237 case 'fr-FR':238 case 'fr-BE':239 return `L'objet de type '${objectType}' n'a pas pu être supprimé. Son identifiant est référencé dans une métadonnée : ${id} `240 default:241 return `${DEFAULT_MSG}: ${getLanguage()}`242 }243}244// ------------------------------------------------------------------------------------------------245// Metadata246// ------------------------------------------------------------------------------------------------247exports.metadataAlreadyExists = (id) => {248 switch (getLanguage()) {249 case 'en':250 case 'en-GB':251 case 'en-US':252 return `A metadata already exists for id: ${id} `253 case 'fr':254 case 'fr-FR':255 case 'fr-BE':256 return `Une metadonnée existe déjà pour l'identifiant : ${id} `257 default:258 return `${DEFAULT_MSG}: ${getLanguage()}`259 }260}261exports.metadataAdded = (id) => {262 switch (getLanguage()) {263 case 'en':264 case 'en-GB':265 case 'en-US':266 return `New metadata added with id: ${id} `267 case 'fr':268 case 'fr-FR':269 case 'fr-BE':270 return `Metadonnée ajoutée avec l'identifiant : ${id} `271 default:272 return `${DEFAULT_MSG}: ${getLanguage()}`273 }274}275exports.metadataUpdated = (id) => {276 switch (getLanguage()) {277 case 'en':278 case 'en-GB':279 case 'en-US':280 return `Metadata updated for id: ${id} `281 case 'fr':282 case 'fr-FR':283 case 'fr-BE':284 return `Metadonée mise à jour pour l'identifiant : ${id} `285 default:286 return `${DEFAULT_MSG}: ${getLanguage()}`287 }288}289exports.metadataFound = (id) => {290 switch (getLanguage()) {291 case 'en':292 case 'en-GB':293 case 'en-US':294 return `A metadata was found with id: ${id} `295 case 'fr':296 case 'fr-FR':297 case 'fr-BE':298 return `Une metadonnée a été trouvée avec l'identifiant : ${id} `299 default:300 return `${DEFAULT_MSG}: ${getLanguage()}`301 }302}303exports.metadataNotFound = (id) => {304 switch (getLanguage()) {305 case 'en':306 case 'en-GB':307 case 'en-US':308 return `No metadata was found with id: ${id} `309 case 'fr':310 case 'fr-FR':311 case 'fr-BE':312 return `Aucune metadonnée trouvée avec l'identifiant : ${id} `313 default:314 return `${DEFAULT_MSG}: ${getLanguage()}`315 }316}317exports.metadataDeleted = (id) => {318 switch (getLanguage()) {319 case 'en':320 case 'en-GB':321 case 'en-US':322 return `Metadata deleted for id: ${id} `323 case 'fr':324 case 'fr-FR':325 case 'fr-BE':326 return `Métadonnée supprimée pour l'identifiant : ${id} `327 default:328 return `${DEFAULT_MSG}: ${getLanguage()}`329 }330}331exports.metadataDeletedWithCondition = (condition) => {332 switch (getLanguage()) {333 case 'en':334 case 'en-GB':335 case 'en-US':336 return `Metadata deleted for condition: '${condition}'`337 case 'fr':338 case 'fr-FR':339 case 'fr-BE':340 return `Métadonnées supprimées pour la condition : '${condition}'`341 default:342 return `${DEFAULT_MSG}: ${getLanguage()}`343 }344}345// ------------------------------------------------------------------------------------------------346// Thesaurus347// ------------------------------------------------------------------------------------------------348exports.incorrectVal = (field, val) => {349 switch (getLanguage()) {350 case 'en':351 case 'en-GB':352 case 'en-US':353 return `Incorrect value for '${field}': '${val}' `354 case 'fr':355 case 'fr-FR':356 case 'fr-BE':357 return `Valeur incorrecte pour le champ '${field}' : '${val}' `358 default:359 return `${DEFAULT_MSG}: ${getLanguage()}`360 }361}362// ------------------------------------------------------------------------------------------------363// Organization364// ------------------------------------------------------------------------------------------------365exports.organizationAdded = (id) => {366 switch (getLanguage()) {367 case 'en':368 case 'en-GB':369 case 'en-US':370 return `New organization added with id: ${id} `371 case 'fr':372 case 'fr-FR':373 case 'fr-BE':374 return `Organisation créée avec l'identifiant : ${id} `375 default:376 return `${DEFAULT_MSG}: ${getLanguage()}`377 }378}379exports.organizationAlreadyExists = (id) => {380 switch (getLanguage()) {381 case 'en':382 case 'en-GB':383 case 'en-US':384 return `An organization already exists for id: ${id} `385 case 'fr':386 case 'fr-FR':387 case 'fr-BE':388 return `Une organisation existe déjà pour l'identifiant : ${id} `389 default:390 return `${DEFAULT_MSG}: ${getLanguage()}`391 }392}393exports.organizationUpdated = (id) => {394 switch (getLanguage()) {395 case 'en':396 case 'en-GB':397 case 'en-US':398 return `Organization updated for id: ${id} `399 case 'fr':400 case 'fr-FR':401 case 'fr-BE':402 return `Organisation mise à jour pour l'identifiant : ${id} `403 default:404 return `${DEFAULT_MSG}: ${getLanguage()}`405 }406}407exports.organizationDeleted = (id) => {408 switch (getLanguage()) {409 case 'en':410 case 'en-GB':411 case 'en-US':412 return `Organization deleted for id: ${id} `413 case 'fr':414 case 'fr-FR':415 case 'fr-BE':416 return `Organisation supprimée pour l'identifiant : ${id} `417 default:418 return `${DEFAULT_MSG}: ${getLanguage()}`419 }420}421exports.organizationNotFound = (id) => {422 switch (getLanguage()) {423 case 'en':424 case 'en-GB':425 case 'en-US':426 return `No organization was found with id: ${id} `427 case 'fr':428 case 'fr-FR':429 case 'fr-BE':430 return `Aucune organisation trouvée avec l'identifiant : ${id} `431 default:432 return `${DEFAULT_MSG}: ${getLanguage()}`433 }434}435// ------------------------------------------------------------------------------------------------436// Contact437// ------------------------------------------------------------------------------------------------438exports.contactAdded = (id) => {439 switch (getLanguage()) {440 case 'en':441 case 'en-GB':442 case 'en-US':443 return `New contact added with id: ${id} `444 case 'fr':445 case 'fr-FR':446 case 'fr-BE':447 return `Contact créé avec l'identifiant : ${id} `448 default:449 return `${DEFAULT_MSG}: ${getLanguage()}`450 }451}452exports.contactAlreadyExists = (id) => {453 switch (getLanguage()) {454 case 'en':455 case 'en-GB':456 case 'en-US':457 return `A contact already exists for id: ${id} `458 case 'fr':459 case 'fr-FR':460 case 'fr-BE':461 return `Un contact existe déjà pour l'identifiant : ${id} `462 default:463 return `${DEFAULT_MSG}: ${getLanguage()}`464 }465}466exports.contactUpdated = (id) => {467 switch (getLanguage()) {468 case 'en':469 case 'en-GB':470 case 'en-US':471 return `Contact updated for id: ${id} `472 case 'fr':473 case 'fr-FR':474 case 'fr-BE':475 return `Contact mis à jour pour l'identifiant : ${id} `476 default:477 return `${DEFAULT_MSG}: ${getLanguage()}`478 }479}480exports.contactDeleted = (id) => {481 switch (getLanguage()) {482 case 'en':483 case 'en-GB':484 case 'en-US':485 return `Contact deleted for id: ${id} `486 case 'fr':487 case 'fr-FR':488 case 'fr-BE':489 return `Contact supprimé pour l'identifiant : ${id} `490 default:491 return `${DEFAULT_MSG}: ${getLanguage()}`492 }493}494exports.contactNotFound = (id) => {495 switch (getLanguage()) {496 case 'en':497 case 'en-GB':498 case 'en-US':499 return `No contact was found with id: ${id} `500 case 'fr':501 case 'fr-FR':502 case 'fr-BE':503 return `Aucun contact trouvé avec l'identifiant : ${id} `504 default:505 return `${DEFAULT_MSG}: ${getLanguage()}`506 }507}508// ------------------------------------------------------------------------------------------------509// Report510// ------------------------------------------------------------------------------------------------511exports.reportAdded = (id) => {512 switch (getLanguage()) {513 case 'en':514 case 'en-GB':515 case 'en-US':516 return `New report added with id: ${id} `517 case 'fr':518 case 'fr-FR':519 case 'fr-BE':520 return `Rapport créé avec l'identifiant : ${id} `521 default:522 return `${DEFAULT_MSG}: ${getLanguage()}`523 }524}525exports.reportAlreadyExists = (id) => {526 switch (getLanguage()) {527 case 'en':528 case 'en-GB':529 case 'en-US':530 return `A report already exists for id: ${id} `531 case 'fr':532 case 'fr-FR':533 case 'fr-BE':534 return `Un rapport existe déjà pour l'identifiant : ${id} `535 default:536 return `${DEFAULT_MSG}: ${getLanguage()}`537 }538}539exports.reportUpdated = (id) => {540 switch (getLanguage()) {541 case 'en':542 case 'en-GB':543 case 'en-US':544 return `Report updated for id: ${id} `545 case 'fr':546 case 'fr-FR':547 case 'fr-BE':548 return `Rapport mis à jour pour l'identifiant : ${id} `549 default:550 return `${DEFAULT_MSG}: ${getLanguage()}`551 }552}553exports.reportDeleted = (id) => {554 switch (getLanguage()) {555 case 'en':556 case 'en-GB':557 case 'en-US':558 return `Report deleted for id: ${id} `559 case 'fr':560 case 'fr-FR':561 case 'fr-BE':562 return `Rapport supprimé pour l'identifiant : ${id} `563 default:564 return `${DEFAULT_MSG}: ${getLanguage()}`565 }566}567exports.reportNotFound = (id) => {568 switch (getLanguage()) {569 case 'en':570 case 'en-GB':571 case 'en-US':572 return `No report was found with id: ${id} `573 case 'fr':574 case 'fr-FR':575 case 'fr-BE':576 return `Aucun rapport trouvé avec l'identifiant : ${id} `577 default:578 return `${DEFAULT_MSG}: ${getLanguage()}`579 }580}581exports.reportMismatch = (reportId, urlObjectId, reportObjectId) => {582 switch (getLanguage()) {583 case 'en':584 case 'en-GB':585 case 'en-US':586 return `Resource identifier doesn't match the URL call for report ${reportId} \nURL resource id: ${urlObjectId} != report.resource_id: ${reportObjectId} `587 case 'fr':588 case 'fr-FR':589 case 'fr-BE':590 return `L'identifiant de la resource associée est incohérente avec celle utilisée dans l'URL pour le rapport ${reportId}\nURL id: ${urlObjectId} != report.resource_id: ${reportObjectId} `591 default:592 return `${DEFAULT_MSG}: ${getLanguage()}`593 }...

Full Screen

Full Screen

snippet.js

Source:snippet.js Github

copy

Full Screen

...3 CSS: {4 common: {5 RESET: {6 label: 'reset',7 getDesc: () => getLanguage().RESET,8 path: './css/common/reset.css'9 }10 }11 },12 JavaScript: {13 date: {14 GET_CURRENT_MONTH_FIRST: {15 label: 'getCurrentMonth_first',16 getDesc: () => getLanguage().GET_CURRENT_MONTH_FIRST,17 path: './JavaScript/date/getCurrentMonth_first.js'18 },19 GET_CURRENT_MONTH_LAST: {20 label: 'getCurrentMonth_last',21 getDesc: () => getLanguage().GET_CURRENT_MONTH_LAST,22 path: './JavaScript/date/getCurrentMonth_last.js'23 },24 GET_CURRENT_WEEK_FIRST: {25 label: 'getCurrent_week_first',26 getDesc: () => getLanguage().GET_CURRENT_WEEK_FIRST,27 path: './JavaScript/date/getCurrentWeek_first.js'28 },29 GET_CURRENT_WEEK_LAST: {30 label: 'getCurrentWeek_last',31 getDesc: () => getLanguage().GET_CURRENT_WEEK_LAST,32 path: './JavaScript/date/getCurrentWeek_last.js'33 },34 GET_LAST_WEEK_FIRST: {35 label: 'getLastWeek_first',36 getDesc: () => getLanguage().GET_LAST_WEEK_FIRST,37 path: './JavaScript/date/getLastWeek_first.js'38 },39 GET_LAST_WEEK_LAST: {40 label: 'getLastWeek_last',41 getDesc: () => getLanguage().GET_LAST_WEEK_LAST,42 path: './JavaScript/date/getLastWeek_last.js'43 },44 GET_NEXT_MONTH_FIRST: {45 label: 'getNextMonth_first',46 getDesc: () => getLanguage().GET_NEXT_MONTH_FIRST,47 path: './JavaScript/date/getNextMonth_first.js'48 },49 GET_NEXT_MONTH_LAST: {50 label: 'getNextMonth_last',51 getDesc: () => getLanguage().GET_NEXT_MONTH_LAST,52 path: './JavaScript/date/getNextMonth_last.js'53 },54 GET_PREV_MONTH_FIRST: {55 label: 'getPrevMonth_first',56 getDesc: () => getLanguage().GET_PREV_MONTH_FIRST,57 path: './JavaScript/date/getPrevMonth_first.js'58 },59 GET_PREV_MONTH_LAST: {60 label: 'getPrevMonth_last',61 getDesc: () => getLanguage().GET_PREV_MONTH_LAST,62 path: './JavaScript/date/getPrevMonth_last.js'63 },64 TO_DATE: {65 label: 'toDate',66 getDesc: () => getLanguage().TO_DATE,67 path: './JavaScript/date/toDate.js'68 },69 TO_TIMESTAMP: {70 label: 'toTimestamp',71 getDesc: () => getLanguage().TO_TIMESTAMP,72 path: './JavaScript/date/toTimestamp.js'73 }74 },75 type: {76 EXTEND: {77 label: 'extend',78 getDesc: () => getLanguage().EXTEND,79 path: './JavaScript/type/extend.js'80 },81 HAS_OWN: {82 label: 'hasOwn',83 getDesc: () => getLanguage().HAS_OWN,84 path: './JavaScript/type/hasOwn.js'85 },86 IS_DEF: {87 label: 'isDef',88 getDesc: () => getLanguage().IS_DEF,89 path: './JavaScript/type/isDef.js'90 },91 IS_UNDEF: {92 label: 'isUndef',93 getDesc: () => getLanguage().IS_UNDEF,94 path: './JavaScript/type/isUndef.js'95 },96 IS_FALSE: {97 label: 'isFalse',98 getDesc: () => getLanguage().IS_FALSE,99 path: './JavaScript/type/isFalse.js'100 },101 IS_TRUE: {102 label: 'isTrue',103 getDesc: () => getLanguage().IS_TRUE,104 path: './JavaScript/type/isTrue.js'105 },106 IS_OBJECT: {107 label: 'isObject',108 getDesc: () => getLanguage().IS_OBJECT,109 path: './JavaScript/type/isObject.js'110 },111 IS_PLAIN_OBJECT:{112 label: 'isPlainObject',113 getDesc: () => getLanguage().IS_PLAIN_OBJECT,114 path: './JavaScript/type/isPlainObject.js'115 },116 IS_PRIMITIVE: {117 label: 'isPrimitive',118 getDesc: () => getLanguage().IS_PRIMITIVE,119 path: './JavaScript/type/isPrimitive.js'120 },121 IS_PROMISE: {122 label: 'isPromise',123 getDesc: () => getLanguage().IS_PROMISE,124 path: './JavaScript/type/isPromise.js'125 },126 IS_REGEXP: {127 label: 'isRegExp',128 getDesc: () => getLanguage().IS_REGEXP,129 path: './JavaScript/type/isRegExp.js'130 },131 TO_ARRAY: {132 label: 'toArray',133 getDesc: () => getLanguage().TO_ARRAY,134 path: './JavaScript/type/toArray.js'135 },136 TO_NUMBER: {137 label: 'toNumber',138 getDesc: () => getLanguage().TO_NUMBER,139 path: './JavaScript/type/toNumber.js'140 },141 TO_OBJECT: {142 label: 'toObject',143 getDesc: () => getLanguage().TO_OBJECT,144 path: './JavaScript/type/toObject.js'145 },146 TO_STRING: {147 label: 'toString',148 getDesc: () => getLanguage().TO_STRING,149 path: './JavaScript/type/toString.js'150 },151 TO_RAW_TYPE: {152 label: 'toRawType',153 getDesc: () => getLanguage().TO_RAW_TYPE,154 path: './JavaScript/type/toRawType.js'155 }156 },157 utils: {158 CREATE_UNIQUE_STRING: {159 label: 'createUniqueString',160 getDesc: () => getLanguage().CREATE_UNIQUE_STRING,161 path: './JavaScript/utils/createUniqueString.js'162 },163 ENCODE_PWD: {164 label: 'encodePwd',165 getDesc: () => getLanguage().ENCODE_PWD,166 path: './JavaScript/utils/encodePwd.js'167 },168 ERROR_CAPTURED: {169 label: 'errorCaptured',170 getDesc: () => getLanguage().ERROR_CAPTURED,171 path: './JavaScript/utils/errorCaptured.js'172 },173 GET_SEARCH: {174 label: 'getSearch',175 getDesc: () => getLanguage().GET_SEARCH,176 path: './JavaScript/utils/getSearch.js'177 },178 ONCE: {179 label: 'once',180 getDesc: () => getLanguage().ONCE,181 path: './JavaScript/utils/once.js'182 },183 OPTION_SORT: {184 label: 'optionSort',185 getDesc: () => getLanguage().OPTION_SORT,186 path: './JavaScript/utils/optionSort.js'187 }188 },189 validate: {190 VALI_EMAIL: {191 label: 'valiEmail',192 getDesc: () => getLanguage().VALI_EMAIL,193 path: './JavaScript/validate/email.js'194 },195 VALI_PHONE: {196 label: 'valiPhone',197 getDesc: () => getLanguage().VALI_PHONE,198 path: './JavaScript/validate/phone.js'199 }200 }201 }...

Full Screen

Full Screen

language.js

Source:language.js Github

copy

Full Screen

...40const navNotLogged = () => {41 let element;42 element = document.querySelector('#navNotLogged > li:nth-child(1) > a');43 if (element) {44 element.innerHTML = getLanguage().NAV_NOT_LOGGED_HOME;45 }46 element = document.querySelector('#navNotLogged > li:nth-child(2) > a');47 if (element) {48 element.innerHTML = getLanguage().NAV_NOT_LOGGED_LOGIN;49 }50 element = document.querySelector('#navNotLogged > li:nth-child(3) > a');51 if (element) {52 element.innerHTML = getLanguage().NAV_NOT_LOGGED_REGISTER;53 }54}55const footer = () => {56 let element;57 element = document.querySelector('footer > div');58 if (element) {59 element.innerHTML = getLanguage().FOOTER;60 }61}62const toTop = () => {63 let element;64 element = document.querySelector('.btn-to-top');65 if (element) {66 element.innerHTML = getLanguage().GO_TO_TOP;67 }68}69const home = () => {70 let element;71 element = document.querySelector('#pageHome > h1');72 if (element) {73 element.innerHTML = getLanguage().HOME_TITLE;74 }75 element = document.querySelector('#pageHome > p');76 if (element) {77 element.innerHTML = getLanguage().HOME_DESCRIPTION;78 }79}80const login = () => {81 let element;82 element = document.querySelector('#pageLogin > h1');83 if (element) {84 element.innerHTML = getLanguage().LOGIN_TITLE;85 }86 element = document.querySelector('#pageLogin > form > div:nth-child(1) > label');87 if (element) {88 element.innerHTML = getLanguage().LOGIN_EMAIL;89 }90 element = document.querySelector('#pageLogin > form > div:nth-child(2) > label');91 if (element) {92 element.innerHTML = getLanguage().LOGIN_PASSWORD;93 }94 element = document.querySelector('#pageLogin > form > div:nth-child(3) > label');95 if (element) {96 element.innerHTML = getLanguage().LOGIN_CHECK;97 }98 element = document.querySelector('#pageLogin button');99 if (element) {100 element.innerHTML = getLanguage().LOGIN_BUTTON;101 }102 element = document.querySelector('#pageLogin p');103 if (element) {104 element.innerHTML = getLanguage().LOGIN_P;105 }106 element = document.querySelector('#pageLogin a');107 if (element) {108 element.innerHTML = getLanguage().LOGIN_A;109 }110}111const register = () => {112 let element;113 element = document.querySelector('#pageRegister h1');114 if (element) {115 element.innerHTML = getLanguage().REGISTER_TITLE;116 }117 element = document.querySelector('#pageRegister > p');118 if (element) {119 element.innerHTML = getLanguage().REGISTER_DESCRIPTION;120 }121 element = document.querySelector('#pageRegister > form > div:nth-child(1) > label');122 if (element) {123 element.innerHTML = getLanguage().REGISTER_NAME;124 }125 element = document.querySelector('#pageRegister > form > div:nth-child(2) > label');126 if (element) {127 element.innerHTML = getLanguage().REGISTER_EMAIL;128 }129 element = document.querySelector('#pageRegister > form > div:nth-child(3) > label');130 if (element) {131 element.innerHTML = getLanguage().REGISTER_PASSWORD;132 }133 element = document.querySelector('#pageRegister > form > div:nth-child(4) > label');134 if (element) {135 element.innerHTML = getLanguage().REGISTER_CONFIRM_PASSWORD;136 }137 element = document.querySelector('#pageRegister > form h4:nth-child(5)');138 if (element) {139 element.innerHTML = getLanguage().REGISTER_STYLE_NINJA_TITLE;140 }141 element = document.querySelector('#pageRegister > form p:nth-child(6)');142 if (element) {143 element.innerHTML = getLanguage().REGISTER_STYLE_NINJA_DESCRIPTION;144 }145 element = document.querySelector('#pageRegister > form h4:nth-child(8)');146 if (element) {147 element.innerHTML = getLanguage().REGISTER_CHARACTER_TITLE;148 }149 element = document.querySelector('#pageRegister > form p:nth-child(9)');150 if (element) {151 element.innerHTML = getLanguage().REGISTER_CHARACTER_DESCRIPTION;152 }153 element = document.querySelector('#pageRegister > form h4:nth-child(11)');154 if (element) {155 element.innerHTML = getLanguage().REGISTER_VILLAGE_TITLE;156 }157 element = document.querySelector('#pageRegister > form p:nth-child(12)');158 if (element) {159 element.innerHTML = getLanguage().REGISTER_VILLAGE_DESCRIPTION;160 }161 element = document.querySelector('#pageRegister button[type="submit"]');162 if (element) {163 element.innerHTML = getLanguage().REGISTER_BUTTON;164 }...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import { useRef, useState } from 'react';2import {3 IconButton, Box,4 List,5 ListItem,6 Divider,7 Typography,8 ListItemText, Popover, Tooltip9} from '@mui/material';10import { styled } from '@mui/material/styles';11import Text from 'src/components/Text';12import WarningTwoToneIcon from '@mui/icons-material/WarningTwoTone';13import internationalization from 'src/i18n/i18n';14import { useTranslation } from 'react-i18next';15import deFlag from 'country-flag-icons/3x2/DE.svg';16import usFlag from 'country-flag-icons/3x2/US.svg';17import esFlag from 'country-flag-icons/3x2/ES.svg';18import frFlag from 'country-flag-icons/3x2/FR.svg';19import cnFlag from 'country-flag-icons/3x2/CN.svg';20import aeFlag from 'country-flag-icons/3x2/AE.svg';21const SectionHeading = styled(Typography)(22 ({ theme }) => `23 font-weight: ${theme.typography.fontWeightBold};24 color: ${theme.palette.secondary.main};25 display: block;26 padding: ${theme.spacing(2, 2, 0)};27`28);29const ImageWrapper = styled('img')(30 () => `31 width: 30px;32 margin: 3px;33`34);35const IconButtonWrapper = styled(IconButton)(36 ({ theme }) => `37 width: ${theme.spacing(7)};38 height: ${theme.spacing(7)};39`40);41function LanguageSwitcher() {42 const { i18n } = useTranslation();43 const { t } = useTranslation();44 const getLanguage = i18n.language;45 const switchLanguage = ({ lng }) => {46 internationalization.changeLanguage(lng);47 };48 const ref = useRef(null);49 const [isOpen, setOpen] = useState(false);50 const handleOpen = () => {51 setOpen(true);52 };53 const handleClose = () => {54 setOpen(false);55 };56 return (57 <>58 <Tooltip arrow title={t('Language Switcher')}>59 <IconButtonWrapper color="primary" ref={ref} onClick={handleOpen}>60 {getLanguage === 'de' && <ImageWrapper alt="German" src={deFlag} />}61 {getLanguage === 'en' && <ImageWrapper alt="English" src={usFlag} />}62 {getLanguage === 'en-US' && <ImageWrapper alt="English" src={usFlag} />}63 {getLanguage === 'es' && <ImageWrapper alt="Spanish" src={esFlag} />}64 {getLanguage === 'fr' && <ImageWrapper alt="French" src={frFlag} />}65 {getLanguage === 'cn' && <ImageWrapper alt="Chinese" src={cnFlag} />}66 {getLanguage === 'ae' && <ImageWrapper alt="Arabic" src={aeFlag} />}67 </IconButtonWrapper>68 </Tooltip>69 <Popover70 anchorEl={ref.current}71 onClose={handleClose}72 open={isOpen}73 anchorOrigin={{74 vertical: 'top',75 horizontal: 'right'76 }}77 transformOrigin={{78 vertical: 'top',79 horizontal: 'right'80 }}81 >82 <Box sx={{ maxWidth: 240 }}>83 <SectionHeading variant="body2" color="text.primary">84 {t('Language Switcher')}85 </SectionHeading>86 <List sx={{ p: 2 }} component="nav">87 <ListItem88 className={getLanguage === 'en' || getLanguage === 'en-US' ? 'active' : ''}89 button90 onClick={() => { switchLanguage({ lng: 'en' }); handleClose() }}91 >92 <ImageWrapper alt="English" src={usFlag} />93 <ListItemText sx={{ pl: 1 }} primary="English" />94 </ListItem>95 <ListItem96 className={getLanguage === 'de' ? 'active' : ''}97 button98 onClick={() => { switchLanguage({ lng: 'de' }); handleClose() }}99 >100 <ImageWrapper alt="German" src={deFlag} />101 <ListItemText sx={{ pl: 1 }} primary="German" />102 </ListItem>103 <ListItem104 className={getLanguage === 'es' ? 'active' : ''}105 button106 onClick={() => { switchLanguage({ lng: 'es' }); handleClose() }}107 >108 <ImageWrapper alt="Spanish" src={esFlag} />109 <ListItemText sx={{ pl: 1 }} primary="Spanish" />110 </ListItem>111 <ListItem112 className={getLanguage === 'fr' ? 'active' : ''}113 button114 onClick={() => { switchLanguage({ lng: 'fr' }); handleClose() }}115 >116 <ImageWrapper alt="French" src={frFlag} />117 <ListItemText sx={{ pl: 1 }} primary="French" />118 </ListItem>119 <ListItem120 className={getLanguage === 'cn' ? 'active' : ''}121 button122 onClick={() => { switchLanguage({ lng: 'cn' }); handleClose() }}123 >124 <ImageWrapper alt="Chinese" src={cnFlag} />125 <ListItemText sx={{ pl: 1 }} primary="Chinese" />126 </ListItem>127 <ListItem128 className={getLanguage === 'ae' ? 'active' : ''}129 button130 onClick={() => { switchLanguage({ lng: 'ae' }); handleClose() }}131 >132 <ImageWrapper alt="Arabic" src={aeFlag} />133 <ListItemText sx={{ pl: 1 }} primary="Arabic" />134 </ListItem>135 </List>136 <Divider />137 <Text color="warning">138 <Box p={2} sx={{ maxWidth: 340 }}>139 <WarningTwoToneIcon fontSize="small" />140 <Typography variant="body1">141 {t(142 'We only translated a small part of the template, for demonstration purposes'143 )}144 !145 </Typography>146 </Box>147 </Text>148 </Box>149 </Popover>150 </>151 );152};...

Full Screen

Full Screen

Values.js

Source:Values.js Github

copy

Full Screen

...11 <div className="Values pt-5 pb-5">12 <Container>13 <Row>14 <Col lg={12} className="mb-3">15 <h1 className={getLanguage()==='ar'?'GE_SS text-center':' times text-center'}>{t('values.title')}</h1>16 </Col>17 <Col lg={12}>18 <ul className="mb-0 mt-5 list-unstyled ">19 <li className="mb-4">20 <Row>21 <Col lg={2} xs={3}><h2 >A</h2></Col>22 <Col lg={10} xs={9} className={getLanguage()==='ar'?'GE_SS':' lota'}>23 <p className={(getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left') + ' square_title'}>{t('values.h2_1')}</p>24 <p className={getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left'}>25 {t('values.p_1')}26 </p>27 </Col>28 </Row>29 </li>30 <li className="mb-4">31 <Row>32 <Col lg={2} xs={3}><h2 >M</h2></Col>33 <Col lg={10} xs={9} className={getLanguage()==='ar'?'GE_SS':' lota'}>34 <p className={(getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left') + ' square_title'}>{t('values.h2_2')}</p>35 <p className={getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left'}>36 {t('values.p_2')}37 </p>38 </Col>39 </Row> 40 </li>41 <li className="mb-4">42 <Row>43 <Col lg={2} xs={3}><h2 >K</h2></Col>44 <Col lg={10} xs={9} className={getLanguage()==='ar'?'GE_SS':' lota'}>45 <p className={(getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left') + ' square_title'}>{t('values.h2_3')}</p>46 <p className={getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left'}>47 {t('values.p_3')}48 </p>49 </Col>50 </Row> 51 </li>52 <li className="mb-4">53 <Row>54 <Col lg={2} xs={3}><h2 >A</h2></Col>55 <Col lg={10} xs={9} className={getLanguage()==='ar'?'GE_SS':' lota'}>56 <p className={(getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left') + ' square_title'}>{t('values.h2_4')}</p>57 <p className={getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left'}>58 {t('values.p_4')}59 </p>60 </Col>61 </Row> 62 </li>63 <li className="mb-4">64 <Row>65 <Col lg={2} xs={3}><h2 >N</h2></Col>66 <Col lg={10} xs={9} className={getLanguage()==='ar'?'GE_SS':' lota'}>67 <p className={(getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left') + ' square_title'}>{t('values.h2_5')}</p>68 <p className={getLanguage()==='he' || getLanguage()==='ar'?'text-right':'text-left'}>69 {t('values.p_5')}70 </p>71 </Col>72 </Row> 73 </li>74 </ul>75 </Col>76 </Row>77 </Container>78 </div>79 );80 }81}82Values.propTypes = {...

Full Screen

Full Screen

Zip.js

Source:Zip.js Github

copy

Full Screen

...7 * Function getLanguage8 */9describe('getLanguage', () => {10 it('should return the extention', () => {11 expect(getLanguage('index.md')).toBe('markdown')12 expect(getLanguage('index.spec.md')).toBe('markdown')13 expect(getLanguage('index.js')).toBe('javascript')14 expect(getLanguage('index.kt')).toBe('kotlin')15 expect(getLanguage('index.kts')).toBe('kotlin')16 expect(getLanguage('index.gradle')).toBe('groovy')17 expect(getLanguage('index.gitignore')).toBe('git')18 expect(getLanguage('index.java')).toBe('java')19 expect(getLanguage('index.xml')).toBe('xml')20 expect(getLanguage('index.properties')).toBe('properties')21 expect(getLanguage('index.groovy')).toBe('groovy')22 })23 it('should not return the extention', () => {24 expect(getLanguage('index.php')).toBe(null)25 expect(getLanguage('index.html')).toBe(null)26 expect(getLanguage('index.css')).toBe(null)27 expect(getLanguage('index.scss')).toBe(null)28 expect(getLanguage('mvnw')).toBe(null)29 expect(getLanguage('command.cmd')).toBe(null)30 })31})32/**33 * Function getLanguage34 */35describe('createTree', () => {36 // eslint-disable-next-line37 it('should create a tree', async done => {38 const zipJs = new JSZip()39 await fs.readFile(path.resolve('./dev/starter.mock.zip'), async (err, blob) => {40 const { files } = await zipJs.loadAsync(blob).catch(() => {41 throw Error(`Could not load the ZIP project.`)42 })43 const pathZ = `${findRoot({ files })}/`...

Full Screen

Full Screen

get-language.test.js

Source:get-language.test.js Github

copy

Full Screen

...4import getLanguage from '../src/get-language';5import languageMap from '../src/helpers/language-map';6test('Handles languages correctly', t => {7 // Some manual ones ¯\_(ツ)_/¯8 t.is(getLanguage('.htaccess'), 'text/apache');9 t.is(getLanguage('foo.C'), 'text/x-c++src');10 t.is(getLanguage('foo.hello'), 'auto');11 t.is(getLanguage('123.hi.yaml'), 'yaml');12 t.is(getLanguage('foo.yml'), 'yaml');13 t.is(getLanguage('-whut-'), 'auto');14 t.is(getLanguage('index.html'), 'htmlmixed');15 t.is(getLanguage('main.r'), 'r');16 t.is(getLanguage('install.sh'), 'application/x-sh');17 t.is(getLanguage('main.foo.rs'), 'rust');18 // All 😎19 for (const [extension, language] of languageMap) {20 t.is(getLanguage(`foo.${extension}`), language);21 }...

Full Screen

Full Screen

FileUtils.test.js

Source:FileUtils.test.js Github

copy

Full Screen

1import { getLanguage } from './FileUtils';2describe('FileUtils', () => {3 test('getLanguage', () => {4 expect(getLanguage('foo.js')).toBe('js');5 expect(getLanguage('foo.bar.js')).toBe('js');6 expect(getLanguage('foo/bar.js')).toBe('js');7 expect(getLanguage('foo')).toBe('foo');8 expect(getLanguage('MLmodel')).toBe('yaml');9 expect(getLanguage('MLproject')).toBe('yaml');10 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const language = await page.evaluate(() => {7 return window.playwright.getLanguage();8 });9 console.log(language);10 await browser.close();11})();12#### playwright.executablePath()13#### playwright.selectors.register(name, script[, options])14#### playwright.selectors.unregister(name)15#### playwright._defaultArgs(options)

Full Screen

Using AI Code Generation

copy

Full Screen

1(async () => {2 const browser = await chromium.launch();3 const context = await browser.newContext();4 const page = await context.newPage();5 const language = await page.evaluate(() => {6 return window.__playwright__internal__getLanguage();7 });8 console.log(language);9 await browser.close();10})();11#### playwright.launch([options])

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright');2const { getLanguage } = require('playwright/lib/server/chromium/crPage');3(async () => {4 const browser = await playwright.chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const language = await getLanguage(page);8 console.log(language);9 await browser.close();10})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Playwright } = require('playwright-core');2const playwright = new Playwright();3(async () => {4 const browser = await playwright.chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const language = await page.evaluate(() => {8 return window.playwright.getLanguage();9 });10 console.log(language);11 await browser.close();12})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { getLanguage } = require('@playwright/test');2const { chromium } = require('playwright');3const { expect } = require('chai');4(async () => {5 const browser = await chromium.launch();6 const context = await browser.newContext({7 });8 const page = await context.newPage();9 const lang = await getLanguage(page);10 expect(lang).to.equal('en-US');11 await browser.close();12})();13const { chromium } = require('playwright');14const { expect } = require('chai');15(async () => {16 const browser = await chromium.launch();17 const context = await browser.newContext();18 const page = await context.newPage();19 const [response] = await Promise.all([20 page.waitForEvent('response'),21 page.click('text=English'),22 ]);23 await browser.close();24})();25const { chromium } = require('playwright');26const { expect } = require('chai');27(async () => {28 const browser = await chromium.launch();29 const context = await browser.newContext();30 const page = await context.newPage();31 const [request] = await Promise.all([32 page.waitForRequest('**/w/api.php'),33 page.click('text=English'),34 ]);35 expect(request.url()).to.equal(

Full Screen

Using AI Code Generation

copy

Full Screen

1const { PlaywrightInternal } = require('playwright/lib/server/playwright.js');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const language = await PlaywrightInternal.getLanguage(browser);6 console.log(language);7 await browser.close();8})();9const { PlaywrightInternal } = require('playwright/lib/server/playwright.js');10const { chromium } = require('playwright');11(async () => {12 const browser = await chromium.launch();13 const language = await PlaywrightInternal.getLanguage(browser);14 console.log(language);15 await browser.close();16})();17[MIT](./LICENSE)

Full Screen

Using AI Code Generation

copy

Full Screen

1const { getLanguage } = require('playwright/lib/server/server');2(async () => {3 const language = await getLanguage();4 console.log(language);5})();6[Apache-2.0](LICENSE)

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful