-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
could not run test sequentially #562
Comments
Frisby tests cannot be run sequentially, and your test suite should never depend on the order of tests that are run. If there is setup you need to do for each successive test in your suite, you have a few options. You can use // Define your helper function
function withTokenAuth(spec) {
const token = '123abc';
return spec.setup({
request: {
headers: {
'Authorization': 'Bearer ' +token,
'header':'value'
}
}
});
}
it('make call USING GLOBAL SETUP' , function() {
console.log('########### In IT call ###########')
return frisby
.use(withTokenAuth) // USE the `withTokenAuth` function here in your test (and in every test you need it in)
.post('url/call',
{
// json body
})
.expect('status', 200);
}); You can also just use the |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
@vlucas can you please provide your input on this. |
HTTP status |
@vlucas when I am passing token as the hard coded value and calling postCall (url,body) with .inspectRequestHeaders() it works and shows me correct headers getting passed |
Is there issues with |
@vlucas can you please provide you thought on this. |
@H1Gdev if you check my comment above getToken() works fine and returns me token. |
Can you dump the request headers so we can see what is actually being sent? 415 is a response from your server, and we cannot debug that or provide support for it. Also:
|
This comment has been minimized.
This comment has been minimized.
Please paste each code. |
This comment has been minimized.
This comment has been minimized.
We cannot debug your server response for you. This is not a free support forum. I am closing this issue for now. You can re-open it If you can give us code for both server and client in an isolated and reproducible way that proves the issue with the Frisby library itself, then we can help with a fix. Otherwise, we cannot spend any more time on this issue. |
I can't understand this code:confused: |
This comment has been minimized.
This comment has been minimized.
I don't know how to give advice because the code is incomplete like this... |
This comment has been minimized.
This comment has been minimized.
We need both the client and server code to help you. We need an independent code repository that we can clone and run that has both the server and frisby tests for it. One test that shows where it is working. You have all the code and the full context so it might be clear to you, but it is not clear at all to us. We need something isolated and reproducible in order to help you. |
It's no good returning async function getToken(URL) {
return frisby
.setup
({
request:
{
headers:
{
'Authorization': 'Basic ' + Buffer.from("usrname:pwd").toString('base64'),
'ouc_header':'admin',
'Content-Type': 'application/scim+json'
}
}
})
.get(apiURL)
.inspectResponse()
.inspectRequestHeaders()
.expect('status', 200)
.then(res => {
var token=res._token; // Can you really get it with this ???
console.log(token);
return token;
});
} const instance_token= await getToken(url); But first, it's better to understand Promise of JavaScript. |
I am facing problem in running tests which are like
The text was updated successfully, but these errors were encountered: