Skip to content

Commit

Permalink
Ddl kavya dom 60374 add wait to save to table logic (#515)
Browse files Browse the repository at this point in the history
## PR Type
What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->
- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting)
- [ ] Refactoring (no functional changes)
- [ ] CI related changes
- [ ] Other... Please describe:

## What is the current behavior?
<!-- add 'wait' step to existing steps. -->

Issue Number: https://dominodatalab.atlassian.net/browse/DOM-60374

## What is the new behavior?

## Does this PR introduce a breaking change?
- [ ] Yes
- [X] No

<!-- If this PR contains a breaking change, please describe the impact
and migration path for existing applications below. -->

## Other information
  • Loading branch information
ddl-kavya authored Aug 13, 2024
1 parent 96d042e commit f1a33da
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
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).

## 0.202.0
- add - wait step to saving values from any table cells to a variable

## 0.201.0
- change - add report path to the JUnit files when available

Expand Down
8 changes: 4 additions & 4 deletions features/browser/tables.feature
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ Feature: Tables
Scenario: User can save any table cell value to a variable
Given I open a browser at the url "http://{HOST_ADDRESS}:{PORT}/tables.html"
And I set the variable "USERNAME" to "Alfred White"
When I save "1st" table "1st" row , "1st" column value to a variable "TABLE_1_VALUE"
When I save "1st" table, "1st" row, "1st" column value to a variable "TABLE_1_VALUE"
Then I should see "{TABLE_1_VALUE}" is equal to "Name"
When I save "2nd" table "2nd" row , "1st" column value to a variable "TABLE_2_VALUE"
When I save "2nd" table, "2nd" row, "1st" column value to a variable "TABLE_2_VALUE"
Then I should see "{TABLE_2_VALUE}" is equal to "Alfred"
When I save "3rd" table "2nd" row , "2nd" column value to a variable "TABLE_3_VALUE"
When I wait to save "3rd" table, "2nd" row, "2nd" column value to a variable "TABLE_3_VALUE"
Then I should see "{TABLE_3_VALUE}" is equal to "31"
When I save "4th" table "3rd" row , "2nd" column value to a variable "TABLE_4_VALUE"
When I wait to save "4th" table, "3rd" row, "2nd" column value to a variable "TABLE_4_VALUE"
Then I should see "{TABLE_4_VALUE}" is equal to "133,000"

Scenario: User can click specific row in table
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cucu"
version = "0.201.0"
version = "0.202.0"
license = "MIT"
description = "Easy BDD web testing"
authors = ["Domino Data Lab <[email protected]>"]
Expand Down
17 changes: 14 additions & 3 deletions src/cucu/steps/table_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ def click_table_header(ctx, header):
)


@step(
'I save "{table:nth}" table "{row:nth}" row , "{column:nth}" column value to a variable "{variable_name}"'
)
def get_table_cell_value(ctx, table, row, column, variable_name):
tables = find_tables(ctx)

Expand All @@ -314,6 +311,20 @@ def get_table_cell_value(ctx, table, row, column, variable_name):
config.CONFIG[variable_name] = cell_value


@step(
'I save "{table:nth}" table, "{row:nth}" row, "{column:nth}" column value to a variable "{variable_name}"'
)
def step_get_table_cell_value(ctx, table, row, column, variable_name):
get_table_cell_value(ctx, table, row, column, variable_name)


@step(
'I wait to save "{table:nth}" table, "{row:nth}" row, "{column:nth}" column value to a variable "{variable_name}"'
)
def wait_to_get_table_cell_value(ctx, table, row, column, variable_name):
retry(get_table_cell_value)(ctx, table, row, column, variable_name)


def find_table_element(ctx, nth=1):
"""
Return the nth table as a WebElement
Expand Down

0 comments on commit f1a33da

Please sign in to comment.