Undefined step error even though step is defined - python-behave

I have the following BDD given statement in landing.py file
use_step_matcher("re")
#given(u'that I land on the (page_name) landing page with the correct offer id (?:start network traffic)')
My feature file is as follows:
Scenario : DR lil page end2end test starting with utm parameters
Given that I land on the "google page" landing page with the correct offer id start network traffic
When I try to run it says undefined step
I am using the step matcher "re" and the text "start network traffic" in my given statement is optional. Why is it failing

try
#given(u'that I land on the {page_name} landing page with the correct offer id (?:start network traffic)')

Related

How to transalte messages that comes from server in react native app

I'm building a react-native app with spanish as default language, the problem is that I'm using a open source backend service to serve data and this data comes is in english by default. What I want is to transalate this data/messages that comes from server in my react-native app to show to the user the messages in spanish not in english.
This is the first time I am doing this process and it is not clear to me what are the steps or the flow that is generally followed for this kind of proces(translate messages that comes from server in my app).
You have many approaches to such a thing one comes to mind is
Catch the error/api response message which mostly server error messages comes in codes and messages.
set a condition statement if code equal 2 that means the server is down for example
Example:
You made a request to the server and there was an error with the server let say wrong username and password, now the server returns a message and a error code you have to get the code or the message and show your own message
.....made the request the server returned
{ code: 192, message: Wrong username/Password }
now in your code you will do the following
if(code == 192){
...do your message
}
P.S this is just on top my head since you didn't share any codes or responses from your server.
UPDATE :
If you want to translate all your strings/messages that comes from the server you would need to do another approche something like this
Create a file contain all the strings/codes from the server
compare messages/code comes from the server and the file will return the text you want
{ "102": "Hola", "103": "Bien", "104": "Nada", "105": "Si", }
now this file contain the error/message code all you have to do is when you receive the code grab the message from this file
let translation = {
"101": "Hola",
"102":"Si"
};
translation["102"]; // Result will be Si
Now this is the most accurate approach but you have to know all the messages/codes comes from the server, now if you want something to translate on the fly you might wanna use translation library and may not be accurate translation

What to do about "transaction nonce too high" errors in RSK?

I have a decentralised application deployed on RSK, and has been working for several months. Everything works correctly using the public node,
however infrequently, we start getting a totally random error:
Unknown Error: {
"jsonrpc": "2.0",
"id": 2978041344968143,
"error": {
"code": -32010,
"message": "transaction nonce too high"
}
}
There is no information about “too high” nonces but many threads about “too slow”. I’m using web3.Contract.method.send().
In Metamask, ensure you are on your dev/test account then:
1 click on the avatar circle top right
2 In the menu, choose Settings
3 Click Advanced
4 Scroll down a bit, make sure again you are on your testnet account, click Reset Account
There is a limit on the number transactions the same address can have on the transaction pool.
This limit is 4 for RSK,
and is defined within TxValidatorNonceRangeValidator
within the rskj code base:
BigInteger maxNumberOfTxsPerAddress = BigInteger.valueOf(4);
Note that Ethereum has a similar limit,
but the limit that is configured in geth is 10.
So if we have already sent 4 transactions, that have not been mined yet, and send a 5th transaction before the next block is mined, it will get an error that the nonce is too high. If a block was mined and it had let's say all 4 of the transactions, then we would be able to add up to 4 transactions for the next block.
Workarounds
(1) Send no more than 4 transactions from an address, until there is a new block.
(2) Aggregate all of the calls and then use a contract that executes them in a single go.
An example of this is seen in
RNS Batch Client ExecuteRegistrations.
For me it happened when i restarted the node, following instruction fixed it:
Open up your MetaMask window and click on the icon in the top right to
display accounts. Go to Settings, then Advanced and hit Reset Account.

IBMQProvider issue

