Xamarin test recorder script when run manually does not work. - xamarin

i have the following script that is attached is recorded using Xamarin Test recorder . When i re run the same script manually it gives error for the index .
Test script :
public void NewTest2()
{
app.Tap(x => x.Class("FormsImageView").Index(6));
app.Tap(x => x.Id("button2"));
app.Tap(x => x.Class("CachedImageView").Index(3));
app.Tap(x => x.Class("EntryEditText"));
app.EnterText(x => x.Class("EntryEditText"), "9may client");
app.Tap(x => x.Text("Añadir"));
app.Tap(x => x.Class("CachedImageView").Index(8)); // this line
gives error
app.Tap(x => x.Text("Third Touch Point"));
app.Tap(x => x.Text("No"));
}
i can send the apk..but not finding option to attach a file.
Thanks .

If you open your Output view it should show an error ? Have you also tried changing your index manually ?
I had the same issue, I changed the index manually and everything worked

Related

How to Fix Client Error: file_get_contents(): in Cpanel with Laravel Project inside

i have problem when do seed in my laravel project in cpanel.
this is the errors
Client Error: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0
at vendor/kavist/rajaongkir/src/HttpClients/BasicClient.php:74
70▕
71▕ private function executeRequest(string $url): array
72▕ {
73▕ set_error_handler(function ($severity, $message) {
➜ 74▕ throw new BasicHttpClientException('Client Error: '.$message, $severity);
75▕ });
76▕
77▕ $rawResponse = file_get_contents($url, false, $this->context);
Please Someone help me
this is my LocationsTableSeeder.php
public function run()
{
$daftarProvinsi = RajaOngkir::provinsi()->all();
foreach ($daftarProvinsi as $provinceRow) {
Province::create([
'province_id' => $provinceRow['province_id'],
'nama' => $provinceRow['province'],
]);
$daftarKota = RajaOngkir::kota()->dariProvinsi($provinceRow['province_id'])->get();
foreach ($daftarKota as $cityRow) {
Kabupaten::create([
'province_id' => $provinceRow['province_id'],
'city_id' => $cityRow['city_id'],
'nama' => $cityRow['city_name'],
'type' => $cityRow['type'],
'postal_code' => $cityRow['postal_code'],
]);
}
}
}
It's a good practice to disable file_get_contents ability to open remote URLs (like the ones starting HTTP) on shared servers (that frequently use Cpanel) to avoid the download/injection of malicious scripts in your server.
Go to Cpanel PHP options and enable allow_url_fopen, as pointed by apokryfos, usually it's at Switch To PHP Options menu. Some providers will not allow this change via Cpanel and you might need to open a support ticket.
Usually, this option cannot be changed by ini_set or via the PHP script itself in any other way.

Argument 1 passed to UAParser\Parser::parse() must be of the type string, null given in laravel stats tracker

I installed this package but when I running php artisan migrate, I see this error:
In Parser.php line 35:
Argument 1 passed to UAParser\Parser::parse() must be of the type
string, null given, called in...
my code in config/database.php:
'tracker' => [
'driver' => 'tracker',
'host' => env('DB_HOST', '127.0.0.1'),
'database' => env('DB_DATABASE', 'forge'),
'strict' => false, // to avoid problems on some MySQL installs
],
what is the problem?
I think the above code must be wrong.
There is an issue in the package that needs fixing to be able to work. A quick workaround would be to set the user_agent manually by php if absent:
You can add the following at the beginning of your public\index.php temporarily:
if (!isset($_SERVER['HTTP_USER_AGENT']))
ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3');
I think there is an issue in the package that needs fixing to be able to work. The error occurs when composer dump-autoload runs.
So I edited the pragmarx\tracker\src\Support\UserAgentParser.php and edit the construct method.
Here is my code:
public function __construct($basePath, $userAgent = null)
{
$userAgent = $_SERVER['HTTP_USER_AGENT'];
if (!$userAgent && isset($_SERVER['HTTP_USER_AGENT'])) {
$userAgent = $_SERVER['HTTP_USER_AGENT'];
}
$this->parser = Parser::create()->parse($userAgent);
$this->userAgent = $this->parser->ua;
$this->operatingSystem = $this->parser->os;
$this->device = $this->parser->device;
$this->basePath = $basePath;
$this->originalUserAgent = $this->parser->originalUserAgent;
}
After that, I run composer dump-autoload my self.
NOTE: Of course when you run composer update or composer install this error occur again
Search for this file pragmarx\tracker\src\Support\UserAgentParser.php and add the line below at the start of construct method.
$userAgent = $_SERVER['HTTP_USER_AGENT'];

Elasticsearch NEST 5.x Search Query that is built dynamically

I have the following query that I build piecemeal/dynamically using "&=". Elasticsearch 5.x and Nest 5.x.
QueryContainer qfilter = null;
qfilter = Query<ClassEL>.Term(m => m.OrderID, iOrderID);
qfilter &= Query<ClassEL>
.Range(r => r
.Field(f => f.Distance)
.GreaterThan(100))
&&
.Query<ClassEL>.Term(t => t.Active, true);
var searchDes = new SearchDescriptor<ClassEL>()
.From(0)
.Size(10)
.Query(qfilter); <===== *** ERROR HERE ***
In Visual Studio, it shows the following error message tip:
Error: Cannot convert from 'Nest.QueryContainer' to 'System.Func<Nest.QueryContainerDescriptor<ClassEL>, Nest.QueryContainer>'
The problem is I can't get the searchDescriptor to accept the query I built. Examples online show Search + Query rolled into one which differs from what I'm trying to accomplish. Below is common example that I want to avoid:
var response = client.Search<Tweet>(s => s
.From(0)
.Size(10)
.Query(q =>
q.Term(t => t.User, "kimchy")
|| q.Match(mq => mq.Field(f => f.User).Query("nest"))
)
);
EDIT: Using the Andrey's answer works just fine. A problem arises however when I try to get the results back from the search query:
List<ClassViewEL> listDocuments = response.Documents.ToList();
Visual Studio doesn't highlight it as an error immediately, but during compile time has a problem:
error CS0570:
'Nest.ISearchResponse.Documents' is
not supported by the language
Debugging and choosing to IGNORE the above error works fine, the code executes just as expected no problems. However the compile time error will prevent code deployments. How can this error be fixed?
Solution to EDIT: One of my dependencies in my projects (Newtonsoft.Json.dll) were targeting an older version causing the error to appear. Cleaning the solution and rebuilding fixes it.
You should use Func<SearchDescriptor<ClassEL>, ISearchRequest> or pass descriptor in separate method. For example:
var queryContainer = Query<ClassEL>.Term(x => x.Field(f => f.FirstName).Value("FirstName"));
queryContainer &= Query<ClassEL>.Term(x => x.Field(f => f.LastName).Value("LastName"));
Func<SearchDescriptor<ClassEL>, ISearchRequest> searchFunc = searchDescriptor => searchDescriptor
.Index("indexName")
.Query(q => queryContainer);
var response = _client.Search<ClassEL>(searchFunc);
or like this
ISearchRequest ExecuteQuery(SearchDescriptor<ClassEL> searchDescriptor, QueryContainer queryContainer)
{
return searchDescriptor.Index("indexName")
.Query(q => queryContainer);
}
public void GetResults()
{
var queryContainer = Query<ClassEL>.Term(x => x.Field(f => f.FirstName).Value("FirstName"));
queryContainer &= Query<ClassEL>.Term(x => x.Field(f => f.LastName).Value("LastName"));
var response = _client.Search<ClassEL>(s => ExecuteQuery(s, queryContainer));
}

Hybridauth + composer: how to add custom providers

I'm converting a php project to use composer as dependency manager.
The dependencies are loaded via this line in my main script.
require 'vendor/autoload.php';
One of these dependencies is hybridauth (version 2.9). Since using Composer, it throws 'file not found' errors when looking for custom providers files.
For instance, my main controller calls Hybrid like this:
$config_file_path = dirname(__FILE__) .'/hybridauth/config.php';
$hybridauth = new Hybrid_Auth( $config_file_path );
Now, here is the config file. The provider i'm using is "Facebooktest".
Note that I had to specify the path via the [wrapper][path]; array key to get to the next error message.
return
array(
"base_url" => WWWROOT."/auth",
"providers" => array(
"Facebook" => array(
"enabled" => true,
"keys" => array("id" => "xxxxxxx", "secret" => "xxxxxxxx"),
"scope" => "email",
"trustForwarded" => false
),
"Facebooktest" => array(
"enabled" => true,
"keys" => array("id" => "xxxxxxx", "secret" => "xxxxxx"),
"scope" => "email",
"trustForwarded" => false,
"wrapper"=> array(
"class"=>'Hybrid_Providers_Facebooktest',
"path"=> './controllers/hybridauth/Hybrid/Providers/Facebooktest.php'
)
)
),
"debug_mode" => false,
"debug_file" => "",
);
The error message (with trace):
require_once(/path/to/composer-project/vendor/hybridauth/hybridauth/hybridauth/Hybrid/thirdparty/Facebook/autoload.php): failed to open stream: No such file or directory
[vendor/bcosca/fatfree/lib/base.php:2174] Base->error()
[controllers/hybridauth/Hybrid/Providers/Facebooktest.php:61] Base->{closure}()
[controllers/hybridauth/Hybrid/Providers/Facebooktest.php:61] require_once()
[vendor/hybridauth/hybridauth/hybridauth/Hybrid/Provider_Model.php:99] Hybrid_Providers_Facebooktest->initialize()
[vendor/hybridauth/hybridauth/hybridauth/Hybrid/Provider_Adapter.php:101] Hybrid_Provider_Model->__construct()
[vendor/hybridauth/hybridauth/hybridauth/Hybrid/Auth.php:278] Hybrid_Provider_Adapter->factory()
[vendor/hybridauth/hybridauth/hybridauth/Hybrid/Auth.php:230] Hybrid_Auth::setup()
[controllers/auth-action.get.php:19] Hybrid_Auth::authenticate()
I find it strange that I now need to modify paths inside the "vendor/hybridauth/" project. It defeats the purpose of using a dependency manager. Surely, I must be doing it wrong.
Can you advise?
Check my answer to another question here
If you have recently installed Hybridauth through composer you probably have downloaded v2.9.2, which contain a bug in their Facebook class that replace the vendor path from yours to hybridauth/vendor, causing such issue.
I suspect you created that Facebooktest class by copying their Facebook class and therefore sustained that error. Either update to their dev branch and copy that Facebook class, or simply use other provider class as template for your custom provider class.

puppet notify Exec doesn't working

Here is my code, don't worry about variable which is already set in original code. I am just putting small snippet here to show you what its doing. Following code updating file /etc/sysctl.d/pgsql.conf but not triggering notify or Exec to reload file. what is wrong here?
$sysctl_config = "/etc/sysctl.d/pgsql.conf"
exec { 'update_sysctl_shmall':
unless => "grep -q ^kernel.shmall ${sysctl_config}",
command => "/bin/echo \"kernel.shmall = ${shmall}\" >> ${sysctl_config}",
}
file { '/etc/sysctl.d/pgsql.conf':
ensure => present,
notify => Exec['reload_sysctl']
}
exec { 'reload_sysctl':
provider => shell,
command => '/bin/sysctl --system',
logoutput => 'on_failure',
refreshonly => true,
}
The following code:
file { '/etc/sysctl.d/pgsql.conf':
ensure => present,
notify => Exec['reload_sysctl']
}
only ensures that /etc/sysctl.d/pgsql.conf file exists. If the file exist it will do nothing, that's why Exec was not triggered to reload the file.
Please check the following links about notifications in puppet 1,2.
UPDATE:
Consider using audit metaparemeter:
file { '/etc/sysctl.d/pgsql.conf':
audit => 'content',
ensure => present,
notify => Exec['reload_sysctl']
}

Resources