prevent redirect to login page after login

stable
Juanfran 2015-10-26 12:50:36 +01:00
parent d97d1336c2
commit 351d0ea78b
4 changed files with 52 additions and 12 deletions

View File

@ -434,7 +434,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
$lightboxService.closeAll()
$location.path($navUrls.resolve("error"))
$location.replace()
else if response.status == 401
else if response.status == 401 and $location.url().indexOf('/login') == -1
nextUrl = encodeURIComponent($location.url())
$location.url($navUrls.resolve("login")).search("next=#{nextUrl}")

View File

@ -70,6 +70,9 @@ exports.config = {
return url === browser.params.glob.host;
});
}, 10000)
.then(function() {
return utils.common.closeJoyride();
})
.then(function() {
return browser.getCapabilities();
}).then(function (cap) {

View File

@ -25,9 +25,45 @@ describe('auth', function() {
expect(browser.getCurrentUrl()).to.be.eventually.equal(browser.params.glob.host);
});
describe('page without perms', function() {
let path = 'project/project-4/';
before(function() {
browser.actions().mouseMove($('div[tg-dropdown-user]')).perform();
$$('.dropdown-user li a').last().click();
});
it("redirect to login", async function() {
browser.get(browser.params.glob.host + path);
expect(browser.getCurrentUrl()).to.be.eventually.equal(browser.params.glob.host + 'login?next=' + encodeURIComponent('/' + path));
});
it("login redirect to the previous one", async function() {
$('input[name="username"]').sendKeys('admin');
$('input[name="password"]').sendKeys('123123');
$('.submit-button').click();
expect(browser.getCurrentUrl()).to.be.eventually.equal(browser.params.glob.host + path);
});
});
describe("user", function() {
var user = {};
before(function() {
utils.common.login('admin', '123123');
});
it("logout", async function() {
await utils.common.login('admin', '123123');
browser.actions().mouseMove($('div[tg-dropdown-user]')).perform();
$$('.dropdown-user li a').last().click();
expect(browser.getCurrentUrl()).to.be.eventually.equal(browser.params.glob.host + 'login');
});
describe("register", function() {
it('screenshot', async function() {
browser.get(browser.params.glob.host + 'register');
@ -126,19 +162,12 @@ describe('auth', function() {
});
});
describe("", function() {
it("logout", async function() {
await utils.common.login(user.username, user.password);
browser.actions().mouseMove($('div[tg-dropdown-user]')).perform();
$$('.dropdown-user li a').last().click();
expect(browser.getCurrentUrl()).to.be.eventually.equal(browser.params.glob.host + 'login');
describe("accout", function() {
before(function() {
utils.common.login(user.username, user.password);
});
it("delete account", async function() {
await utils.common.login(user.username, user.password);
it("delete", async function() {
browser.get(browser.params.glob.host + 'user-settings/user-profile');
$('.delete-account').click();

View File

@ -383,3 +383,11 @@ common.uploadImagePath = function() {
return path.resolve(process.cwd(), 'e2e', browser.params.glob.attachments.unixImg);
}
};
common.closeJoyride = function() {
browser.waitForAngular();
$('.introjs-skipbutton').click();
browser.sleep(200);
};