forked from juice-shop/juice-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
681d2d3
commit d2529a7
Showing
2 changed files
with
20 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -4,32 +4,39 @@ describe('/#/basket', function () { | |
|
||
protractor.beforeEach.login({email: '[email protected]', password: 'admin123'}); | ||
|
||
describe('challenge "accessBasket"', function () { | ||
describe('challenge "negativeOrder"', function () { | ||
|
||
it('should access basket with id from cookie instead of the one associated to logged-in user', function () { | ||
browser.executeScript('window.sessionStorage.bid = 2;'); | ||
it('should be possible to update a basket to a negative quantity via the Rest API', function () { | ||
browser.ignoreSynchronization = true; | ||
browser.executeScript('var $http = angular.injector([\'myApp\']).get(\'$http\'); $http.put(\'/api/BasketItems/1\', {quantity: -100});'); | ||
browser.driver.sleep(1000); | ||
|
||
browser.get('/#/basket'); | ||
browser.ignoreSynchronization = false; | ||
|
||
// TODO Verify functionally that it's not the basket of the admin | ||
var productQuantities = element.all(by.repeater('product in products').column('basketItem.quantity')); | ||
expect(productQuantities.first().getText()).toMatch(/-100/); | ||
}); | ||
|
||
protractor.expect.challengeSolved({challenge: 'accessBasket'}); | ||
it('should be possible to place an order with a negative total amount', function () { | ||
element(by.id('checkoutButton')).click(); | ||
}); | ||
|
||
protractor.expect.challengeSolved({challenge: 'negativeOrder'}); | ||
|
||
}); | ||
|
||
describe('challenge "negativeOrder"', function () { | ||
describe('challenge "accessBasket"', function () { | ||
|
||
xit('should be possible to put an item with negative price into the basket', function () { | ||
}); | ||
it('should access basket with id from cookie instead of the one associated to logged-in user', function () { | ||
browser.executeScript('window.sessionStorage.bid = 2;'); | ||
|
||
xit('should be possible to put an item with negative quantity into the basket', function () { | ||
}); | ||
browser.get('/#/basket'); | ||
|
||
xit('should be possible to place an order with a negative total amount', function () { | ||
// TODO Verify functionally that it's not the basket of the admin | ||
}); | ||
|
||
//protractor.expect.challengeSolved({challenge: 'negativeOrder'}); | ||
protractor.expect.challengeSolved({challenge: 'accessBasket'}); | ||
|
||
}); | ||
|
||
|