Unable to recognize RETRY UNTIL definition - karate

I am trying to implement the retry until functionality in a feature.
Scenario: Send a valid request and verify response status = 200
Given path requestPath
And configure retry = { count: 10, interval: 5000 }
And retry until responseStatus == 200
When method get
However the step remains undefined in my ide. I have tried the following:
Updating to latest intelliJ Community 2018.3
invalidated cache and restarted intelliJ
uninstalled and reinstalled Cucumber for Java
verify Gherkin plugin installed.
verified test folder is marked as Test Sources root
tried using Karate 0.9.0.RC3
What else can I try to make the squiggly line go away?!?]1

Use the latest Karate 0.9.0 (final).

Related

How to provide an HttpClient to ktor server from the outside to facilitate mocking external services?

I am trying to provide an HttpClient from the outside to my ktor server so that I can mock external services and write tests, however I get this exception when I run my test:
Please make sure that you use unique name for the plugin and don't install it twice. Conflicting application plugin is already installed with the same key as `Compression`
io.ktor.server.application.DuplicatePluginException: Please make sure that you use unique name for the plugin and don't install it twice. Conflicting application plugin is already installed with the same key as `Compression`
at app//io.ktor.server.application.ApplicationPluginKt.install(ApplicationPlugin.kt:112)
at app//com.example.plugins.HTTPKt.configureHTTP(HTTP.kt:13)
at app//com.example.ApplicationKt.module(Application.kt:14)
at app//com.example.ApplicationTest$expected to work$1$1.invoke(ApplicationTest.kt:39)
at app//com.example.ApplicationTest$expected to work$1$1.invoke(ApplicationTest.kt:38)
and thats a bit unexpected to me because I am not applying the Compression plugin twice as far as I can tell. If I run the server normally and manually call my endpoint with curl then it works as expected. What am I doing wrong?
I added a runnable sample project here with a failing test.
sample project
official ktor-documentation-sample project.
The problem is that you have the application.conf file and by default, the testApplication function tries to load modules which are enumerated there. Since you also explicitly load them in the application {} block the DuplicatePluginException occurs. To solve your problem you can explicitly load an empty configuration instead of the default one:
// ...
application {
module(client)
}
environment {
config = MapApplicationConfig()
}
// ...

Missing config.json stencil CLI

I'm trying to do some work for a client, but cannot get their bigcommerce site running locally. I have installed stencil CLI (v3.1.1) and downloaded the theme from the bigcommerce dashboard (all files). from the root of the theme i ran "stencil init", then "npm i" and "stencil start".
when i run stencil start, it throws an error saying there's no config.json file.
this is the error i get
How do i generate the config.json file?
The only config file I see is config.stencil.json.
I have also tried running "stencil pull" in hopes that it would pull the config, but it throws another error: "not ok -- Error: Could not fetch active theme details for channel 1: Request failed with status code 404"
Stencil-cli version:
3.1.1
Node version:
12
NPM version:
6.14.15
OS:
mac big sur
Stencil 3.1.1 has been deprecated for some time now. I believe the current version is 3.8. As of 4 months ago, anything below 3.5 will not run (https://developer.bigcommerce.com/changelog#publications/required-stencil-cli-version-set-to-3-5-0).
If you don't have a config.json file in your project, you will need to get the one from the client's store. Try downloading their theme again. It should come through.
Edit: It is possibly the case that you need a new API token. Try making a new one for your store. Make sure the following scopes are set:
Themes: Modify
Settings & Information: Modify
Sites & Routes: Read-only (or Modify)
Documentation for creating a new API account: https://support.bigcommerce.com/s/article/Store-API-Accounts#creating

IntelliJ run vs running a jar, with a Springboot Kotlin, Multi module Gradle project with Social Oauth2

TL;DR: Why does everything run fine when started via IntelliJ, and why is it broken when call java -jar app.jar. And how do I fix this?
Alright, I have some issues with a backend I am trying to dockerize. I have an application created with Spring Boot (1.4.2.RELEASE) following the Spring Oauth (2.0.12.RELEASE) guide on their page. I follow the Gradle version, since I prefer Gradle over Maven. Also I am using Kotlin instead of Java. Everything is fine, I start via IntelliJ my backend with static front end, I can login via Facebook (and Google and Github), I receive a nice Principal witch holds al the information I need, and I can modify Spring Security to authorize and permit endpoints. So far so good.
Now for the bad part, when I run either ./gradlew clean build app:bootrun or ./gradlew clean build app:jar and run the jar via java -jar (like I will do in my Docker container), my backend comes up. My static front end pops up. Now I want to login via Facebook, I end up on the Facebook login page, I enter my credentials, and... nothing!
I end up back on my homepage, not logged in, no log messages that mean anything to me, just silence. The last thing I see in the log is:Getting user info from: https://graph.facebook.com/me
This Url will give me in my browser:
{
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "GV/58H5f4fJ"
}
}
When going to this URL via an IntelliJ start, it will give me credential details. Obviously something is going wrong, but I have no clue what. Especially since a run from IntelliJ works fine. There is some difference between how the jar is started, and how IntelliJ's run config works, but I have no clue where to search for what. I could post trace logging, or all my Gradle files, but perhaps thats too much info to put in 1 question. I will defenitly update this question if someone needs some more details :)
The structure outline of this project is as follows:
root:
- api: is going to be opensourced later, contains rest definitions and DTOs.
- core: contains the meat. Also here is included in the gradle file
spring-boot-starter, -web, -security, spring-security-oauth2, and some jackson stuff.
- rest: contains versioned rest service implementations.
- app: contains angular webjars amongst others, the front end, and
my `#SpringBootApplication`, `#EnableOAuth2Client`
and the impl of `WebSecurityConfigurerAdapter`.
Why does everything run fine when started via IntelliJ, and why is it broken using bootRun or the jar artefact. And how do I fix this?
I found it, the problem was not Multi module Graldle, Spring boot, or Oauth2 related. In fact it was due to a src set config of Gradle, where Java was supposed to be in a Java src set folder, and Kotlin in a Java src set folder:
sourceSets {
main.java.srcDirs += 'src/main/java'
main.kotlin.srcDirs += 'src/main/kotlin'
}
As Will Humphreys stated in his comment above, IntelliJ takes all source sets, and runs the app. However, when building the jar via Gradle, these source sets are stricter. I had a Java file in my Kotlin src set, which is no problem for IntelliJ. But the jar created by Gradle takes into account the source sets as defined in the build.gralde file, which are stricter.
I found my missing bean issue with the code below:
#Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return args -> {
System.out.println("Let's inspect the beans provided by Spring Boot:");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
};
}
The Bean I missed was called AuthenticationController, which is a #RestController, and kinda crucial for my authentication code.

