Last active
September 26, 2019 22:45
-
-
Save DanielGallo/7193f9d8059ec820373f9c0750bebd42 to your computer and use it in GitHub Desktop.
Shows how to handle and switch multiple tabs in Sencha Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WebDriver scenario URL: https://examples.sencha.com/extjs/6.7.0/examples/kitchensink/frame-index.html#link-buttons | |
describe('Switching tabs', function() { | |
var tabIds, driver; | |
beforeAll(function() { | |
// This stores a reference to the underlying driver object | |
driver = ST.defaultContext.driver; | |
}); | |
it('should click a button that opens a second tab', function() { | |
ST.button('contentPanel button[text="Medium"]:first') | |
.click(); | |
}); | |
it('should fetch all open browser tabs', function(done) { | |
driver.getTabIds() | |
.then(function(tabs) { | |
tabIds = tabs; | |
done(); | |
}); | |
}); | |
it('should switch tabs to second tab', function() { | |
driver.switchTab(tabIds[1]).then(function() { | |
// Check definitely referencing correct page | |
ST.getUrl(function(url) { | |
expect(url).toContain('www.sencha.com'); | |
}); | |
}); | |
}); | |
it('should do something in the other tab', function() { | |
ST.element('.site-title') | |
.visible(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment