Unable to find locators for App Login - Xamarin.UI Automation test - xamarin

As our app login page is upgraded from ADAL library to MSAL library. We are unable to find the locators(Automation IDs) for sign in option via Automation.
we tried
App.EnterText(“UserID”);
App.PressEnter();
App.EnterText(“Password”);
App.PressEnter();
but the value is not entering in user name field and got below Exception Exception: System.Exception: No keyboard is visible for text entry.
at Xamarin.UITest.iOS.iOSApp+<>c__DisplayClass19_0.b__0 () [0x0002b] in <5c98084b260c4b7c9bafd9f653301be5>:0
Any suggestions to identify the user name field.

You need to add Xamarin.UITest to the Xamarin.Forms solution first.
And Set the AutomationIdfor the Entry.
xaml:
<Entry AutomationId="UserID" />
<Entry AutomationId="Password" />
UITest:
[Test]
public void test3()
{
app.EnterText("UserID","5");//UserID is 5
app.PressEnter();
app.EnterText("Password","123456");//password is 123456
app.PressEnter();
}

Related

#nativescript-community/ui-mapbox : Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0

I'm trying to use #nativescript-community/ui-mapbox plugin in my nativesctipt app.
After adding the plugin to my application
ns plugin add #nativescript-community/ui-mapbox
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:map="#nativescript-community/ui-mapbox" navigatingTo="navigatingTo">
<StackLayout>
<Label text="Nice map, huh!" class="title"/>
<ContentView height="240" width="240">
<map:MapboxView
accessToken="your_token"
mapStyle="traffic_night"
latitude="52.3702160"
longitude="4.8951680"
zoomLevel="3"
showUserLocation="true"
mapReady="onMapReady">
</map:MapboxView>
</ContentView>
</StackLayout>
</Page>
When running the tns run android command, I get the following error:
Build file '/Users/Mac/lete/letesell/platforms/android/app/build.gradle' line: 575
A problem occurred configuring project ':app'.
Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0.
Required by:
project :app
project :app > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0
Generate a token with Downloads:Read permission (see detailed doc)
Add this to your App_Resources/Android/app.gradle and replace DOWNLOAD_TOKEN with the one you generated :
repositories {
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = "mapbox"
// You can store secret token in gradle.properties for more security
password = "DOWNLOAD_TOKEN"
}
}
}
Change minSdkVersion to 21 (or whatever the doc says) in your App_Resources/Android/app.gradle

Laravel 8 Jetstream Livewire Password Confirmation modal not working

I am new to Livewire and I'm trying to use a modal password confirmation in Laravel 8 using Jetstream/Livewire/TailwindCSS. I'd like to do this as an added layer of protection before providing the user with some sensitive information. As per documentation in https://jetstream.laravel.com/2.x/features/password-confirmation.html (#Modal Confirmation Via Livewire) I should be able to create a component and then call the action to request the password confirmation before executing the rest of my code. However, I cannot get this to work.
My Component (\App\Http\Livewire\TestComponent.php):
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class TestComponent extends Component
{
public function doSomething(){
$this->ensurePasswordIsConfirmed();
//do something here to provide sensitive information, but for now:
dd('hello world');
}
}
and my view file:
<!-- some other stuff -->
<x-jet-confirms-password wire:then="doSomething">
<x-jet-button type="button" wire:loading.attr="disabled">
{{ __('Click Me') }}
</x-jet-button>
</x-jet-confirms-password>
<!-- rest of page -->
I expected to click the button and be presented with a password confirmation modal but instead, nothing happens on the UI and the console shows errors as follows:
Alpine: Cannot reference "$wire" outside a Livewire component (in SupportAlpine.js)
Alpine Error: "TypeError: null is not an object (evaluating 'wireEl.__livewire')"
Expression: "$wire.startConfirmingPassword('88430b463c8820be758732f8dbb3f7de')"
(in app.js)
Unhandled Promise Rejection: TypeError: null is not an object (evaluating 'wireEl.__livewire') (in SupportAlpine.js)
Other components on the page are working fine. I don't know what am I missing, but I'm sure it must be something embarrassingly simple. Any ideas? It would be greatly appreciated. Thanks in advance!
Try Adding use ConfirmsPasswords; under the top of your class
use Laravel\Jetstream\ConfirmsPasswords;
class TestComponent extends Component {
use ConfirmsPasswords;
public function doSomething(){
// Some Logic
}
}
for more in check this link Jetstream: Customization + Password Confirmation

