I'm using the VSCode Debugger (breakpoints) to peek into my states. I know there's a Flutter Devtools to Inspect the widget tree but I was not able to inspect data from it. Is there any better way of doing this like React/Redux Devtools? I'm using Scoped Models by the way.
I ended up using the provider package which is devtools friendly
Related
Flutter run and build commands accept the --flavor parameter. I have found a tutorial on implementing it in Android and iOS projects. And, I also found a way to access the flavor name from the flutter code.
But I still have no idea how to access the flavor name on other platforms. It seems flutter documentation has no information about it.
Is there a way to read the --flavor parameter value from the flutter code on any platform?
The reason for my question in the comments is that you might be looking for using the --dart-define flag when building your app, instead of --flavor.
They serve different purposes, so both might be required depending on your desired outcome.
The value passed via the dart define flag can be accessed in the code via String.fromEnvironment(...)
I'm currently looking for a way to run automated tests on my devtools browser extension.
The extension basically injects/run some code in the current page, and displays the results.
I found that I can access the devtools panel code using this url: devtools://devtools/bundled/js_app.html?ws=127.0.0.1:9222/devtools/page/2786924A6A07EBBC4FE18A07D9D37BD4
But, with this url, the extension doesn't have any attached context (devtools.inspectedWindow) and doesn't know where to inject the testing code.
Is there another way I can use to access both the page and the devtools panel at the same time?
Thanks
I am using Robot Framework with python. I have a page that has a web view. I am able to find the element through Appium inspector and also through the Chrome Dev tools. But those locators are not working. The test case passes but it does not click on that element.
Is there any work around for this issue?
Did you try the class name locator?
driver.find_element_by_class_name()
Is it possible to test Flutter applications using the Cypress framework instead of using the built-in testing components that Flutter provides? If so, what are the pros & cons of both for Flutter testing if I know Cypress well?
Yes, technically, it's possible.
Here's a spec that passes with the basic flutter counter app:
describe('Counter app', () => {
beforeEach(() => {
cy.visit('http://localhost:_example_port_/#/')
cy.get('flt-semantics-placeholder').click({force: true})
})
it('Increments on button press', ()=>{
cy.get(`[aria-label="0"]`)
cy.get(`[aria-label="Increment"]`).click()
cy.get(`[aria-label="1"]`)
})
})
To explain, if you enable semantics by clicking on the hidden 'flt-semantic-placeholder' element, flutter adds a semantics layer used by screen readers. Widgets with tooltips and text are automatically assigned aria-labels, which Cypress can use to find and click on elements. (You can get more control over these labels using a Semantics Widget.)
I found this worked for the canvas renderer, but it crashed when I tried to run multiple test cases in the same run. So, use the html renderer, ie run flutter for the test with something like:
flutter run -d chrome --web-renderer html --web-port 3443
Okay, so clicking a button is pretty straightforward. What about other interactions?
Inputing text into a field:
Pretty straightforward. See this example.
Simulating a scroll event:
In short, no solution yet. See this markdown.
Simulating drag and drop:
Not likely. See this markdown.
Now for the pros and cons...
Pros:
Cypress is more user friendly than the integration testing flutter provides. Being able to easily hot reload tests, and being able to click around and inspect a live state of a failing test are nice features.
Cons:
Can't (yet) simulate scroll or drag.
Flutter web isn't too performant, and in particular the first load takes a long time. Tests are slow running.
Nothing indicates either the Flutter team or the Cypress team have any plans to support testing Flutter with Cypress.
As of this posting, no online guides or articles for testing Flutter with Cypress.
See also:
What are the tags, <flt-*> generated by Flutter for Web?
https://www.didierboelens.com/2018/07/semantics/
I'm developing an app widget on Android Studio beside an ionic project.
My goal is to to integrate my app widget into the ionic project permitting users having access to the widget by downloading the app.
I started copying pasting some file into the folder platform/android/src
but I get the error package R does not exist.
I don't know if it is the right way to do it.
If so, which library shall I import to fix this error. I already tried the android.jar from the android-sdk.
Is there any other easiest way to achieve this?
I just want to precise that the widget doesn't communicate with the ionic app, it make just http request to a Rest API.
It is because the hybrid does not have the Class R that manages that part. I'll leave some examples of how I do.
Instead of using R.layout.new_app_widget
context.getPackageName(),context.getResources().getIdentifier("new_app_widget", "layout",context.getPackageName());
or
context.getResources().getIdentifier("new_app_widget", "layout",context.getPackageName());
Instead of using R.id.btn_action
context.getResources().getIdentifier("btn_action", "id",context.getPackageName());
Instead of using R.string.app_name
context.getResources().getIdentifier("app_name", "string",context.getPackageName());
Instead of using R.drawable.icon
context.getResources().getIdentifier("icon", "drawable",context.getPackageName());