Best JavaScript code snippet using playwright-internal
konto.js
Source:konto.js
...488 }489 }490 );491 // -- Schematy Dla Edytora:492 addScheme("pacKonto", "Moje Konto", [493 {n: "imie", l: "ImiÄ", t: "text"},494 {n: "nazwisko", l: "Nazwisko", t: "text"},495 {n: "haslo", l: "HasÅo", t: "password"},496 {n: "data_uro", l: "Data urodzenia", t: "date"},497 {n: "pesel", l: "Pesel", t: "text"},498 {n: "telefon", l: "Telefon", t: "text"},499 {n: "email", l: "E-Mail", t: "text"},500 {n: "miasto", l: "Miasto", t: "text"},501 {n: "ulica", l: "Ulica", t: "text"},502 {n: "nr_domu", l: "Numer domu", t: "text"},503 {n: "nr_lokalu", l: "Numer lokalu / mieszkania", t: "text"},504 {n: "kod_poczt", l: "Kod pocztowy", t: "text"}505 ],506 [507 {val: "UsuÅ Konto", evt: (e) => { delAccount(0,e); }}508 ] 509 );510 // -- Panels:511 addPanel("Strona Glowna", "n/a", P_HOMEPAGE);512 addPanel("Moje Konto", "pacKonto", P_EDIT);513 addPanel("Wizyty", "pacWizyty", P_SEARCH);514 addPanel("Recepty", "pacRecepty", P_SEARCH);515 addPanel("Wyloguj", "n/a", P_LOGOUT);516}517518// ---------------------------------------------------------------519// -- Tworzenie Dashboarda dla: Lekarza520// ---------------------------------------------------------------521522const initLekarz = function ()523{524 addScheme("lekKonto", "Moje Konto", [525 {n: "imie", l: "ImiÄ", t: "text"},526 {n: "nazwisko", l: "Nazwisko", t: "text"},527 {n: "haslo", l: "HasÅo", t: "password"},528 {n: "data_uro", l: "Data urodzenia", t: "date"},529 {n: "pesel", l: "Pesel", t: "text"},530 {n: "telefon", l: "Telefon", t: "text"},531 {n: "email", l: "E-Mail", t: "text"},532 {n: "miasto", l: "Miasto", t: "text"},533 {n: "ulica", l: "Ulica", t: "text"},534 {n: "nr_domu", l: "Numer domu", t: "text"},535 {n: "nr_lokalu", l: "Numer lokalu / mieszkania", t: "text"},536 {n: "kod_poczt", l: "Kod pocztowy", t: "text"}537 ]);538 addScheme("lekEdycjaWizyty", "Edytuj wizytÄ", [539 {n: "Data", l: "Data Wizyty", t: "datetime-local"}, 540 {n: "Zalecenia", l: "Zalecenia", t: "text"},541 {n: "NowyStatus", l: "Status wizyty", t: "select", opt: ["Odbyta", "Zaplanowana", "OdwoÅana", "Przeniesiona"]}542 ], [543 {val: "Dodaj Recepte", evt: (p_id) => {544 // alert("TO-DO: Dodaj, dodawanie recept!");545 hideAllPanelsExcept(P_EDIT);546 invokeEditor("dodajRecepte", p_id);547 }},548 {val: "Odwolaj", evt: (p_id) => {549 dbReq((e) => {550 if (e.success)551 alert("Odwolano Wizyte!");552 else553 alert("Server nie odpowiada!");554 }, "odwolajWizyte", ["nrwiz", p_id]);555 }} 556 ]); 557 addResult("lekWizyty", "szukajWizyty",558 [559 {n: "Numer", s: 70},560 {n: "Pacjent", s: 70},561 {n: "Imie", s: 120},562 {n: "Nazwisko", s: 120},563 {n: "Data", s: 180},564 {n: "Opis", s: 350},565 {n: "Status", s: 130}566 ],567 {568 name: "Edytuj",569 action: (e) =>570 {571 const nrWiz = uncomplexResult(e.target)[0];572 hideAllPanelsExcept(P_EDIT);573 invokeEditor("lekEdycjaWizyty", nrWiz);574 }575 }576 ); 577 addResult("lekPacjenci", "szukajPacjentow",578 [579 {n: "Numer", s: 70},580 {n: "Imie", s: 120},581 {n: "Nazwisko", s: 120},582 {n: "Data Urodzenia", s: 180},583 {n: "Ostatnia Wizyta", s: 180}, 584 ],585 {586 name: "Wiecej",587 action: (e) =>588 {589 const items = uncomplexResult(e.target);590 window.location.href = `./informator?imie=${items[1]}&nazwisko=${items[2]}&rodzaj=Pacjent`;591 }592 }593 );594 addResult("recLekarze", "szukajRecept",595 [596 {n: "Numer", s: 70},597 {n: "Wizyta", s: 70},598 {n: "Lek / Leki", s: 200},599 {n: "Zalecenia", s: 200}, 600 {n: "Imie", s: 120},601 {n: "Nazwisko", s: 120},602 {n: "Data Waznosci", s: 180}, 603 ],604 {605 name: "Edytuj",606 action: (e) =>607 {608 // -- rasie editor609 const rec = uncomplexResult(e.target)[0];610 hideAllPanelsExcept(P_EDIT);611 invokeEditor('edRecepta', rec);612 }613 }614 );615 addScheme("dodajRecepte", "Dodaj Recepte Do Wizyty", [616 {n: "poczatek", l: "Ważna od", t: "date"},617 {n: "waznosc", l: "Ważna do", t: "date"},618 {n: "zalecenia", l: "Zalecenia / Dawkowanie", t: "text"}619 ], [/* Bez Dodatkowych Przycisków */], (e) => {620 window.location.href = './apteka';621 });622623 addScheme624 (625 "edRecepta", "Edytowanie Recepty",626 [627 {n: "wazn", l: "Ważna do", t: "date"},628 {n: "opis", l: "Zalecenia / Dawkowanie", t: "text"},629 ],
...
filterscheme.js
Source:filterscheme.js
1'use strict';2Object.defineProperty(exports, "__esModule", {3 value: true4});5exports.url = undefined;6exports.doProxy = doProxy;7exports.IsEnterSchemeitem = IsEnterSchemeitem;8exports.AddScheme = AddScheme;9exports.IsDefault = IsDefault;10exports.Isedit = Isedit;11exports.openQuerylist = openQuerylist;12exports.chooseScheme = chooseScheme;13exports.getQueryItem = getQueryItem;14exports.getSchemeListData = getSchemeListData;15exports.refreshConditionListValue = refreshConditionListValue;16exports.getCompareLogic = getCompareLogic;17exports.ToSolution = ToSolution;18exports.setDefaultScheme = setDefaultScheme;19exports.editSchemeInfo = editSchemeInfo;20exports.deleteScheme = deleteScheme;21var _immutable = require('immutable');22var _immutable2 = _interopRequireDefault(_immutable);23var _util = require('../helpers/util');24var _moment = require('moment');25var _moment2 = _interopRequireDefault(_moment);26function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }27var idObj = {28 isdefault: false,29 queryVisible: false,30 schemeList: [],31 queryList: [],32 compareLogicList: [],33 ToSolution: [],34 textMouseEnterId: -1,35 bAddscheme: false,36 bqueryItem: false,37 currentName: "",38 currentId: -1,39 filterId: "",40 checked: false,41 deleteId: "",42 editSchemeitem: [],43 bEdit: false44};45var $$initialState = _immutable2.default.fromJS({});46var url = exports.url = {47 ReSchemeList: 'filterDesign/getSolutionList',48 ToSolution: 'filterDesign/saveSolution'49};50function doProxy(url, method, params, callback, noUniform) {51 var config = { url: url, method: method, params: params };52 if (noUniform) {53 config.options = { uniform: false };54 }55 (0, _util.proxy)(config).then(function (json) {56 callback(json);57 });58}59exports.default = function () {60 var $$state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $$initialState;61 var action = arguments[1];62 if (!action || !action.payload || !action.payload.modelId) return $$state;63 switch (action.type) {64 case 'PLATFORM_UI_FilterScheme_Isedit':65 {66 if (action.payload.IsEdit === true) {67 var bEdit = action.payload.IsEdit;68 var modelId = action.payload.modelId;69 $$state = $$state.mergeIn([modelId], {}, { bEdit: bEdit });70 return $$state;71 } else {72 var _bEdit = action.payload.IsEdit;73 var _modelId = action.payload.modelId;74 $$state = $$state.mergeIn([_modelId], {}, { bEdit: _bEdit });75 return $$state;76 }77 }78 case 'PLATFORM_UI_FilterScheme_queryVisible':79 {80 if (action.payload.queryVisible === true) {81 var queryVisible = action.payload.queryVisible;82 var _modelId2 = action.payload.modelId;83 $$state = $$state.mergeIn([_modelId2], {}, { queryVisible: queryVisible });84 } else {85 var _queryVisible = action.payload.queryVisible;86 var _modelId3 = action.payload.modelId;87 $$state = $$state.mergeIn([_modelId3], {}, { queryVisible: _queryVisible });88 }89 return $$state;90 }91 case 'PLATFORM_UI_FilterScheme_AddScheme':92 {93 if (action.payload.bAddscheme === true) {94 var bAddscheme = action.payload.bAddscheme;95 var _modelId4 = action.payload.modelId;96 $$state = $$state.mergeIn([_modelId4], {}, { bAddscheme: bAddscheme });97 } else {98 var _bAddscheme = action.payload.bAddscheme;99 var _modelId5 = action.payload.modelId;100 $$state = $$state.mergeIn([_modelId5], {}, { bAddscheme: _bAddscheme });101 }102 return $$state;103 }104 case 'PLATFORM_UI_FilterScheme_IsDefault':105 {106 if (action.payload.isdefault === true) {107 var isdefault = action.payload.isdefault;108 var _modelId6 = action.payload.modelId;109 $$state = $$state.mergeIn([_modelId6], {}, { isdefault: isdefault });110 return $$state;111 } else {112 var _isdefault = action.payload.isdefault;113 var _modelId7 = action.payload.modelId;114 $$state = $$state.mergeIn([_modelId7], {}, { isdefault: _isdefault });115 return $$state;116 }117 }118 case 'PLATFORM_UI_FilterScheme_IsEnterSchemeitem':119 {120 var _modelId8 = action.payload.modelId;121 var schemeList = $$state.toJS()[_modelId8].schemeList;122 if (schemeList && schemeList.length > 0) {123 schemeList.forEach(function (ele, index) {124 if (ele.id == action.payload.id) ele.isMouseEnter = action.payload.bEnter;125 $$state = $$state.mergeIn([_modelId8], {}, { schemeList: schemeList });126 });127 }128 return $$state;129 }130 case 'PLATFORM_UI_FilterScheme_chooseCondition':131 {132 var _modelId9 = action.payload.modelId;133 var _schemeList = $$state.toJS()[_modelId9].schemeList;134 if (_schemeList && _schemeList.length > 0) {135 _schemeList.forEach(function (element, index) {136 if (element.id == action.payload.id) {137 $$state = $$state.mergeIn([_modelId9], {}, { 'currentId': element.id });138 $$state = $$state.mergeIn([_modelId9], {}, { 'currentName': element.solutionName });139 }140 });141 }142 return $$state;143 }144 case 'PLATFORM_UI_FilterScheme_schemeData':145 {146 var _modelId10 = action.payload.modelId;147 var _schemeList2 = action.payload.schemeList;148 $$state = $$state.set(_modelId10, _immutable2.default.fromJS(idObj));149 var currentId = -1;150 var currentName = "";151 if (_schemeList2 && _schemeList2.length > 0) {152 _schemeList2.forEach(function (ele, index) {153 if (currentId == -1 || ele.isDefault) {154 currentId = ele.id;155 currentName = ele.solutionName;156 if (!ele.solutionName) {157 currentName = ele.id;158 }159 }160 ele.isMouseEnter = false;161 });162 }163 currentName = currentName ? currentName : undefined;164 $$state = $$state.mergeIn([_modelId10], {}, { currentId: currentId, currentName: currentName, schemeList: _schemeList2 });165 return $$state;166 }167 case 'PLATFORM_UI_FilterScheme_reSetValue':168 {169 var _modelId11 = action.payload.modelId;170 $$state = $$state.mergeIn([_modelId11], {}, { 'schemeList': action.payload.params.schemeList });171 return $$state;172 }173 case 'PLATFORM_UI_FilterScheme_queryData':174 {175 var _modelId12 = action.payload.modelId;176 $$state = $$state.mergeIn([_modelId12], {}, { 'queryList': action.payload.queryList });177 return $$state;178 }179 case 'PLATFORM_UI_FilterScheme_compareLogicData':180 {181 var _modelId13 = action.payload.modelId;182 $$state = $$state.mergeIn([_modelId13], {}, { 'compareLogicList': action.payload.compareLogicList });183 return $$state;184 }185 case 'PLATFORM_UI_FilterScheme_toSolutionresult':186 {187 var _bAddscheme2 = false;188 var _modelId14 = action.payload.modelId;189 $$state = $$state.mergeIn([_modelId14], {}, { bAddscheme: _bAddscheme2 });190 return $$state;191 }192 case 'PLATFORM_UI_FilterScheme_editschemeInfo':193 {194 var editSchemeitem = action.payload.editSchemeitem;195 var _modelId15 = action.payload.modelId;196 // let compareLogicList = action.payload.reCompareLogic197 $$state = $$state.mergeIn([_modelId15], {}, { editSchemeitem: editSchemeitem });198 return $$state;199 }200 default:201 return $$state;202 }203};204function IsEnterSchemeitem(bEnter, id, modelId) {205 return function (dispatch, getState) {206 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_IsEnterSchemeitem', { bEnter: bEnter, id: id, modelId: modelId }));207 };208}209function AddScheme(bAddscheme, modelId) {210 return function (dispatch, getState) {211 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_AddScheme', { bAddscheme: bAddscheme, modelId: modelId }));212 };213}214function IsDefault(isdefault, modelId) {215 return function (dispatch, getState) {216 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_IsDefault', { isdefault: isdefault, modelId: modelId }));217 };218}219function Isedit(IsEdit, modelId) {220 return function (dispatch, getState) {221 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_Isedit', { IsEdit: IsEdit, modelId: modelId }));222 };223}224function openQuerylist(queryVisible, modelId) {225 return function (dispatch, getState) {226 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_queryVisible', { queryVisible: queryVisible, modelId: modelId }));227 };228}229function chooseScheme(id, modelId) {230 return function (dispatch, getState) {231 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_chooseCondition', { id: id, modelId: modelId }));232 };233}234function getQueryItem(modelId, filterId) {235 return function (dispatch) {236 var config = {237 url: 'filterDesign/getFiltersInfo',238 method: 'GET',239 params: {240 filtersId: filterId241 }242 };243 (0, _util.proxy)(config).then(function (json) {244 if (json.code !== 200) {245 cb.utils.alert('请æ±æ°æ®å¤±è´¥ï¼' + json.message, 'error');246 return;247 }248 var queryList = json.data;249 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_queryData', { modelId: modelId, queryList: queryList }));250 });251 };252}253function getSchemeListData(modelId, filterId) {254 return function (dispatch, getState) {255 var config = {256 url: 'filterDesign/getSolutionList',257 method: 'POST',258 params: {259 filterId: filterId260 }261 };262 (0, _util.proxy)(config).then(function (json) {263 if (json.code !== 200) {264 cb.utils.alert('请æ±æ°æ®å¤±è´¥ï¼' + json.message, 'error');265 return;266 }267 var schemeList = json.data;268 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_schemeData', { modelId: modelId, schemeList: schemeList }));269 });270 };271}272function refreshConditionListValue(filterId, schemeListChange, modelId) {273 return function (dispatch, getState) {274 var params = { filterId: filterId };275 var callback = function callback(json) {276 if (json.code === 200) {277 var _params = {};278 var schemeList = json.data;279 _params.schemeList = schemeList;280 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_reSetValue', { params: _params, modelId: modelId }));281 schemeListChange(schemeList);282 }283 if (json.code !== 200) {284 cb.utils.alert('å·æ°å¤±è´¥');285 }286 };287 doProxy(url.ReSchemeList, 'POST', params, callback);288 };289}290function getCompareLogic(modelId) {291 return function (dispatch, getState) {292 var config = {293 url: 'enum/getEnumMap',294 method: 'GET',295 params: {296 enumtype: 'compareLogic'297 }298 };299 (0, _util.proxy)(config).then(function (json) {300 if (json.code !== 200) {301 cb.utils.alert('请æ±æ°æ®å¤±è´¥ï¼' + json.message, 'error');302 return;303 }304 var compareLogicList = json.data;305 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_compareLogicData', { modelId: modelId, compareLogicList: compareLogicList }));306 });307 };308}309function ToSolution(Solutionitem, filtersId, schemeListChange, modelId) {310 return function (dispatch, getState) {311 var params = {};312 params = Solutionitem;313 var callback = function callback(json) {314 if (json.code === 200) {315 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_toSolutionresult', { modelId: modelId }));316 dispatch(refreshConditionListValue(filtersId, schemeListChange, modelId));317 cb.utils.alert('æä½æå', 'success');318 }319 if (json.code !== 200) {320 cb.utils.alert('请æ±æ°æ®å¤±è´¥ï¼' + json.message, 'error');321 return;322 }323 };324 doProxy(url.ToSolution, 'POST', params, callback);325 };326}327function setDefaultScheme(id, filtersId, modelId, schemeListChange) {328 return function (dispatch, getState) {329 var config = {330 url: 'filterDesign/setDefaultFilter',331 method: 'GET',332 params: {333 solutionId: id334 }335 };336 (0, _util.proxy)(config).then(function (json) {337 if (json.code !== 200) {338 cb.utils.alert('请æ±æ°æ®å¤±è´¥ï¼' + json.message, 'error');339 return;340 }341 dispatch(refreshConditionListValue(filtersId, schemeListChange, modelId));342 });343 };344}345function editSchemeInfo(id, callback, modelId, reCompareLogic) {346 return function (dispatch, getState) {347 var config = {348 url: 'filter/' + id + '/solutionFilters',349 method: 'GET',350 params: {351 solutionid: id352 }353 };354 (0, _util.proxy)(config).then(function (json) {355 if (json.code !== 200) {356 cb.utils.alert('请æ±æ°æ®å¤±è´¥ï¼' + json.message, 'error');357 return;358 }359 var editSchemeitem = json.data;360 callback(editSchemeitem);361 dispatch((0, _util.genAction)('PLATFORM_UI_FilterScheme_editschemeInfo', { editSchemeitem: editSchemeitem, modelId: modelId }));362 });363 };364}365function deleteScheme(id, filtersId, schemeListChange, modelId) {366 return function (dispatch, getState) {367 var config = {368 url: 'filterDesign/delSolution',369 method: 'GET',370 params: {371 solutionId: id372 }373 };374 (0, _util.proxy)(config).then(function (json) {375 if (json.code !== 200) {376 cb.utils.alert('请æ±æ°æ®å¤±è´¥ï¼' + json.message, 'error');377 return;378 }379 dispatch(refreshConditionListValue(filtersId, schemeListChange, modelId));380 });381 };...
config.js
Source:config.js
...83 // Base URL for Meteor Accounts OAuth services, typically84 // "https://www.meteor.com/oauth2". Endpoints include /authorize and85 // /token.86 getOauthUrl: function () {87 return addScheme(getAuthServiceHost()) + "/oauth2";88 },89 // Base URL for Meteor Accounts API, typically90 // "https://www.meteor.com/api/v1". Endpoints include '/login' and91 // '/logoutById'.92 getAccountsApiUrl: function () {93 return addScheme(getAuthServiceHost()) + "/api/v1";94 },95 // URL for the DDP interface to Meteor Accounts, typically96 // "https://www.meteor.com/auth". (Really should be a ddp:// URL --97 // we'll get there soon enough.)98 getAuthDDPUrl: function () {99 return addScheme(getAuthServiceHost()) + "/auth";100 },101 // URL for the DDP interface to the meteor build farm, typically102 // "https://build.meteor.com".103 getBuildFarmUrl: function () {104 if (process.env.METEOR_BUILD_FARM_URL)105 return process.env.METEOR_BUILD_FARM_URL;106 var host = config.getBuildFarmDomain();107 return addScheme(host);108 },109 getBuildFarmDomain: function () {110 if (process.env.METEOR_BUILD_FARM_URL) {111 var parsed = url.parse(process.env.METEOR_BUILD_FARM_URL);112 return parsed.host;113 } else {114 return getUniverse().replace(/^www\./, 'build.');115 }116 },117 // URL for the DDP interface to the package server, typically118 // "https://packages.meteor.com". (Really should be a ddp:// URL --119 // we'll get there soon enough.)120 //121 // When running everything locally, run the package server at the122 // base universe port number (that is, the Meteor Accounts port123 // number) plus 20.124 getPackageServerUrl: function () {125 if (process.env.METEOR_PACKAGE_SERVER_URL)126 return process.env.METEOR_PACKAGE_SERVER_URL;127 var host = config.getPackageServerDomain();128 return addScheme(host);129 },130 getPackageServerDomain: function () {131 if (isLocalUniverse()) {132 return localhostOffset(20);133 } else {134 if (process.env.METEOR_PACKAGE_SERVER_URL) {135 var parsed = url.parse(process.env.METEOR_PACKAGE_SERVER_URL);136 return parsed.host;137 } else {138 return getUniverse().replace(/^www\./, 'packages.');139 }140 }141 },142 getTestPackageServerUrl: function () {143 if (isLocalUniverse()) {144 return localhostOffset(20);145 } else {146 return addScheme(getUniverse().replace(/^www\./, 'test-packages.'));147 }148 },149 getPackageStatsServerUrl: function () {150 if (process.env.METEOR_PACKAGE_STATS_SERVER_URL) {151 return process.env.METEOR_PACKAGE_STATS_SERVER_URL;152 }153 var host = config.getPackageStatsServerDomain();154 return addScheme(host);155 },156 getPackageStatsServerDomain: function () {157 if (process.env.METEOR_PACKAGE_STATS_SERVER_URL) {158 return url.parse(process.env.METEOR_PACKAGE_STATS_SERVER_URL).hostname;159 }160 if (isLocalUniverse()) {161 return localhostOffset(30);162 } else {163 return getUniverse().replace(/^www\./, 'activity.');164 }165 },166 // Note: this is NOT guaranteed to return a distinct prefix for every167 // conceivable URL. But it sure ought to return a distinct prefix for every168 // server we actually use.169 getPackageServerFilePrefix: function (serverUrl) {170 var self = this;171 if (!serverUrl) serverUrl = self.getPackageServerUrl();172 // Chop off http:// and https:// and trailing slashes.173 serverUrl = serverUrl.replace(/^\https:\/\//, '');174 serverUrl = serverUrl.replace(/^\http:\/\//, '');175 serverUrl = serverUrl.replace(/\/+$/, '');176 // Chop off meteor.com.177 serverUrl = serverUrl.replace(/\.meteor\.com$/, '');178 // Replace other weird stuff with X.179 serverUrl = serverUrl.replace(/[^a-zA-Z0-9.:-]/g, 'X');180 return serverUrl;181 },182 getPackagesDirectoryName: function (serverUrl) {183 var self = this;184 var prefix = config.getPackageServerFilePrefix(serverUrl);185 if (prefix !== 'packages') {186 prefix = path.join('packages-from-server', prefix);187 }188 return prefix;189 },190 getLocalPackageCacheFilename: function (serverUrl) {191 var self = this;192 var prefix = self.getPackageServerFilePrefix(serverUrl);193 // Should look like 'packages.data.db' in the default case194 // (packages.data.json before 0.9.4).195 return prefix + ".data.db";196 },197 getPackageStorage: function (tropo) {198 var self = this;199 tropo = tropo || tropohouse.default;200 return path.join(tropo.root, "package-metadata", "v2.0.1",201 self.getLocalPackageCacheFilename());202 },203 getBannersShownFilename: function() {204 return path.join(tropohouse.default.root,205 "package-metadata", "v1.1", "banners-shown.json");206 },207 // Return the domain name of the current Meteor Accounts server in208 // use. This is used as a key for storing your Meteor Accounts209 // login token.210 getAccountsDomain: function () {211 return getUniverse();212 },213 getDeployHostname: function () {214 return process.env.DEPLOY_HOSTNAME || "meteor.com";215 },216 // Deploy URL for MDG free hosting, eg 'https://deploy.meteor.com'.217 getDeployUrl: function () {218 var host;219 // Support the old DEPLOY_HOSTNAME environment variable for a220 // while longer. Soon, let's remove this in favor of the universe221 // scheme.222 if (process.env.DEPLOY_HOSTNAME) {223 host = process.env.DEPLOY_HOSTNAME;224 if (host.match(/^http/))225 return host; // allow it to contain a URL scheme226 } else {227 // Otherwise, base it on the universe.228 if (isLocalUniverse())229 throw new Error("local development of deploy server not supported");230 else231 host = getUniverse().replace(/^www\./, 'deploy.');232 }233 return addScheme(host);234 },235 // URL from which the update manifest may be fetched, eg236 // 'https://update.meteor.com/manifest.json'237 getUpdateManifestUrl: function () {238 if (isLocalUniverse())239 u = "www.meteor.com"; // localhost can't run the manifest server240 var host = getUniverse().replace(/^www\./, 'update.');241 return addScheme(host) + "/manifest.json";242 },243 // Path to file that contains our credentials for any services that244 // we're logged in to. Typically .meteorsession in the user's home245 // directory.246 getSessionFilePath: function () {247 // METEOR_SESSION_FILE is for automated testing purposes only.248 return process.env.METEOR_SESSION_FILE ||249 path.join(process.env.HOME, '.meteorsession');250 },251 // Port to use when querying URLs for the deploy server that backs252 // them, and for querying oauth clients for their oauth information253 // (so we can log into them).254 //255 // In production this should always be 443 (we *must*...
08-scheme-view.spec.js
Source:08-scheme-view.spec.js
...9// Changes: src/components/ViewScheme.js10beforeEach(() => {11 startApp();12 goView("Schemes");13 addScheme(document.body, captureCrichton);14 addScheme(document.body, destroyScarrans);15});16test("EXPECTED TO PASS: the list has the schemes", () => {17 const scheme1 = getByScheme(document.body, 1);18 const scheme2 = getByScheme(document.body, 2);19 expect(scheme1).toHaveTextContent(/Capture Crichton/);20 expect(scheme2).toHaveTextContent(/Destroy Scarrans/);21 expect(() => getByScheme(document.body, 3)).toThrow();22});23test.each`24 schemeNumber | content25 ${1} | ${/Scheme: Capture Crichton/}26 ${2} | ${/Scheme: Destroy Scarrans/}27`("View a Scheme ($schemeNumber})", ({ schemeNumber, content }) => {28 goScheme(document.body, schemeNumber);...
color-hash.js
Source:color-hash.js
...25 hash = hashCode(str);26 27 return "#" + scheme[hash % scheme.length];28 }29 function addScheme(name, scheme) {30 schemes[name] = scheme;31 }32 function getScheme(name) {33 return scheme[name];34 }35 function deleteScheme(name) {36 if (name !== "base") {37 delete schemes[name];38 }39 }40 return {41 "addScheme" : addScheme,42 "getScheme" : getScheme,43 "deleteScheme" : deleteScheme,...
07-schemes-add.spec.js
Source:07-schemes-add.spec.js
...14});15test("Adds a new Scheme", () => {16 goView("Schemes");17 // hint: control click addScheme to see what it does18 addScheme(document.body, captureCrichton);19 // hint: dispatch scheme added20 const scheme = getByScheme(document.body, 1);21 expect(scheme).toHaveTextContent(/Capture Crichton/);22});23test("EXPECTED TO PASS: add more than one scheme", () => {24 goView("Schemes");25 addScheme(document.body, captureCrichton);26 addScheme(document.body, destroyScarrans);27 const scheme1 = getByScheme(document.body, 1);28 const scheme2 = getByScheme(document.body, 2);29 expect(scheme1).toHaveTextContent(/Capture Crichton/);30 expect(scheme2).toHaveTextContent(/Destroy Scarrans/);...
index.js
Source:index.js
1//import Vue from 'vue'2//import Router from 'vue-router'3import App from '../App'4const home = r => require.ensure([], () => r(require('../pages/home/home')), 'home');5const schemes = r => require.ensure([], () => r(require('../pages/schemes/schemes')), 'schemes');6const addScheme = r => require.ensure([], () => r(require('../pages/schemes/addScheme')), 'addScheme');7const library = r => require.ensure([], () => r(require('../pages/library/library')), 'library');8/*import home from '../components/home/home';9import home1 from '../pages/home1/home1';10let routes = [{11 path: '/home',12 name: 'home',13 component: home14}, {15 path: '/home1',16 name: 'home1',17 component: home118}]*/19/*export default new Router({20 routes21})*/22export default [{23 path: '/',24 component: App, //顶å±è·¯ç±ï¼å¯¹åºindex.html25 children: [{ //äºçº§è·¯ç±ã对åºApp.vue26 path: '', //空页é¢å¯¹åºhome27 redirect: '/home'28 }, {29 path: '/home',30 name: 'home',31 component: home32 }, {33 path: '/schemes',34 component: schemes35 }, {36 path: '/addScheme',37 name: 'addScheme',38 component: addScheme39 }, {40 path: '/library',41 name: 'library',42 component: library43 }]...
addSchemes.js
Source:addSchemes.js
1import { addScheme } from "./addScheme";2import { goView } from "./goView";3export function addSchemes(...schemes) {4 goView("Schemes");5 schemes.forEach((s) => addScheme(document.body, s));...
Using AI Code Generation
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 await page.screenshot({ path: 'example.png' });7 await browser.close();8})();9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await page.screenshot({ path: 'example.png' });15 await browser.close();16})();17const { chromium } = require('playwright');18(async () => {19 const browser = await chromium.launch();20 const context = await browser.newContext();21 const page = await context.newPage();22 await page.screenshot({ path: 'example.png' });23 await browser.close();24})();25const { chromium } = require('playwright');26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 await page.screenshot({ path: 'example.png' });31 await browser.close();32})();33const { chromium } = require('playwright');34(async () => {35 const browser = await chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 await page.screenshot({ path: 'example.png' });39 await browser.close();40})();41[MIT](LICENSE)
Using AI Code Generation
1const playwright = require('playwright');2(async () => {3 for (const browserType of BROWSER) {4 const browser = await playwright[browserType].launch();5 const context = await browser.newContext({ acceptDownloads: true });6 const page = await context.newPage();7 await page.click('a[href="download/Sample.pdf"]');8 const [download] = await Promise.all([9 page.waitForEvent('download'),10 page.click('a[href="download/Sample.pdf"]'),11 ]);12 await download.path();13 await download.saveAs('test.pdf');14 await browser.close();15 }16})();17const playwright = require('playwright');18(async () => {19 for (const browserType of BROWSER) {20 const browser = await playwright[browserType].launch();21 const context = await browser.newContext({ acceptDownloads: true });22 const page = await context.newPage();23 await page.click('a[href="download/Sample.pdf"]');24 const [download] = await Promise.all([25 page.waitForEvent('download'),26 page.click('a[href="download/Sample.pdf"]'),27 ]);28 await download.path();29 await download.saveAs('test.pdf');30 await browser.close();31 }32})();33const playwright = require('playwright');34(async () => {35 for (const browserType of BROWSER) {36 const browser = await playwright[browserType].launch();37 const context = await browser.newContext({ acceptDownloads: true });38 const page = await context.newPage();39 await page.click('a[href="download/Sample.pdf"]');40 const [download] = await Promise.all([41 page.waitForEvent('download'),42 page.click('a[href="download/Sample.pdf"]'),43 ]);44 await download.path();45 await download.saveAs('test.pdf');46 await browser.close();47 }48})();
Using AI Code Generation
1const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');2const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');3const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');4const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');5const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');6const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');7const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');8const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');9const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');10const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');11const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');12const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');13const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');14const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');15const { addScheme } = require('playwright/lib/server/supplements/recorder/schemes');16const {
Using AI Code Generation
1const { addScheme } = require('playwright/lib/utils/utils');2addScheme('myapp', (route, request) => {3 route.fulfill({4 });5});6const { addInitScript } = require('playwright/lib/server/browserContext');7addInitScript(context => {8});9const { addInitScript } = require('playwright/lib/server/browserContext');10addInitScript(context => {11});12const { addInitScript } = require('playwright/lib/server/browserContext');13addInitScript(context => {14});15const { addInitScript } = require('playwright/lib/server/browserContext');16addInitScript(context => {17});18const { addInitScript } = require('playwright/lib/server/browserContext');19addInitScript(context => {20});21const { addInitScript } = require('playwright/lib/server/browserContext');22addInitScript(context => {23});
Using AI Code Generation
1const { addScheme } = require('playwright-core/lib/utils/utils.js');2addScheme('https', require('https'));3addScheme('http', require('http'));4const { chromium } = require('playwright');5(async () => {6 const browser = await chromium.launch({ headless: false });7 const context = await browser.newContext({8 httpCredentials: {9 }10 });11 const page = await context.newPage();12 await page.screenshot({ path: `example.png` });13 await browser.close();14})();
Using AI Code Generation
1const { chromium } = require('playwright');2const { addScheme } = require('playwright/lib/server/supplements/har/harTracer');3addScheme('test', {4});5(async () => {6 const browser = await chromium.launch();7 const context = await browser.newContext({8 har: {9 },10 });11 const page = await context.newPage();12 await browser.close();13})();14Please read the [contributing guide](
Using AI Code Generation
1const { addScheme } = require('playwright/lib/server/supplements/recorder/recorderApp');2addScheme('test', {3 async requestHandler(request) {4 return { status: 200, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'ok' }) };5 },6 async abortHandler(request) {7 return { status: 200, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'aborted' }) };8 }9});10const { chromium } = require('playwright');11const { addScheme } = require('playwright/lib/server/supplements/recorder/recorderApp');12addScheme('test', {13 async requestHandler(request) {14 return { status: 200, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'ok' }) };15 },16 async abortHandler(request) {17 return { status: 200, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'aborted' }) };18 }19});20(async () => {21 const browser = await chromium.launch();22 const context = await browser.newContext();23 const page = await context.newPage();24 await browser.close();25})();26const { chromium } = require('playwright');27const { addScheme } = require('playwright/lib/server/supplements/recorder/recorderApp');28addScheme('test', {29 async requestHandler(request) {30 return { status: 200, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'ok' }) };31 },32 async abortHandler(request) {33 return { status: 200, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ status: 'aborted' }) };34 }35}, 8081);36(async () => {37 const browser = await chromium.launch();38 const context = await browser.newContext();39 const page = await context.newPage();40 await browser.close();41})();
Using AI Code Generation
1const {addScheme} = require('playwright/lib/server/supplements/recorder/recorderApp');2addScheme('mytest', (req, resp) => {3 resp.end('Hello World!');4});5const {addRoute} = require('playwright/lib/server/supplements/recorder/recorderApp');6addRoute('GET', '/mytest', (req, resp) => {7 resp.end('Hello World!');8});9const {addInterceptor} = require('playwright/lib/server/supplements/recorder/recorderApp');10 req.continue();11});12const {addRequestHandler} = require('playwright/lib/server/supplements/recorder/recorderApp');13addRequestHandler((req) => {14 req.continue();15});16const {addResponseHandler} = require('playwright/lib/server/supplements/recorder/recorderApp');17addResponseHandler((resp) => {18 resp.continue();19});20const {addInitScript} = require('playwright/lib/server/supplements/recorder/recorderApp');21addInitScript('console.log("Hello World!")');22const {addInitScriptPath} = require('playwright/lib/server/supplements/recorder/recorderApp');23addInitScriptPath('test.js');24const {addRequestInterception} = require('playwright/lib/server/supplements/recorder/recorderApp');25addRequestInterception();26const {addResponseInterception} = require('playwright/lib/server/supplements/recorder/recorderApp');27addResponseInterception();28const {addRedirect} = require('playwright/lib/server/supplements/recorder/recorderApp');29const {addRedirect
Using AI Code Generation
1const { addScheme } = require('@playwright/test/lib/server/supplements/supplements');2addScheme('example', (route, request, response) => {3});4const { addRoute } = require('@playwright/test/lib/server/routes/routes');5addRoute('example', (route, request, response) => {6});7const { addInitScript } = require('@playwright/test/lib/server/initScripts/initScripts');8addInitScript('example', (route, request, response) => {9});10const { addWorkerInitScript } = require('@playwright/test/lib/server/initScripts/initScripts');11addWorkerInitScript('example', (route, request, response) => {12});13[MIT](LICENSE)
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.
Get 100 minutes of automation test minutes FREE!!