Need help how to use execute('scrollTo(0,500)') inside POM function, but it says execute is not a function - nightwatch

I am trying to create a function using execute to use inside POM
ForthStCheck:function(){
this.waitForElementPresent('body', 30000)
. execute('scrollTo(0,500)')

.click('#AlternativeSt')
.api.execute('scrollTo(0,500)')

Related

Gradle how to exclude 1 test file in a multi module project setup?

So we have a multi module project setup, with test all scattered in multiple modules, now we want to execute all of them but exclude 1 test file.
How could we achieve this?
I tried the following:
gradle test -PexcludeTests=*SpecificTests
but the tests get still executed.
for running a singular test I managed to fix it this way:
gradle :multi-module:test --tests '*SpecificTests'
but unfortunately the equivalent for executing all tests but 1 cannot be made with this.
Condition: we need a command we cannot use the testing filter
You can use a project property and define an optional exclude filter, which you can then use from the command line -PexcludeTests='*SpecificTests'.
test {
if (project.hasProperty('excludeTests')) {
exclude(project.property('excludeTests'))
}
}

Call function in a subfolder

Files structure:
main folder--main.go
|--Utils
inside Utils: Read-Words.go
So. I would like to use the functions inside Read-words.go in main.go.
How to achieve this?
On Read-Word.go set the package like parent folder on the top of file. So if that file on Utils folder. the package is Utils. Example :
package Utils
I suggest to give the folder name to not using a capital. Therefore your code like package utils . So, when you want to use the function on Read-Word.go, you could call the function like :
utils.<name_of_fuction>
Example :
utils.FindWord() // or etc

Use #Grab in Jenkins pipeline script

We are trying to use some custom helper functions from a .jar library in our Jenkinsfile. To achieve this, we want to use the #Grab annotation from groovy/grape. Our Jenkinsfile looks like this:
#Grab('com.company:jenkins-utils:1.0')
import com.company.jenkinsutils.SomeClass
pipeline {
...
}
When trying to run the pipeline, we get the following error message:
java.lang.RuntimeException: No suitable ClassLoader found for grab
I already tried specifying #GrabConfig(systemClassLoader = true), however to no success. I suppose is has to do with the pipeline scripts running in the sandbox mode? Is there any way to make this work?

Pass in a properties file as a command line argument

I have a test suite (jUnit, Selenium, Cucumber) Maven project.
I need to be able to run the tests from the command line, passing in different properties files as arguments to diversify the test cases. How can I do this?
I currently have a properties reader that has a path to a shared properties folder concatenated with a variable that holds the name of a given properties file. I'm wondering if that can be parameterized for use with a Maven command in the CLI?
I've been researching this for awhile and have found many questions that sound similar to what I'm trying to achieve, but none of the answers have been applicable to my situation/what I'm trying to do. Any advice, ideas, or resources given will be greatly appreciated.
You can simply pass java properties to Maven:
$ mvn clean test -Dmyproperty=some-property-file.properties
Then you can access the property in your test:
#Test
public void test() {
String propertyFile = System.getProperty("myproperty");
assertEquals("some-property-file.properties", propertyFile);
}

I want to run many SOAPUI project xmls using Gradle script, in Linux

I want to run the SOAPUI project xmls using Gradle script. The GRADLE script should read the project xmls from soapuiInputs.properties file and run automatically all. Please guide me step by step how to create Gradle script to run the SOAPUI projects in Linux server.
Note: We use SOAPUI version 5.1.2.
Probably the simple way is to call the SOAPUI testrunner directly from gradle as Exec task, like you can do from cli.
In gradle you can define the follow tasks (Note that I try it on windows but to do the same on linux as you ask simply you've to change the paths):
// define exec path
class SoapUITask extends Exec {
String soapUIExecutable = 'C:/some_path/SoapUI-5.2.1/bin/testrunner.bat'
String soapUIArgs = ''
public SoapUITask(){
super()
this.setExecutable(soapUIExecutable)
}
public void setSoapUIArgs(String soapUIArgs) {
this.args = "$soapUIArgs".trim().split(" ") as List
}
}
// execute SOAPUI
task executeSOAPUI(type: SoapUITask){
// simply pass the project path as argument,
// note that the extra " are needed
soapUIArgs = '"C:/location/of/project.xml"'
}
To run this task use gradle executeSOAPUI.
This task simply runs a SOAPUI project, however testrunner supports more parameters which you can pass to soapUIArgs string in executeSOAPUI task, take a look here.
Instead of this if you want to deal with more complex testing there is a gradle plugin to launch SOAPUI project, take a look on it here
Hope this helps,

Resources