I am using Taza, and I can not find a way to define page url.
I am looking at wiki, rdoc and source.
I have found that WatirCraft can do it, but I am not sure if it is not implemented in Taza, or if I am doing something wrong.
For:
require 'rubygems'
require 'taza/page'
module Ecs
class LoginPage < ::Taza::Page
url "login"
end
end
I get:
undefined method `url' for Ecs::LoginPage:Class
Charley Baker said page URL is not implemented in Taza.
Related
i try to make my first form validation in codeigniter4.For that i've create a controller with a function to check the post-vars. At the beginning, ci4 need to load the libary, so i do it like in the docu
$validation = \Config\Services::validation();
For this i recieve the following error.
...
message "Class 'Myth\\Auth\\Authentication\\Passwords\\ValidationRules' not found"
file "mypath/system/Validation/Validation.php"
function "loadRuleSets"
class "CodeIgniter\\Validation\\Validation"
function "run"
class "CodeIgniter\\Validation\\Validation"
....
What i do wrong, or is there something to setup for a new project before it works?
omg
i've found the problem. in the app/config autoload.php and validation.php was a class "Myth" wich is not in use. SO i commet it out and the thinks works fine.
Hi CodeceptJS Community,
Is there a way to use custom defined functions (under steps_file.js) as I. customFunction() in page object files.
Is there a way to use native codeceptjs functions (like I.click()) in my custom helper files
I couldn't find any help in the documentation and in other sources. Is there any way to achieve this?
And is there any way to use xpath locators in puppeteer helper?
this.helpers['Puppeteer'].page.click(xpath);
I had the same problem to use custom steps in pageObjects.
To avoid it, i passed the actor (I) as parameter to my pageObject function.
page object:
const I = actor();
module.exports = {
doSomething(I){
I.login();
}
};
Test scenario:
Scenario('Test something' (I,pageObject)=>{
pageObject.doSomething(I)
})
In this case, pageObjects will has access to all custom steps from I :)
Thank you for your sharing Matheus. I have used a different solution. Instead of writing "I" object in every page object method (which was also one option for me), I have created a custom helper file and written all methods using puppeteer helper like below;
async method() {
await this.helpers['Puppeteer'].click(xpath);
}
I can call this method both in tests and page objects
I.method();
I was facing the same issue and when I looked into the typescripts definitions I noticed that actor() which is required in every page object etc. has custom steps arguments.
So this worked for me to extend the const I = actor(); witht the custom steps form steps_file.js;
const customSteps = require('./steps_file');
const I = actor(customSteps());
After that, I can use all methods in page objects like in tests scenarios which are accessing the methods from steps_file.js
If I create my httpBuilder as shown below (assume that a proxyUsername IS set, so setCredentials is called), then calls to httpAddress-es that are passed in properly are routed through the proxy. However, the Application has some http calls that are within the local network. Can http.nonProxyHosts be used to work around this and bypass the Proxy? If so, how? Use System.setProperty? Or something on HttpBuilder?
HTTPBuilder httpBuilder = new HTTPBuilder(httpAddress)
httpBuilder.setProxy(webProxyHost, webProxyPort, webProxyProtocol)
if (proxyUsername) {
httpBuilder.client.getCredentialsProvider().setCredentials(
new AuthScope(webProxyHost, webProxyPort),
new UsernamePasswordCredentials(proxyUsername, proxyPassword))
}
}
In the code above, all of the various named elements (webProxyHost, etc) are declared as String and set accordingly.
In answer to the question in the above comment, our primary 'nonProxyHost' need was for 'localhost' which is there by default. Thus this ceased to be an issue. Did not ever really find out how to accomplish this as it is somewhat version-specific on HttpClient.
You can set the System property:
System.setProperty('http.nonProxyHosts', myNonProxyHosts)
However, if you call 'setProxy' on HttpBuilder, even if you call 'useSystemProperties' it will not. This is in their documentation, just not obvious!
Finally, you might be able to call:
httpBuilder.client.params.setParameter('http.nonProxyHosts', myNonProxyHosts)
But I do not know for sure if that is the property name and documentation of those properties is hard to find. Worse - those 'params' are deprecated - you are supposed to use the better 'config' classes, though once again finding comprehensive documentation on all the parameters for that is not the easiest! Wish I could have been of more help!
I am facing an issue in declaring a fucation in block which I have added . I am calling a function by including an file which ia placed in the theme. I have also tried it by placing out of the theme folder. The function is alredy being user in front page. But when I am using the same function in that block. The screen gets blank and nothing displays. some part of my block coding is written below. Please help me.
<?php
global $base_url;
include($_SERVER['DOCUMENT_ROOT']."/travellar/geoiploc.php"); // indluded file
$ip = "203.189.25.0"; // Australia IP test
$country_code = getCountryFromIP($ip, "code");
I've had no problems loading functions from modules into custom blocks, but I've never tried loading one from a theme before. It's not clear to me whether or not theme functions are loaded before the page content is loaded.
You might have to create a custom module or include file to hold the function. Check out the module_load_include() function for how to load a specific include file.
A custom module would be a good approach as it is loaded before the theme layer and can be accessed from almost anywhere in Drupal except other modules with a lower weight than the custom module. It is also likely to come in handy for hooks and other overrides.
However, if you must have it in the theme layer, another option is adding it to template.php of your theme which should make it available within page.tpl.php and such, but not blocks I don't believe.
/sites/all/modules/mymodule/mymodule.info
name = My Module
package = !
description = It is MY module, not yours!
core = 6.x
The package "!" will make this module appear at the top of the modules page
/sites/all/modules/mymodule/mymodule.module
<?php
// Load mymodule.morePHP.inc
module_load_include('inc', 'mymodule', 'mymodule.morePHP');
// A custom function
function mymodule_my_custom_function($args) {
/* do custom stuff here */
return 'output';
}
/sites/all/modules/mymodule/mymodule.morePHP.inc
<?php
// An included custom function
function mymodule_other_custom_stuff() {
}
I want to use some features for server-side javascript. I think prototype is checking the browser type, but of course node.js is not a browser. I get the following error:
$ node
> require('./prototype') ;
ReferenceError: navigator is not defined
at /home/guest/projects/javascript/prototype.js:14:5
at Object.<anonymous> (/home/guest/projects/javascript/prototype.js:23:4)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)
at Module.loadSync (node.js:338:12)
at loadModule (node.js:283:14)
at require (node.js:411:14)
at cwdRequire (repl:29:10)
at [object Context]:1:1
at Interface.<anonymous> (repl:96:19)
prototype.js is version 1.7, node.js is version 0.2.6
Prototype is written to be modular. This means you can use just the useful parts that extend Array and Class and Function (I love those bits!) and leave out the parts that deal with browser and DOM (the bits that are slow in IE and non-existent in node).
Start by going to https://github.com/sstephenson/prototype then pick out the desired parts from src/prototype/ and src/prototype/lang/.
I wish you luck on such a fascinating challenge.
Late answer, but I'm sure it can still be useful to some people:
https://github.com/Rixius/prototype.node.js
Few days ago, I did something like that myself, and realized it had already been done...
This repo is hard to find even with the github search.
If you have a look at the source of Prototype.js, it is tightly bound to the browser environment, which isn't provided by node (since it's not a web browser).
jsdom attempts to mock the browser environment, and has been used to successfully run JQuery on the server side. Your mileage may vary.
There is underscore.js especially for node.js, which implements most of Prototypes beloved functions:
Underscore is a utility-belt library for JavaScript that provides a lot of
the functional programming support that you would expect in Prototype.js.
Its faster as Prototype itself, because it does not extend any of the built-in JavaScript objects.
Due to this, the syntax is slightly different:
// prototype.js:
anArray.each(function(){ ... });
// underscore.js:
_ = require('underscore');
_.each(anArray, function(){ ... });
If your are looking for Prototypes String functions like trim, have a look at underscore.string