CircleCI e2e tests fail with Stripe script - selenium

CircleCI tests are giving
Too long with no output (exceeded 10m0s): context deadline exceeded
This seems to be caused in our case by a newly introduced Stripe script which stalls Selenium.

Following the GitHub link at the top here led us to an awareness of Advanced Fraud Detection and the ability to disable it. Loading the script via pure if tests don't hit relevant page or disabling Advanced Fraud Detection in testing env resolves timing out tests.
import {loadStripe} from '#stripe/stripe-js/pure';
loadStripe.setLoadParameters({advancedFraudSignals: false});
const stripe = await loadStripe('pk_test_TYooMQauvdEDq54NiTphI7jx');
<script src="https://js.stripe.com/v3/?advancedFraudSignals=false"></script>
https://stripe.com/docs/disputes/prevention/advanced-fraud-detection#disabling-advanced-fraud-detection

Related

Selenium WebDriver Firefox Error: API Rate limit exceeded. You have to add GH_TOKEN

Using the sample test code from SeleniumHQ github, I tried to run this code:
def test_firefox_session():
service = FirefoxService(executable_path=GeckoDriverManager().install())
driver = webdriver.Firefox(service=service)
driver.quit()
The test resulted as a failed test, with the error:
ValueError: API Rate limit exceeded. You have to add GH_TOKEN!!!
The test cases for Chrome and Edge browsers were successful.
Any help is much appreciated, preferably using webdriver-manager
Versions:
Selenium: 4.1.5
webdriver_manager: 3.7.0
python: 3.10
Firefox: 100.0
Firefox drivers are stored in Github. A GitHub has a rate limit for API calls, so to increase these limits you have to provide a Github token. See more info here https://github.com/SergeyPirogov/webdriver_manager#gh_token
You need to generate a github token and then pass it to .env. More details are inside the webdriver_manager repository https://github.com/SergeyPirogov/webdriver_manager#gh_token

SAUCE_CONFIG_PATH is not working for me in testcafe-browser-provider-saucelabs

I am trying to use testcafe-browser-provider-saucelabs.
My tests can successfully connect to SauceLabs and run there, but testcafe creates a unique sauceconnect tunnel, whereas I need to use a shared tunnel. Also, screenResolution is not being picked up from sauceLabsConfig.json file.
I have saucelabs credentials set as environment variables.
I am launching tests using these commands:
export SAUCE_JOB="Regression Job"
export SAUCE_BUILD="Build 1"
export SAUCE_CONFIG_PATH="./sauceLabsConfig.json"
testcafe saucelabs:chrome tests/
I created a sauce config JSON file:
{
"parentTunnel": "PARENT_TUNNEL",
"tunnelIdentifier": "qa",
"screenResolution": "1920x1080"
}
Why is my SAUCE_CONFIG_PATH variable not working?
At present, not all SauceLabs options are supported for the 'testcafe-browser-provider-saucelabs'. For example, the tunnelIdentifier option is not supported. I've created an issue in the browser provider repository. Track it be informed about the progress.
Note that this issue seems to be fixed, per this pull request:
https://github.com/DevExpress/saucelabs-connector/pull/33
...and integrated in to testcafe 1.14.0:
https://github.com/DevExpress/testcafe/tree/v1.14.0

Integration tests in golang - how to test the link between the router and the http.Handlers?

I've been tinkering around with golang and I try to implement a little todo application which should grow with the time. My thoughts about the applications architecture are the following:
The main package sets up the server and integrates the "services/handler" of the other packages in it's router under the corresponding path prefixes.
Every "service" has its own handlers and routes them correctly
So I've started just with the main package and wrote some todo handlers. To test the API I've written some integration tests (request/response). Now, I've removed the todo logic from the main package into it's own. When I execute go test -cover it shows me just the coverage of the main.go, but not for the todo package. That leads me to the conclusion that each package has to test on it's own.
So I have not to test the API in the main package but the integration, that '/todos' ends up in the todo package and nothing more, is that right? How can I test that? And in the todo package I have to test:
The routing in the package
And with a response recorder the API implementation
Is that right too? So how can I test the routing on it's own? Is that possible?
Here is my git repository:
https://github.com/fvosberg/mrsjenkins
Thanks in advance

Can I run Durandal's Tests Framework outside of PhantomJS?

The Durandal Test Framework runs Jasmine tests within PhantomJS.
Where I'm implementing this for the first time I'm getting a lot of errors, and reading through these on the command prompt is proving to be very tedious.
If I load up the spec.html file in my web browser, it tells me that no specs were found:
Yet PhantomJS is able to find the specs with no problem:
Is there a way I can configure these Jasmine tests to run through my web browser and not through (or as well as) PhantomJS?
I've set up a new index.html file and have replaced the var runTests = ... section with a simple require() call:
require(['../test/specs/system.spec.js']);
Durandal's system.spec.js file is loaded in the browser, but Jasmine is still stating that no specs were found.
Jasmine's tests weren't being run because I wasn't telling it to re-execute. The solution to this was to simply re-execute by calling this within the require callback:
require(['../test/specs/system.spec.js'], function() {
jasmine.getEnv().execute();
});
Note: A drawback of this is that the 'no specs found' bar is still present and the 'raise exceptions' control on the re-executed specs doesn't appear to function:

AngularJS : e2e tests with Karma Scenario Test Runner using cached source?

I am trying to set up some AngularJS e2e tests with Karma Scenario Test Runner. I did some modifications to the source files, but Karma doesn't seem to use these latest versions when testing.
In the source files, I added ids to some elements. Karma still couldn't find them, so I added a pause in the e2e test, so that I can mark and "Inspect elements" (using Chrome) on the current page in the test runner. The source code seems correct, except the latest changes are missing, i e, the ids aren't there. So what's happening here? Do I need to explicitly tell Karma the files have been updated somehow?
You can fix this issue by forcing angularjs to clear the application cache:
app.run(function($rootScope, $templateCache) {
$rootScope.$on('$viewContentLoaded', function() {
$templateCache.removeAll();
});
});
In Chrome developer tools settings, check "Disable cache (while DevTools is open)".
Obviously, this is a much more general issue than Angular's e2e test runner, but I decided to leave it here for now, in case somebody else has the same question.