This repository was archived by the owner on Sep 21, 2022. It is now read-only.
Suites for authenticated pages #799
Copy link
Copy link
Open
Description
Hey, guys. I'm starting writing regression tests for my application and gemini is awesome, but I have some problems with protected pages.
I want to authenticate user before the start gemini suite, but it's not working because functions executed in browser context.
gemini.suite('As authenticated user, I can see dasboard', (suite) => {
suite.setUrl('/dasboard')
.before(function(actions) {
actions.executeJS(function(window) {
helpers.asUser({ authenticated: true }).then(function({ token }) {
setCookie(window.document, TOKEN_COOKIE_NAME, token, {
expires: 7,
domain: TOKEN_COOKIE_DOMAIN,
});
window.authenticated = true;
});
});
actions.waitForJSCondition(function(window) {
return window.authenticated;
}, 120000);
})
.setCaptureElements('body')
.capture('1440x1024', function(actions) {
actions.setWindowSize(1440, 1024);
})
;
});How I can pass some variables and functions to browser context with gemini or may be exist another way to resolve my case?
Reacted by Daniel Salinas and Roman
Metadata
Metadata
Assignees
Labels
No labels
Activity
nbasov commentedon Jul 23, 2017
.beforewill be applied after specified url loading (before you set cookie). To handle that, you need to call this url once again. Here is working example (but for localStorage in my case):