ExtJS7: How to test `onAppUpdate` in dev or testing environment - extjs

ExtJS v7.1 based application has onAppUpdate function and some other methods like onLaunch mentioned in documantation here for classic application. However in development and in testing environment these never gets fired. Is it as intended, if yes then how we can test onAppUpdate in dev or testing build. If no, then what could have gone wrong here.

You can achieve this by enabling Local Storage Cache for a specific build in your app.json file.
Example for the testing build:
/**
* Settings specific to testing builds.
*/
"testing": {
"cache": {
"enable": true
}
},
Every build on the testing environment will now call the onAppUpdate() function.

Note that you'll never see an onAppUpdate event triggered if you are using a dev build; it needs to be packaged (with caching enabled, as #ground_call points out). The point of onAppUpdate is that you've got a cached version which is older than what's now available - no cache, no onAppupdate
If you're willing to trust the infrastructure, and just test what your app does, you can always trigger the onAppUpdate event programmatically, either in a test script or from the JavaScript console.

Related

Apache Flink - set plugin folder for local development from IDE (IntelliJ IDEA)

Is it possible to override the location of Apache Flink's plugins folder to a local development environments folder in order to load them from the IntelliJ IDEAs IDE?
I tried to set the env. variable in the Run/debug configurations:
FLINK_PLUGINS_DIR="c:\flink-plugins\"
println("PluginsDir " + PluginConfig.getPluginsDir)
The output is:
WARN org.apache.flink.core.plugin.PluginConfig [] - The plugins directory ["c:\flink-plugins\"] does not exist.
PluginsDir Optional.empty
Does anyone know how to load Apache Flink plugins from an IDE?
TL;DR: When running locally in an IDE Flink uses a MiniCluster with LocalEnvironment or TestEnvironment (for unit tests). Unfortunately, it seems these do not utilize the local environment variables even if they are set, and there is no way to configure them otherwise.
I ran into the same problem wanting to run Flink in my IDE (VS Code) and have plugins. I used (scala) sys.env.get(ConfigConstants.ENV_FLINK_PLUGINS_DIR) to verify the environment variable was set correctly. Additionally, I consulted a unit test in Flink's source and found two things: First, despite setting the environment variable the value in PluginConfig was still the default. Second, overriding the value as is done in the unit test doesn't prevent the error due to plugin not found but it does change the return value of PluginConfig.getPluginsDir. This is probably because the plugins dir must be set at startup for the plugins to be found and loaded.
Looking in Flink documenation it appeared that the environment could be configured, but my attempt didn't work.
val conf: Configuration = new Configuration();
conf.setString(ConfigConstants.ENV_FLINK_PLUGINS_DIR, "C:/Users/ivwebber/Source/MDPLocal/private/MapsAI/projects/TrafficInference/Modules/traffic-forecast-pipeline/plugins/");
val env = StreamExecutionEnvironment.createLocalEnvironment(1, conf);
I think the problem with this approach is that it's not a value that could be set in conf/flink-conf.yaml. I looked in the source and found that the value is never copied to the resultant config. See here too.
This question may be related.
This question may be related.
I probably spent more time than it's worth looking into it, so I think filing a feature request/bug would be the next step. Considering that the token "ENV_FLINK_PLUGINS_DIR" only shows up 4 times in the source; I actually wonder if its never read or used.

Conditional Appcenter Codepush based on Environment?

Hi i'm using React Native Code Push currently.
Currently my code is manually handling it because of the need to prevent it from codepushing builds that are in the staging / testing environment. I had a problem earlier when i did a release build for testing, it still picked up the codepush and it refreshed incorrectly.
What is everyone else doing? I can make the codepushoptions on app resume but it'd still pick up the codepush bundle on my staging environments when i only want it on production :/
I considered the staging, and production environments in codepush but that part is quite confusing. not sure if its used at all.
let codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };
And in the code
if ((!(__DEV__)) && (API_BASE_URL === 'https://production.xxx')) { // only run in production
codePush.sync({
updateDialog: null,
installMode: codePush.InstallMode.ON_NEXT_RESTART
},
eh i found that i'd just set different keys per environment and codepush will handle that way.
https://www.youtube.com/watch?v=waatVm6-bX4

Webpack: Induce failure of live reload and build if there exists a Jest-test with compilation-errors or ESLint-errors

I have a React-Webpack project of medium complexity that uses a typical chain of TypeScript/Webpack-dev-server, Jest and related tools.
The setup is very similar to create-react-app, but it deviated a bit over the time: https://github.com/facebook/create-react-app/
If there exists a compilation-error or ESLint-error in the web-served TypeScript files, then Webpack rejects both the build and the live reload. This is the expected behavior.
However, if there are one or more non-compiling tests, then Webpack ignores the tests and continues to serve the web-code!
This is highly problematic because it leads to a situation where broken tests get pushed to our Git-repo again and again.
What I want to do:
How can I induce a failure of both builds and live reload if there exists a test with compilation-errors or ESLint-errors?
Note that all those tests are running in Node.js via the Jest test execution framework, whereas the actual app runs in the browser.
Preliminary investigation:
It seems that WebPack ignores all tests because of the following reportFiles configuration for ForkTsCheckerWebpackPlugin:
reportFiles: [
'**',
'!**/__tests__/**',
'!**/?(*.)(spec|test).*',
'!**/src/setupProxy.*',
'!**/src/setupTests.*',
],
If I remove the '!**/__tests__/**' and '!**/?(*.)(spec|test).*', then I get the desired build failures (but not live reload failures). However, this might lead to a whole new bunch of problems.

Lost UI Shared Context Error - Running protractor tests in headless chrome

I am attempting to run protractor tests locally using chrome but in headless mode, I have seen the docs and added the appropriate options to my config file:
capabilities: {
browserName: 'chrome',
shardTestFiles: true,
chromeOptions: {
args: [ '--headless', '--disable-gpu', '--window-size=800,600' ]
}
}
Upon running, I encounter the following error:
[1009/122000.081:ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context.
I tried removing the --disable-gpu flag as I read this may not be needed in future version of Chrome. I currently have latest Chrome installed (69.0.3497.100) and am using windows 7.
What do I need to do in order to get the tests running in headless mode? My intention is to check I can run in headless mode fine locally and then I want to get it running also in Chrome headless mode on a linux Jenkins node, where we are currently using XVFB but its proving to be too flaky with timeouts in tests for example.
Thanks
EDIT
With regards to others marking this as a duplicate - I should have said that my tests fail to run when I attempt to use the headless option, without the chrome options set, Chrome launches as expected and the test run and pass successfully.
My tests fail with no such element found type errors and if I view the screenshots taken on the failures, I just see a white square inside a black background (probably as per the --window-size option I was setting)
As you mentioned you are using Chrome headless mode on a linux Jenkins node you need consider a few factors as follows:
--disable-gpu
When Headless Chrome was first released as GA (General Availability) by Google Team the article Getting Started with Headless Chrome mentioned that :
--disable-gpu \ # Temporarily needed if running on Windows.
A note was added as :
Right now, you'll also want to include the --disable-gpu flag if you're running on Windows.
As per the discussion Headless: make --disable-gpu flag unnecessary it was clear that :
The --disable-gpu flag is no longer necessary on Linux or Mac OSX. It will also become unnecessary on Windows as soon as the bug SwiftShader fails an assert on Windows in headless mode is fixed.
You can find a detailed discussion on What happened under the hood in the discussion ChromeDriver showing Lost UI Shared Context
So as a first step you need to remove the argument: '--disable-gpu'
flaky tests
You seem to be executing your tests with the argument --window-size=800,600 which implies a reduced Viewport.
In order to utilize the maximum possible Viewport you must initialize the Chrome Browser in maximized mode through the argument: 'start-maximized'
angular
From Angular perspective, you can avoid timeouts by using the proper expected_conditions. You can find a detailed discussion about different expected_conditions in WebDriverWait not working as expected
--headless
Finally, I am not sure what exactly you meant as in ...my tests fail to run when I attempt to use the headless option, without the chrome options set.... Perhaps the argument '--headless' can be invoked only through chromeOptions and no other alternative.
I have the same error while running [1010/161441.019:ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context.
but my test runs perfect.I have you referred this https://gist.github.com/cvuorinen/543c6f72f8ec917ebfd596802d387aa3
I hope this below may help you
https://cvuorinen.net/2017/05/running-angular-tests-in-headless-chrome/
https://developers.google.com/web/updates/2017/04/headless-chrome

What is the equivanelt of "sass --watch" using wro4j?

Wro4j (Web Resource Optimizer for Java) make it easier for Java web developers to use things like SCSS / LESS / CoffeeScript / UglifyJS in their projects, without using the gems / npms directly.
I couldn't find though how do I use it for the simple use case of watching some SCSS files
What is the quickest equivalent to
sass --watch /src:/css
In wro4j?
I assume it is related to change detection. If it is true, than there is a configuration property called "resourceWatcherUpdatePeriod" which is used to check periodically resources for change. The next release (1.4.9) will improve the behavior of resourceWatcher by watching for change lazily.

Resources