-
Notifications
You must be signed in to change notification settings - Fork 136
e2e tests for gallery card #163
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
15bc18b
Moved user service instance API and added service instance API
69bfe73
WIP e2e tests for gallery card
70290e9
make po more granular
5bce751
Use [].push.apply instead in service instance models list()
78b524d
added more discrete tests
7297287
Merge pull request #162 from hpcloud/200-itops-client-api-model
ongk 2c7add3
Unfix version for Bower
411cac1
Merge pull request #166 from hpcloud/update-versions
sean-sq-chen ca149bd
Adding db reset helper.
randyochoa 5418099
added timeout
82677e3
Fixing some nits from PR feedback.
randyochoa e4fd739
Merge pull request #167 from hpcloud/reset-db-e2e-tests
sean-sq-chen 02b2875
WIP e2e tests for gallery card
7e37161
make po more granular
4a0dc08
added more discrete tests
ae5191b
added timeout
3663f6e
added dbreset and connect logic
42fdad7
more cleanup
d2a1629
fixed some formatting in po
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| 'use strict'; | ||
|
|
||
| var helpers = require('./po/helpers.po'); | ||
| var galleryPage = require('./po/application-card-gallery.po'); | ||
| var registration = require('./po/service-instance-registration.po'); | ||
|
|
||
| describe('Application Gallery Page', function () { | ||
| beforeAll(function () { | ||
| helpers.setBrowserNormal(); | ||
| helpers.loadApp(); | ||
| helpers.resetDatabase(); | ||
| galleryPage.login(); | ||
| registration.connect(0); | ||
| browser.driver.sleep(1000); | ||
| registration.doneButton().click(); | ||
| }); | ||
|
|
||
| describe('content', function () { | ||
| describe('applications tab', function() { | ||
| it("should show the applications gallery", function() { | ||
| galleryPage.showApplicationsGallery(); | ||
| expect(browser.getCurrentUrl()).toBe('http://' + helpers.getHost() +'/#/cf/applications/list/gallery-view'); | ||
| }); | ||
| describe("and you click a card", function() { | ||
| it('should go to application detail', function () { | ||
| galleryPage.showApplicationDetails(); | ||
| expect(browser.getCurrentUrl()).toMatch(/summary$/); | ||
| }); | ||
| }) | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| 'use strict'; | ||
| var loginPage = require('./login-page.po'); | ||
|
|
||
| // Navbar helpers | ||
| module.exports = { | ||
| login : login, | ||
| showApplicationsGallery : showApplicationsGallery, | ||
| showApplicationDetails : showApplicationDetails | ||
| }; | ||
|
|
||
| function applicationGalleryCard() { | ||
| return element.all(by.css('application-gallery-card')).get(0) | ||
| .element(by.css('gallery-card')); | ||
| } | ||
|
|
||
| function applicationsGalleryButton() { | ||
| return element(by.css('navigation')) | ||
| .element(by.css('[href="#cf/applications/list/gallery-view"]')); | ||
| } | ||
|
|
||
| function showApplicationsGallery() { | ||
| applicationsGalleryButton().click(); | ||
| } | ||
|
|
||
| function showApplicationDetails() { | ||
| applicationGalleryCard().click(); | ||
| } | ||
|
|
||
| function login() { | ||
| var fields = loginPage.loginFormFields(); | ||
| var usernameField = fields.get(0); | ||
| usernameField.clear(); | ||
| usernameField.sendKeys('dev'); | ||
| fields.get(1).sendKeys('dev'); | ||
| loginPage.loginButton().click(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/app/api/serviceInstance/user/userServiceInstance.api.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| (function () { | ||
| 'use strict'; | ||
|
|
||
| /** | ||
| * @namespace app.api.serviceInstance.user | ||
| * @memberof app.api.serviceInstance | ||
| * @name user | ||
| * @description User service instance API | ||
| */ | ||
| angular | ||
| .module('app.api') | ||
| .run(registerUserServiceInstanceApi); | ||
|
|
||
| registerUserServiceInstanceApi.$inject = [ | ||
| '$http', | ||
| 'app.api.apiManager' | ||
| ]; | ||
|
|
||
| function registerUserServiceInstanceApi($http, apiManager) { | ||
| apiManager.register('app.api.serviceInstance.user', new UserServiceInstanceApi($http)); | ||
| } | ||
|
|
||
| /** | ||
| * @namespace app.api.serviceInstance.user.UserServiceInstanceApi | ||
| * @memberof app.api.serviceInstance.user | ||
| * @name UserServiceInstanceApi | ||
| * @param {object} $http - the Angular $http service | ||
| * @property {object} $http - the Angular $http service | ||
| * @class | ||
| */ | ||
| function UserServiceInstanceApi($http) { | ||
| this.$http = $http; | ||
| } | ||
|
|
||
| angular.extend(UserServiceInstanceApi.prototype, { | ||
| /** | ||
| * @function connect | ||
| * @memberof app.api.serviceInstance.user.UserServiceInstanceApi | ||
| * @description Connect a service instance | ||
| * @param {string} url - the service instance endpoint | ||
| * @returns {promise} A resolved/rejected promise | ||
| * @public | ||
| */ | ||
| connect: function (url) { | ||
| return this.$http.post('/api/service-instances/user/connect', { url: url }); | ||
| }, | ||
|
|
||
| /** | ||
| * @function disconnect | ||
| * @memberof app.api.serviceInstance.user.UserServiceInstanceApi | ||
| * @description Disconnect user from service instance | ||
| * @param {string} url - the service instance endpoint | ||
| * @returns {promise} A resolved/rejected promise | ||
| * @public | ||
| */ | ||
| disconnect: function (url) { | ||
| return this.$http.post('/api/service-instances/user/disconnect', { url: url }); | ||
| }, | ||
|
|
||
| /** | ||
| * @function list | ||
| * @memberof app.api.serviceInstance.user.UserServiceInstanceApi | ||
| * @description Returns a list of service instances for the user | ||
| * @returns {promise} A resolved/rejected promise | ||
| * @public | ||
| */ | ||
| list: function () { | ||
| return this.$http.get('/api/service-instances/user'); | ||
| }, | ||
|
|
||
| /** | ||
| * @function register | ||
| * @memberof app.api.serviceInstance.user.UserServiceInstanceApi | ||
| * @description Set the service instances as registered | ||
| * @param {array} urls - the service instance endpoints | ||
| * @returns {promise} A resolved/rejected promise | ||
| * @public | ||
| */ | ||
| register: function (urls) { | ||
| return this.$http.post('/api/service-instances/user/register', { | ||
| serviceInstances: urls | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| })(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think you need to add a
browser.driver.sleep(1000);after line 10 since there's a verify session step that uses a timeout.