You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
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){returnwindow.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?
The text was updated successfully, but these errors were encountered:
.before will 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):
gemini.suite('login', (suite) => {
suite.setUrl('/login')
.setCaptureElements('body')
.capture('plain', function (actions, elements) {
actions.executeJS(function (window) {
// set token for next suite
window.localStorage.setItem("token", "secret")
})
})
})
gemini.suite('main', (suite) => {
suite.setUrl('/')
.setCaptureElements('html')
.capture('plain')
});
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.How I can pass some variables and functions to browser context with
gemini
or may be exist another way to resolve my case?The text was updated successfully, but these errors were encountered: