.setURL of parent test is ignored when child test runs
When reporting a bug, make sure you provide all required info below. Reports without this information may be closed.
Output of gemini --version:
C:\Users\vkotulskyi\Projects\tiscommandcenter>gemini --version
4.18.1
...
Contents of .gemini.yml file:
rootUrl: 'http://localhost:9000'
gridUrl: 'http://127.0.0.1:4444/wd/hub'
windowSize: 1900x1080
browsers:
chrome:
sessionsPerBrowser: 3
desiredCapabilities:
browserName: chrome
Test source code:
let tests = [
{name: 'login', url: '/#/locations/6071/', element: 'body', login: true},
{name: 'login-body', url: '/#/locations/6071/equipment/22654267/chart/792', element: '#chartArea', login: false}
];
gemini.suite('chart', function(suite) {
suite
.setUrl('/#/login')
.before(function(actions, find) {
actions.executeJS( function(window) {
alert(window.location);
});
actions.wait(5000);
actions.waitForElementToShow('input[name="login"]', 1500);
actions.sendKeys(find('input[name="login"]'), 'ccbxce');
actions.waitForElementToShow('input[name="password"]', 1500);
actions.sendKeys(find('input[name="password"]'), 'Shbyfrekmxb7$$$');
actions.click(find('.login-button>button'));
actions.waitForElementToShow('.account', 5000);
});
for (let test of tests){
gemini.suite(test.name, function (child) {
child
.setUrl(test.url)
.before(function(actions, find) {
actions.executeJS( window => {
console.log(window.location);
});
actions.waitForElementToShow(test.element, 5000);
})
.setCaptureElements(test.element)
.capture('plain');
});
}
});
Command used to run the test:
gemini update
Result:
C:\Users\vkotulskyi\Projects\tiscommandcenter>gemini test --reporter html --reporter flat
✘ chart login-body plain [chrome]
Element input[name="login"] was not shown in 1500ms
✘ chart login plain [chrome]
Element input[name="login"] was not shown in 1500ms
Total: 2 Passed: 0 Failed: 2 Skipped: 0 Retries: 0

...
Expected behaviour:
.setURL of child methods should be executed after .before section of parent test is executed ...
Please add setUrl method to actions
Hello. Did you read our documentation? I propose you familiarize with the information on how gemini tests should be written
Each new suite causes reload of the browser, even if URL was not changed. So yes, child suites executed after .before section, but page is completely refreshed in child suites and you don't have state which was in parent.
That is why I asked to implement "setURL" method in actions. Here is the case: I need to access login page of my SPA and do some actions before access the page with elements to test. For now, I can change location using executeJS action and windows.location property, but this method looks a little bit ugly.