How to disable Meteor.Collection.get() on Browser console - node.js

Scenario:
I have created an app in Meteor 1.5 and the problem is that when I run Meteor.Collection.get('CollectionName').find().fetch() inside chrome/firefox console, I see results.
Requirement:
Meteor.Collection.get('CollectionName') should be disabled on browser console.
It must show below error message if we try to access Collection using get()
Uncaught TypeError: Meteor.Collection.get is not a function
Analysis and expert's view
I got a comment to check if dburles:mongo-collection-instances is installed. But it was not in my package either. I am stuck as which package is allowing me to view collection on browser console.
My Meteor package list:
meteor-base#1.1.0
mobile-experience#1.0.4
mongo#1.1.18
blaze-html-templates
reactive-var#1.0.11
tracker#1.1.3
standard-minifier-css#1.3.4
standard-minifier-js#2.1.0
es5-shim#4.6.15
ecmascript#0.8.0
kadira:flow-router
kadira:blaze-layout
less#2.7.9
practicalmeteor:mocha
johanbrook:publication-collector
momentjs:moment
twbs:bootstrap
ian:accounts-ui-bootstrap-3
accounts-password#1.3.6
aldeed:collection2
check#1.2.5
ostrio:loggerfile
mizzao:user-status
gwendall:auth-client-callbacks
meteorhacks:ssr
bryanmorgan:webshot
manuelro:blaze-math
awatson1978:browser-detection
mrt:flash-messages
babrahams:transactions
themeteorchef:bert
session#1.1.7
iain:accounting
alanning:roles
reywood:publish-composite
aslagle:reactive-table
natestrauser:select2
dynamic-import
aldeed:autoform
percolate:synced-cron
mixmax:smart-disconnect
pfafman:filesaver
harrison:papa-parse
cfs:standard-packages
cfs:filesystem
tmeasday:publish-counts
maazalik:highcharts
jcbernack:reactive-aggregate
email
tsega:bootstrap3-datetimepicker

Related

Playwright fails to fill input

I'm running a Playwright script on a Jenkins page that has input elements. When I try to fill one of the inputs with text, it fails with this error:
(node:3337) UnhandledPromiseRejectionWarning: page.fill: Protocol error (Page.insertText): error in channel "content::page": exception while running method "insertText" in namespace "page": Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsITextInputProcessor.commitCompositionWith] _insertText#chrome://juggler/content/content/PageAgent.js:891:32
I've tried running with DEBUG=pw:api environment enabled but the logs there aren't too helpful. From the normal console log I get the following log:
waiting for selector "input[name="_.buildNumber"]"
selector resolved to visible <input value="" type="text" name="_.buildNumber" class=…/>
elementHandle.fill("54")
waiting for element to be visible, enabled and editable
element is visible, enabled and editable
So it seems like the element exists and can be edited but for some reason Playwright is unsuccessful at trying to fill it. What am I missing here?
This is a Playwright bug that is specific to Firefox. To get around it for now, you should be able to switch to using either Chrome or Safari in your import statement. So either:
import { chromium } from 'playwright';
Or using Safari:
import { webkit } from 'playwright';

How to navigate Edge extension local storage callback requirements

I'm trying to access the local storage data in Edge set by my options page, using my popup script. Is there a current, working example of this available?
I was using localStorage, but it would only update the popup if I reloaded the extension after saving changes in my options page. I want to make it easier on the user by allowing the popup to access it immediately after saving, without reloading. I found the browser.storage.local.get(), but documentation conflicts everywhere I look, and I can't find viable working examples.
I have used, per Edge documentation:
browser.storage.local.get("sample");
But it throws an error requiring a callback function. So then I used:
let sample = browser.storage.local.get("example");
sample.then(ifGood, ifBad);
I get an error regarding property "then".
Then I simply tried adding a callback to the action itself:
sample = browser.storage.local.get("example", callbackFunction);
function callbackFunction(data){
alert(data);
}
The end alert should display a string, but it just displays an empty Object. How do I access the data returned in the callback? I tried callbackFunction(this) as an argument in the get, but it throws an error about the syntax of the get.
I found a work-around using browser.runtime.reload() in the Options page when saving the changes. It still reloads the extension, but it does it without requiring the user to do it manually.
You should use this syntax:
browser.storage.local.get(propertyName | null, callbackFn)
where
callbackFn = function fn(resultObject) {...}
When you pass null you will get whole storage object.
Look for example 1 or example 2 in my Edge extension.

elementIsNotVisible throwing noSuchElementError in Selenium