I successfully installed and ran a couple of circuits on a backend the other day (essex).
Everything was ok, results came up, but the next day, once I wanted more QC, I could not manage to get a provider.
I have looked into my account (active), looked into the package (up-to-date), and a new file in the project. I also already disabled and enabled the account without problems, but I keep having this error.
Code
from qiskit import IBMQ
IBMQ.active_account()
IBMQ.providers()
provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')
and I get:
>~/my_environment_name/lib/python3.7/site-packages/qiskit/providers/ibmq/ibmqfactory.py in get_provider(self, hub, group, project)
425 raise IBMQProviderError('No provider matches the specified criteria: '
426 'hub = {}, group = {}, project = {}'
--> 427 .format(hub, group, project))
428 if len(providers) > 1:
429 raise IBMQProviderError('More than one provider matches the specified criteria.'
IBMQProviderError: 'No provider matches the specified criteria: hub = ibm-q, group = open, project = main'
I would like to know where I am wrong, I look forward to keep learning thru the backends efficiently.
Thank you in advance
This means that there is no provider that matches all the criteria you specified, so in that hub, group and project. This could be because your account hasn't loaded correctly, so check to see if anything is returned from IBMQ.providers(). If there isn't anything load your account using IBMQ.load_account(). The other issue could be that there are genuinely no backends that meet those criteria, so try running IBMQ.get_provider() instead.
Try to use API token to enable your IBMQ account.
from qiskit import IBMQ
provider = IBMQ.enable_account("your-api-key") # We load our account
provider.backends() # We retrieve the backends to check their status
for b in provider.backends():
print(b.status().to_dict())
Create IBM Quantum account if you don't have one, then use the API token that available in the dashboard as enable_account() method argument to resolve this issue.
For More: https://quantum-computing.ibm.com/lab/docs/iql/manage/account/ibmq
https://quantum-computing.ibm.com/
https://www.ibm.com/account/reg/us-en/signup?formid=urx-19776&target=https%3A%2F%2Flogin.ibm.com%2Foidc%2Fendpoint%2Fdefault%2Fauthorize%3FqsId%3D70b061b4-7c64-4545-a504-a8871f2d414f%26client_id%3DN2UwMWNkYmMtZjc3YS00

Getting a invalid bug ID error when tried to link a defect to a test case using and external bug tracking tool “Instabug”

I was integrating an external bug tracker tool “Instabug” to Kiwi but when i tried to link a bug to the test case it shows invalid bug ID error.
For setting up the external bug tracking tool i performed the following steps:
ADMIN -> Everything Else -> TEST Cases -> Bug Trackers -> Add Bug Tracker -> Filled all the Details -> Save.
The fields which i am not sure about whether i filled them correct or not are :
(a) URL format string : https%3A%2F%2Fdashboard.instabug.com%2Fapplications%2FProjectname%2Fbeta%2Fbugs
(b) RegExp for ID validation : ^\d$
I am not sure whether the connection is established between Kiwi and Instabug.
I expect to know what are the correct values of
(a) URL format string
(b) RegExp for ID validation
and if i entered the wrong or right value in the bug tracker detail then it should show the connection with the bug tracker is established or not.
Also i am not sure if i have to make any changes in the “Instabug" site?
Kindly help me with the setup of “Instabug” with Kiwi.
a) Did you set Type to LinkOnly?
b) Connection status with tracker is not yet present - see https://github.com/kiwitcms/Kiwi/issues/97
c) Post relevant docker container logs.

Keeping same session, 1 single browser

The title of the question may be irrelevant to what I am trying to find out. My goal is to write a test that will
A) login to Hotmail
B) Delete the junk mail in my junk folder.
Design wise I have created 2 separate test classes. TestSignInPage1.class is only testing the user login part which is working and passed.
TestJunkFolderDelete.class will go to junk mail folder and do the deletion. I understand I simply can’t use the junk delete test on its own, a user 1st needs to login to the account so I called the TestSignInPage1 class in the junk folder.
#Test
public void testJunk(){
//The part below will get my login credential from TestSignPage class
TestSignInPage1 t= new TestSignInPage1();
t.testPage1();
//The following part will handle junk folder clean operation
WebDriver driver=br.openBrowser("firefox", "https://outlook.live.com/owa/?realm=hotmail.com&path=/mail/junkemail");
JunkMail jm= PageFactory.initElements(driver, JunkMail.class);
jm.doJunkClean();
Problem: Once the login part has been executed, the junk folder delete test opens up another new browser and again asks for login information.
Question: In professional world how would you tackle this (i.e.: you will have 1 test only, is there a way to keep the same session 1 browser) etc?

Resources