Skip to content

Commit

Permalink
fix plan and params
Browse files Browse the repository at this point in the history
  • Loading branch information
FranzPoize committed Feb 15, 2016
1 parent ce938fa commit 77c675d
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 18 deletions.
5 changes: 4 additions & 1 deletion app/scripts/components/account.components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export default class Account extends React.Component {
<h2 className="account-block-title side-tab-h2">My subscription</h2>
<div className="account-block-plan">
{(() => {
if (HoodieApi.instance.plan.indexOf('free_') > -1) {
if (!HoodieApi.instance.plan) {
return 'All privileges';
}
else if (HoodieApi.instance.plan.indexOf('free_') > -1) {
return 'Free plan';
}
else if (HoodieApi.instance.plan.indexOf('annual_') > -1) {
Expand Down
8 changes: 4 additions & 4 deletions test/Views/toggling.views.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module.exports = {
before: function(browser, done) {
browser
.init()
.waitForElementVisible('input#email-sign-in', 10000)
.setValue('input#email-sign-in',process.env.PROTOTYPO_LOGIN)
.waitForElementVisible('input#email-sign-in', 20000)
.setValue('input#email-sign-in', '[email protected]')
.setValue('input#password-sign-in', process.env.PROTOTYPO_PASS)
.click('input[type=submit]')
.pause(10000)
.waitForElementVisible('#dashboard', 10000, false, done);
.pause(20000)
.waitForElementVisible('#dashboard', 20000, false, done);
},
after: function(browser) {
browser.end();
Expand Down
10 changes: 5 additions & 5 deletions test/base.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ module.exports = {
'Test login': function(browser) {
browser
.init()
.waitForElementVisible('input#email-sign-in', 10000)
.setValue('input#email-sign-in',process.env.PROTOTYPO_LOGIN)
.waitForElementVisible('input#email-sign-in', 20000)
.setValue('input#email-sign-in','[email protected]')
.setValue('input#password-sign-in', process.env.PROTOTYPO_PASS)
.click('input[type=submit]')
.pause(2000)
.waitForElementVisible('#dashboard', 10000)
.waitForElementVisible('#dashboard', 20000)
.end();
},
'Test login fail': function(browser) {
browser
.init()
.waitForElementVisible('input#email-sign-in', 10000)
.waitForElementVisible('input#email-sign-in', 20000)
.setValue('input#email-sign-in', "[email protected]")
.setValue('input#password-sign-in', process.env.PROTOTYPO_PASS)
.click('input[type=submit]')
.pause(2000)
.waitForElementVisible('.warning-message', 10000)
.waitForElementVisible('.warning-message', 20000)
.end();
}
};
21 changes: 17 additions & 4 deletions test/baseUI/sidebar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module.exports = {
before: function(browser, done) {
browser
.init()
.waitForElementVisible('input#email-sign-in', 10000)
.setValue('input#email-sign-in',process.env.PROTOTYPO_LOGIN)
.waitForElementVisible('input#email-sign-in', 20000)
.setValue('input#email-sign-in', '[email protected]')
.setValue('input#password-sign-in', process.env.PROTOTYPO_PASS)
.click('input[type=submit]')
.pause(2000)
.waitForElementVisible('#dashboard', 10000, done);
.waitForElementVisible('#dashboard', 20000, done);
},
after: function(browser) {
browser.end();
Expand All @@ -27,9 +27,22 @@ module.exports = {
.click('div[name=help-panel]')
.waitForElementVisible('.help-panel', 2000);
},
'Should display profile' : function (browser) {
'Should display news feed' : function (browser) {
browser
.click('div[name=news-feed]')
.waitForElementVisible('.news-feed', 2000)
.end()
},
'Should display profile when kickstarter' : function (browser) {
browser
.init()
.waitForElementVisible('input#email-sign-in', 20000)
.setValue('input#email-sign-in', '[email protected]')
.setValue('input#password-sign-in', process.env.PROTOTYPO_PASS)
.click('input[type=submit]')
.pause(2000)
.waitForElementVisible('#dashboard', 20000)
.click('div[name=subscriptions]')
.waitForElementVisible('.account', 2000);
},
};
8 changes: 4 additions & 4 deletions test/baseUI/topbar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module.exports = {
before: function(browser, done) {
browser
.init()
.waitForElementVisible('input#email-sign-in', 10000)
.setValue('input#email-sign-in',process.env.PROTOTYPO_LOGIN)
.waitForElementVisible('input#email-sign-in', 20000)
.setValue('input#email-sign-in', '[email protected]')
.setValue('input#password-sign-in', process.env.PROTOTYPO_PASS)
.click('input[type=submit]')
.pause(10000)
.waitForElementVisible('#dashboard', 10000, false, done);
.pause(20000)
.waitForElementVisible('#dashboard', 20000, false, done);
},
after: function(browser) {
browser.end();
Expand Down
40 changes: 40 additions & 0 deletions test/subscriptionRights/params.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
'Should have access to all params': function(browser) {
browser
.init()
.waitForElementVisible('input#email-sign-in', 20000)
.setValue('input#email-sign-in', '[email protected]')
.setValue('input#password-sign-in', process.env.PROTOTYPO_PASS)
.click('input[type=submit]')
.pause(2000)
.waitForElementVisible('#dashboard', 20000)
.click('.controls-tabs-icon:nth-child(1)')
.pause(200)
.elements('css selector', '.sliders .slider', function(result) {
browser.assert.equal(result.value.length, 9);
})
.elements('css selector', '.sliders .slider.is-disabled', function(result) {
browser.assert.equal(result.value.length, 0);
})
.end();
},
'Should not have access to all params': function(browser) {
browser
.init()
.waitForElementVisible('input#email-sign-in', 20000)
.setValue('input#email-sign-in', '[email protected]')
.setValue('input#password-sign-in', process.env.PROTOTYPO_PASS)
.click('input[type=submit]')
.pause(2000)
.waitForElementVisible('#dashboard', 20000)
.click('.controls-tabs-icon:nth-child(1)')
.pause(200)
.elements('css selector', '.sliders .slider', function(result) {
browser.assert.equal(result.value.length, 9);
})
.elements('css selector', '.sliders .slider.is-disabled', function(result) {
browser.assert.equal(result.value.length, 7);
})
.end();
}
};

0 comments on commit 77c675d

Please sign in to comment.