Get name from textChange event in nativescript-vue

have this code:
<TextField
v-model="lastname"
#textChange="ontextChange"
name="lastname"
/>
and i want get name from event:
ontextChange(args){
console.log(args.name)
}
but i thing it's wrong.
You are accessing the wrong attribute in the arguments. It's of type EventData, you must be looking for args.eventName.
Update:
If you want to access the actual TextField which triggered the event, args.object should work.

Redux DevTools could not render

I am using redux-devtools with redux-devtools-dock-monitor and redux-devtools-log-monitor.
I followed documentation. However, in the console I receive this error:
index.js:1452 Redux DevTools could not render.
You must pass the Redux store to <DevTools> either as a "store" prop
or by wrapping it in a <Provider store={store}>.
Here is my Root component:
const Root = () => {
return (
<Provider store={store}>
<div>
<h1>Hello !!!</h1>
<DevTools/>
</div>
</Provider>
);
};
export default Root;
Additionally, I am getting this warning too:
redux-devtools#3.4.2" has incorrect peer dependency "react-redux#^4.0.0 || ^5.0.0".
I have used redux-devtools-log-monitor and redux-devtools-dock-monitor as monitors
I've tried the suggestion and now it gives another error (I'm using the DockMonitor). Ie this is my setup.
<DockMonitor toggleVisibilityKey='ctrl-h'
changePositionKey='ctrl-q'
changeMonitorKey='ctrl-m' >
<LogMonitor />
</DockMonitor>
<Provider store={store}>
<App />
<DevTools store={store} />
</Provider>
Produces the following error:
Uncaught Error: Passing redux store in props has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React-Redux's Provider and specific components like: . You may also pass a {context : MyContext} option to connect
In react-redux#6, the store is not passed via legacy React context and you should specify it explecitely via props like so:
<DevTools store={store}/>
Update 1: It was working for me because I had react-redux#6 in main project, but react-redux#5 for redux-devtools dependency. So if someone needs a quick workaround (you shouldn't include DevTools component in production anyway) till it will be supported, just do: cd ./node_modules/redux-devtools && npm i react-redux#5.
Update 2: redux-devtools#3.5.0 was just published, which adds support for react-redux#6.

Returning errors to gsp page in Grails after checking for hasErrors and Validating

I'm building this web app that works with user profiles. A user edit a profile and if he enters wrong data, the profile shows the invalid fields in red and shows the message. Very simple scenario. But for some reasons it doesn't work the way I assumed. I might be missing something somewhere. Here is what I do in my controller.
As you can see in the code below, I create a new Profile, I bind the params to it using an include list to only bind those params that profile accepts, and then call hasErrors on the profile instance. In debug mode, I can see that myProfile has errors when the user enters something wrong, but when I get back to the editProfile page, it doesn't show what field has the error. my gsp form has the render error tag and also hasError for each field.
def update (){
def myProfile = new Profile()
dataBind(params, myProfile, include:[.....])
if (myProfile.hasErrors()){
respond myUser.errors, view: 'editProfile'
return
}
else{
redirect(action:"viewProfile")
}
}
My gsp is something like this, I don't have access to my home computer right now to post the exact gsp page:
<g:hasErrors bean="${myUser}" field="name">
<g:message error="${myUser.errors.getFieldErrors("name")}" />
</g:hasErrors>
Instead of trying to pass the errors back, pass the entire object to your gsp. Assuming the bean you have in your gsp page is 'myUser', then this is what the render statement should be:
render view: 'editProfile', model: [myUser: myProfile]
When you use respond bean.errors, the bean will be called based on class name, not variable name.
In your case, you need to access the bean in you gsp as profile like so:
//variable in controller
def myProfile = new Profile()
//bean in views
<g:hasErrors bean="${profile}" field="name">
<g:message error="${profile.errors.getFieldErrors("name")}" />
</g:hasErrors>
If you need to call your bean with a specific name like myUser, just pass it in the model:
render (view:'editProfile', model:[myUser: myProfile])

Resources