I wrote a test to ensure a slideout panel closes in my selenium tests using node js. Whenever I close the panel I use the condition elementIsNotVisible. However an error is thrown, noSuchElementError. This error is technically correct because the element should no longer be on the page, but shouldn't elementIsNotVisible be correct as well?
Test.js file:
await driver.wait(until.elementIsVisible(testPage.addAllAnnotationsButton(driver)), 20000);
await testPage.exitGeneAnnotationsButton(driver).click();
await driver.wait(until.elementIsNotVisible(testPage.addAllAnnotationsButton(driver)), 20000);
Page.js file:
const testPage = {
addAllAnnotationsButton: driver => driver.findElement(By.css(testPage.addAllAnnotationsButtonSELECTOR))
}
Error message(Note- Error message is thrown on the line where elementIsNotVisible is called):
NoSuchElementError: no such element: Unable to locate element: {"method":"css selector","selector":"div.slideout.opened:nth-child(6) button.ui.button.medium:nth-child(2)"}
Edit 1: Please note, I have tried using stalenessOf and I still receive the same error.
As you have mentioned that when you close the panel, you use the condition elementIsNotVisible :
Here once you have closed the panel , the respective web element is not present in DOM. That is the reason you are getting NoSuchElement exception.
Suggestion : Use invisiblityofElement instead of elementIsNotVisible.
Though there are many reasons behind NoSuchElement Exception, one of the most common is try to interact with element/elements present in frame/iframe without switching the focus of web driver.
Hope this will help.

Loading a model into the 2D/3D viewer - Autodesk Forge

I'm trying to run the Autodesk viewer-navigation.sample link on my machine but I get just a loading screen and nothing happens.
I think it's because I haven't loaded the model, I'm not sure I understand what it means to do:
To prepare the models, run the Initial Setup endpoint.
But when I navigate to http://localhost:3000/forge/initialsetup when the server is running I get: Cannot GET /forge/initialsetup
I did set in the Autoforge app the callback url to be http://localhost:3000/api/forge/callback/oauth
I also did run:
npm install
set FORGE_CLIENT_ID=<<YOUR CLIENT ID FROM DEVELOPER PORTAL>>
set FORGE_CLIENT_SECRET=<<YOUR CLIENT SECRET>>
What else can be done to make it work?
As a temporary workaround, till we'll fix it, you could try either define a FORGE_BUCKET env variable:
set FORGE_BUCKET=someuniquename2d3d
or within source code (forge.js) change the line 45:
var ossBucketKey = process.env.FORGE_BUCKET || 'navigationsample3d2d';
by replacing the 'navigationsample3d2d' string with something like 'someveryuniquename2d3d'.
This should work.

How can I make Plone portal registries find and cook new-style static resources?

All JS I register with an id such as ++theme++mythemename/js/myscript.js gives me the following error on portal_javascripts: (resource not found or not accessible)
I know the id is correct because I can access localhost/mysite/++theme++mythemename/js/myscript.js (even if Diazo is disabled).
If development mode is on the resource gets delivered on the final HTML. However on production mode cooking process fails silently. Or almost. Besides getting a different cachekey than the one showed on portal_javascripts/manage_jsComposition, I see the following error message by accessing the cooked file:
/* XXX ERROR -- access to '++theme++mythemename/js/myscript.js' not authorized */
Any hints on how to deal with those? Or will I really need to leave them uncooked?
Have you tried a browser:resourceDirectory instead of a plone:static ?
<browser:resourceDirectory
name="yourJsFolder"
directory="yourJsFolder"
layer=".interfaces.IThemeSpecific"
/>
and calling your js with :
++resource++yourJsFolder/yourJsFile.js
i added your observatorio.tema package to an existing plone 4.1 buildout and added a random js file to the js registry (positioned after collapsibleformfields.js so it gets properly cooked)
GS export looks like:
<javascript authenticated="False" cacheable="True" compression="safe"
conditionalcomment="" cookable="True" enabled="True" expression=""
id="++theme++observatorio/js/ui.js" inline="False" insert-after="collapsibleformfields.js"/>
no error in portal_jacascripts and the javascript file is included in /jquery-cachekey-e7bee35d43da7a91eb29c6586dcbd396.js
did you add cacheable="False" and cookable="False" for testing purposes?
https://github.com/observatoriogenero/observatorio.tema/blob/master/src/observatorio/tema/profiles/default/jsregistry.xml#L373
since plone:static internally is a resourceDirectory both should and do work with resourceregistries.
maybe there is some other code in your buildout that re-registers another (empty) directory for the same name (observatorio)?

Resources