Protractor UnknownError: Connection reset

I'm not able to run my test cases in protractor.
It opens chrome window, write data; in the URL section but then it crashes.
Did you know why I get this error?
Running "protractor:current" (protractor) task
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Session created: count=1, browserName=chrome
Exception thrown: Keeping the Selenium server alive
C:\Users\210080088\Documents\Github\performance-central\app\src\main\resources\static\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
var template = new Error(this.message);
^
UnknownError: Connection reset
I see you are using some sort or task runner like gulp or grunt.
Gulp:
You might be using https://github.com/mllrsohn/gulp-protractor
Update this to version 3.0.0 npm update gulp-protractor
Then update webdrivers using this task https://github.com/mllrsohn/gulp-protractor#protractor-webdriver example is in examples section of source
Grunt:
You might be using https://github.com/teerapap/grunt-protractor-runner
Update this to version 4.0.0 npm update grunt-protractor-runner
https://github.com/teerapap/grunt-protractor-runner#optionswebdrivermanagerupdate
Use this option to update your webdrivers each time the task is run
We just need to update the gulp plugins to latest version to support the Chrome54 & latest standalone Web-driver version
Update gulp-angular-protractor to version 0.2.0
npm update gulp-angular-protractor or
npm install gulp-angular-protractor#0.2.0 (in my case update didn't work)
Update gulp-protractor to version 3.0.0
npm update gulp-protractor
your gulp.js file should look like below & then you are good to go. let me know if you are still facing any issues. please excuse me if answer is not properly formatted.
var gulpAngularProtractor = require('gulp-angular-protractor');
gulp.task('e2e', function(callback) {
gulp.src(paths.tests)
.pipe((gulpAngularProtractor ({
configFile: 'protractor.conf.js',
args: [
'--suite', args.suite
],
})).on('error', function(e) {
console.log(e);
}).on('end', callback));
});
gulp.task('webdriver-update', gulpAngularProtractor .webdriver_update);
gulp.task('webdriver-standalone', ['webdriver-update'], gulpAngularProtractor .webdriver_standalone);
This is a known issue with new version of chrome > 54 , Have a look protractor#3639
to get Details on the same or try with chrome 53 or update webdriver-manager (which is not getting update you need to do it manually).

Selenium XHR ERROR: Response_Code = -1

I am using the newest version of Selenium RC and firefox 3.5 When I run my test from eclipse I get this error XHR ERROR: Response_Code = -1 Error_Message = Request Error.
Firefox and Selenium RC open up fine, it seems to try to connect to the remote site I want, but then firefox crashes, any ideas?
I'm pretty sure this is an issue fixed in trunk (and will come out in the pending 1.0.4 release). If you download 2.0a5, this includes a 1.0.x compatible Selenium server. You should be able to drop the -standalone JAR in place and have it work. If not, building from trunk is your next best bet.
Alternatively, you could try to modify the open command call. In dynamic languages, such as Ruby, this is fairly straightforward. open() takes a URL and a boolean as its values. You'll want to invert the logic for the second param (I think it's false by default, so you'll want true).