Working
- add tests casper JS
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
casper.test.comment('Testing login');
|
||||
|
||||
casper.start(thelia2_login_admin_url, function() {
|
||||
this.echo('\nLOGIN');
|
||||
this.test.assertTitle('Welcome - Thelia Back Office', 'Web page title OK');
|
||||
this.sendKeys('form[action*="checklogin"] input[name="thelia_admin_login[username]"]', 'thelia2');
|
||||
this.sendKeys('form[action*="checklogin"] input[name="thelia_admin_login[password]"]', 'thelia2');
|
||||
this.click('form[action*="checklogin"] input[type="submit"]');
|
||||
});
|
||||
|
||||
casper.wait(1000, function() {
|
||||
this.echo("\nWaiting....");
|
||||
});
|
||||
|
||||
casper.then(function(){
|
||||
this.echo('\nDASHBOARD');
|
||||
console.log('Now on : ' + this.getCurrentUrl());
|
||||
this.test.assertTitle('Back-office home - Thelia Back Office', 'Web page title OK');
|
||||
this.test.assertSelectorHasText('#wrapper > div', ' This is the administration home page. Put some interesting statistics here, and display useful information :) ', 'Web page main content OK');
|
||||
});
|
||||
|
||||
//RUN
|
||||
casper.run(function() {
|
||||
this.test.done();
|
||||
});
|
||||
@@ -22,5 +22,4 @@ php install/faker.php
|
||||
echo -e "\n\e[01;34m[INFO] Adding admin\e[00m\n"
|
||||
php Thelia thelia:create-admin --login_name thelia2 --password thelia2 --last_name thelia2 --first_name thelia2
|
||||
|
||||
# casperjs test ./exe --pre=./conf/local.js --direct
|
||||
|
||||
casperjs test ./tests/functionnal/casperjs/exe --pre=./tests/functionnal/casperjs/conf/local.js --direct
|
||||
@@ -28,13 +28,13 @@
|
||||
|
||||
{form_field form=$form field='username'}
|
||||
<span {if $error}class="error"{/if}>
|
||||
<input type="text" class="input" placeholder="{intl l='User name'}" name="{$name}" value="{$value}" {$attr} />
|
||||
<input type="text" id="username" class="input" placeholder="{intl l='User name'}" name="{$name}" value="{$value}" {$attr} />
|
||||
</span>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='password'}
|
||||
<span {if $error}class="error"{/if}>
|
||||
<input type="password" class="input" placeholder="{intl l='Password'}" name="{$name}" {$attr} />
|
||||
<input type="password" id="password" class="input" placeholder="{intl l='Password'}" name="{$name}" {$attr} />
|
||||
</span>
|
||||
{/form_field}
|
||||
|
||||
|
||||
27
tests/functionnal/casperjs/exe/10_login.js
Normal file
27
tests/functionnal/casperjs/exe/10_login.js
Normal file
@@ -0,0 +1,27 @@
|
||||
casper.test.comment('Testing login');
|
||||
|
||||
casper.start(thelia2_login_admin_url, function() {
|
||||
this.echo('\nLOGIN');
|
||||
this.test.assertTitle('Welcome - Thelia Back Office', 'Web page title OK');
|
||||
this.sendKeys('input#username', 'thelia2');
|
||||
this.sendKeys('input#password', 'thelia2');
|
||||
this.click('form[action*="checklogin"] button[type="submit"]');
|
||||
});
|
||||
|
||||
casper.wait(1000, function() {
|
||||
this.echo("\nWaiting....");
|
||||
});
|
||||
|
||||
casper.then(function(){
|
||||
this.echo('\nDASHBOARD');
|
||||
|
||||
console.log('Now on : ' + this.getCurrentUrl());
|
||||
// @todo implement dashboard
|
||||
// this.test.assertTitle('Back-office home - Thelia Back Office', 'Web page title OK');
|
||||
// this.test.assertSelectorHasText('#wrapper > div', ' This is the administration home page. Put some interesting statistics here, and display useful information :) ', 'Web page main content OK');
|
||||
});
|
||||
|
||||
//RUN
|
||||
casper.run(function() {
|
||||
this.test.done();
|
||||
});
|
||||
Reference in New Issue
Block a user