Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project closely adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.3.27
- Add - step to open a new tab

## 1.3.26
- Change - Turn on "nth" steps for checking dropdown disablement

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ This contains a list of present and past contributors. If you are interested in
| Dan Clegg | ddl-dcleg |
| Urian Chang | urianchang |
| Med Mahmoud | ddl-mmahmoud |
| Andrew Wroblicky| ddl-awroblicky |

\* original author and creator
10 changes: 10 additions & 0 deletions features/browser/browser_tab_managemenet.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,13 @@ Feature: Browser tab management
And I click the button "buttons! in a new tab"
And I save the browser tabs info to the variable "TABS_INFO"
And I should see "{TABS_INFO}" contains "tab(2): Buttons!"

Scenario: User can open a a new browser tab
Given I start a webserver at directory "data/www" and save the port to the variable "PORT"
When I open a browser at the url "http://{HOST_ADDRESS}:{PORT}/links.html"
Then I should see the browser title is "Links!"
When I open a new browser tab
And I navigate to the url "http://{HOST_ADDRESS}:{PORT}/buttons.html"
Then I should see the browser title is "Buttons!"
And I switch to the previous browser tab
Then I should see the browser title is "Links!"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cucu"
version = "1.3.26"
version = "1.3.27"
description = "Easy BDD web testing"
readme = "README.md"
license = "BSD-3-Clause-Clear"
Expand Down
3 changes: 3 additions & 0 deletions src/cucu/browser/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ def navigate(self, url):
self.driver.get(url)
self.wait_for_page_to_load()

def switch_to_new_tab(self):
self.driver.switch_to.new_window("tab")

def switch_to_next_tab(self):
window_handles = self.driver.window_handles
window_handle = self.driver.current_window_handle
Expand Down
6 changes: 6 additions & 0 deletions src/cucu/steps/browser_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ def close_browser_tab(ctx):
ctx.browser.close_window()


@step("I open a new browser tab")
def open_a_new_browser_tab(ctx):
ctx.check_browser_initialized()
ctx.browser.switch_to_new_tab()


def switch_to_next_tab(ctx):
ctx.check_browser_initialized()
ctx.browser.switch_to_next_tab()
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.