-
Notifications
You must be signed in to change notification settings - Fork 169
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
feat(3266): functional tests for banner API #3273
Conversation
When they create new banner with message "Hello World" and "default" scope | ||
Then they can see that the banner is created with "default" scope | ||
And banner is "updated" when they update the banner with "message" "Some Random Message" | ||
And banner is "not updated" when they update the banner with "scopeId" "1234" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also ensure that scope
is immutable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
screwdriver/features/banner.feature
Line 25 in ffe197d
And banner is "not updated" when they update the banner with "scope" "PIPELINE" |
features/banner.feature
Outdated
|
||
Background: | ||
Given "calvin" is logged in | ||
# And "calvin" has Screwdriver admin permission |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check that only screwdriver admins can create/update banner?
# And "calvin" has Screwdriver admin permission | |
And "calvin" has Screwdriver admin permission |
features/banner.feature
Outdated
Then they can see that the banner is created with "pipeline" scope | ||
And banner is "updated" when they update the banner with "isActive" "false" | ||
And banner is "not updated" when they update the banner with "scope" "GLOBAL" | ||
Then banner is deleted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add scenarios to ensure, non-admins cannot create/update/delete banner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have such headless user right now for the purpose of this test. In order to achieve this, new user needs to be created, so asking that we test this manually as of now and I have verified that only admins can create banner.
features/banner.feature
Outdated
Then they can see that the banner is created with "pipeline" scope | ||
And banner is "updated" when they update the banner with "isActive" "false" | ||
And banner is "not updated" when they update the banner with "scope" "GLOBAL" | ||
Then banner is deleted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add tests for below scenario
- Non SD admin user, having access to pipeline repo can read pipeline banner
- Non SD admin user, not having access to pipeline repo cannot read that pipeline banner
- When one or more GLOBAL and PIPELINE banner exists, user can selectively get banners for a specific pipeline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sagar1312 - 1 and 2 scenarios will require a different user to login for testing purpose and we do not have such user handy right now, we need to create an extra user for this purpose. So asking to drop this request for now and do the tests manually, which I have done and ensured that only admin users can create banners.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sagar1312 - for item 3, I think you were referring to have a test to be able to filter banner by scope and scopeId, so I added a test for that.
screwdriver/features/step_definitions/banner.js
Lines 138 to 150 in ffe197d
Then(/^they can get the banner associated to that pipeline$/, { timeout: TIMEOUT }, function step() { | |
return request({ | |
url: `${this.instance}/${this.namespace}/banners?scopeId=${this.pipelineId}&scope=PIPELINE`, | |
method: 'GET', | |
context: { | |
token: this.jwt | |
} | |
}).then(resp => { | |
Assert.equal(resp.statusCode, 200); | |
Assert.equal(resp.body.length, 1); | |
Assert.equal(resp.body[0].scopeId, this.pipelineId); | |
}); | |
}); |
Co-authored-by: Dayanand Sagar <[email protected]>
Co-authored-by: Dayanand Sagar <[email protected]>
Context
The Banner API has been enhanced to support scope and scopeId in its payload, as implemented in the following PRs.
screwdriver-cd/data-schema#586
screwdriver-cd/models#639
Objective
To validate the functionality of the updated Banner API and ensure it performs as expected, we plan to introduce additional functional tests.
References
#3266
License
I confirm that this contribution is made under a BSD license and that I have the authority necessary to make this contribution on behalf of its copyright owner.