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
1 change: 0 additions & 1 deletion environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def before_all(context):
def before_scenario(context, scenario):
context.board_names = []


def after_step(context, step):
if step.status == "failed":
screenshot_dir = os.path.join(os.getcwd(), "screenshots")
Expand Down
33 changes: 33 additions & 0 deletions features/template_card.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Feature: create board in trello application

Scenario: launch the trello application and validate trello home page
Given Launch the trello application
Then Validate trello logo
When Click on log in link
Then Validate login form
When Enter username
When Click on continue button
When Enter password
When Click on log in button
Then Validate the trello header should displayed in home page
When Click on profile button "Amrutha"
Then Validate username "Amrutha Dasireddy"

Scenario: create card from template
When Click on the "Create" button in home page.
Then Validate create form
When Click on the "Create board" button in create form
Then Validate create board header
When Enter random board name in create board form
When Click on create button in create board form
Then Validate randomly created board name is displayed
When Create list title "1" and validate list name
When Click on "Card templates" add template
Then Validate template name in form
When Click on create card button and verify "Create card from template" form
Then Validate card name
When Click on create card button
When Click on template card name under list
When Click on hide from list button
Then Validate card name under list

2 changes: 1 addition & 1 deletion locators/move_card_loc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from selenium.webdriver.common.by import By


class MoveCard:
class MoveCardLoc:
move_button_loc = (By.CSS_SELECTOR, "[title='Move'] span+span")
move_card_form_loc = (By.CSS_SELECTOR, "[class='no-back']")
move_card_header_loc = (By.CSS_SELECTOR, "span[class*='header-title']")
Expand Down
18 changes: 18 additions & 0 deletions locators/template_card_loc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from selenium.webdriver.common.by import By


class TemplateCardsLoc:
card_template_header_loc = (By.CSS_SELECTOR, "[title='Card templates']")
create_a_new_template_button_loc = (By.CSS_SELECTOR, "[data-testid*='new-template']")
template_title_input_loc = (By.CSS_SELECTOR, "[placeholder='Template title']")
add_button_loc = (By.CSS_SELECTOR, "[data-testid*='submit-button']")
template_card_header_loc = (By.CSS_SELECTOR, "[data-testid*='template-card'] div h3")
created_template_name_text_loc = (By.CSS_SELECTOR, "textarea[class*='detail-title']")
create_card_from_template_button_loc = (By.CSS_SELECTOR, "span[data-testid='TemplateCreateIcon']")
create_card_from_template_header_loc = (By.CSS_SELECTOR, "[title*='Create']")
card_title_textarea_loc = (By.CSS_SELECTOR, "[data-testid='card-title-textarea']")
crate_card_button_loc = (By.CSS_SELECTOR, "[data-testid='create-card-from-template-button']")
hide_from_list_button_loc = (By.CSS_SELECTOR, "[title='Hide from list']")



83 changes: 79 additions & 4 deletions pages/add_a_list_card_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from selenium.webdriver.common.by import By
from locators.add_list_loc import AddListLocators
from selenium.webdriver.common.action_chains import ActionChains
from locators.move_card_loc import MoveCard
from locators.move_card_loc import MoveCardLoc
from selenium.webdriver.support.ui import Select
from locators.template_card_loc import TemplateCardsLoc


class AddAListCardPage(SynMethods, AddListLocators, ActionChains, MoveCard, Select):
class AddAListCardPage(SynMethods, AddListLocators, ActionChains, MoveCardLoc, Select,TemplateCardsLoc):
def __init__(self, driver):
super().__init__(driver)

Expand Down Expand Up @@ -95,7 +96,7 @@ def verify_card_details_window(self):

def verify_current_card_name(self, name):
current_card_name = self.wait_until_element_visible(self.current_card_name_loc, self.medium_wait, self.driver)
current_card_name_text = current_card_name.get_attribute("value")
current_card_name_text = current_card_name.text
assert current_card_name_text == name, current_card_name_text + "card name is not matched"

def verify_current_list_name(self, name):
Expand Down Expand Up @@ -126,7 +127,7 @@ def verify_delete_pop_up(self):

def verify_delete_header(self, header):
delete_header = self.wait_until_element_visible(self.delete_header_loc, self.medium_wait, self.driver)
delete_header_text = delete_header.text
delete_header_text = delete_header.get_attribute("value")
assert delete_header_text == header, delete_header_text + "header is not matched"

def verify_delete_content(self, content):
Expand Down Expand Up @@ -423,3 +424,77 @@ def move_cards_from_one_board_to_another_board(self, card_name, list_name, move,
self.verify_move_card_header(move)
self.select_board(board)
self.click_on_move_button()

def click_on_template_button(self, list):
self.driver.refresh()
loc = (By.XPATH, "//h2[text()='"+list+"']//ancestor::div[@data-testid='list']//button[contains(@data-testid,'template')]")
template_button = self.wait_until_element_visible(loc, self.long_wait, self.driver)
self.wait_until_element_clickable(loc, self.long_wait, self.driver)
template_button.click()
time.sleep(5)

def verify_card_template_header(self, input_text):
card_template = self.wait_until_element_visible(self.card_template_header_loc, self.long_wait, self.driver)
card_template_text = card_template.text
assert card_template_text == input_text, card_template_text + " header is not matched"

def click_on_crate_new_template_button(self):
crate_new_template_button = self.wait_until_element_visible(self.create_a_new_template_button_loc, self.medium_wait, self.driver)
self.wait_until_element_clickable(self.create_a_new_template_button_loc, self.medium_wait, self.driver)
crate_new_template_button.click()

def enter_template_title(self, title):
template_title = self.wait_until_element_visible(self.template_title_input_loc, self.medium_wait, self.driver)
self.wait_until_element_clickable(self.template_title_input_loc, self.medium_wait, self.driver)
template_title.send_keys(title)

def click_on_add_button(self):
add_button = self.wait_until_element_visible(self.add_button_loc, self.medium_wait, self.driver)
self.wait_until_element_clickable(self.add_button_loc, self.medium_wait, self.driver)
add_button.click()

def verify_template_card_name(self):
time.sleep(5)
template_card_name = self.wait_until_element_presence(self.created_template_name_text_loc, self.medium_wait, self.driver)
assert template_card_name.is_displayed() == True, "text is not displayed"
self.click_on_close_window()

def click_on_create_card_from_template_button(self):
create_card_from_template_button = self.wait_until_element_visible(self.create_card_from_template_button_loc, self.medium_wait, self.driver)
self.wait_until_element_clickable(self.create_card_from_template_button_loc, self.medium_wait, self.driver)
create_card_from_template_button.click()

def verify_create_card_from_template_header(self, input_text):
create_card_from_template = self.wait_until_element_visible(self.create_card_from_template_header_loc, self.medium_wait, self.driver)
create_card_from_template_text = create_card_from_template.text
assert create_card_from_template_text == input_text, create_card_from_template_text + " header is not matched"

def verify_card_from_template_textarea(self, input_text):
card_from_template_textarea = self.wait_until_element_visible(self.card_title_textarea_loc, self.medium_wait, self.driver)
card_from_template_textarea_text = card_from_template_textarea.text
assert card_from_template_textarea_text == input_text, card_from_template_textarea_text + " header is not matched"
self.wait_until_element_visible(self.card_title_textarea_loc, self.medium_wait, self.driver)
card_from_template_textarea.click()
card_from_template_textarea.send_keys(" card")

def click_on_create_card_button(self):
create_card_button = self.wait_until_element_visible(self.crate_card_button_loc, self.medium_wait, self.driver)
self.wait_until_element_clickable(self.crate_card_button_loc, self.medium_wait, self.driver)
create_card_button.click()

def click_on_template_card_name(self, input):
loc = (By.XPATH, "//a[text()='"+input+"']")
card_name = self.wait_until_element_visible(loc, self.medium_wait, self.driver)
self.wait_until_element_clickable(loc, self.medium_wait, self.driver)
card_name.click()

def click_on_hide_from_list_button(self):
hide_from_list_button = self.wait_until_element_visible(self.hide_from_list_button_loc, self.medium_wait, self.driver)
self.driver.execute_script("arguments[0].scrollIntoView(true);", hide_from_list_button)
self.wait_until_element_clickable(self.hide_from_list_button_loc, self.medium_wait, self.driver)
hide_from_list_button.click()

def verify_template_card_name_under_list(self, input):
loc = (By.XPATH, "//a[text()='" + input + "']")
template_card_name = self.is_Element_invisible(loc, self.medium_wait, self.driver)
assert template_card_name == True, "card is not hide from the list"
56 changes: 56 additions & 0 deletions steps/add_a_list_card_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,59 @@ def create_list_title_validate_list_name(context, list_size, listfilename):
context.list_card.enter_list_title(list_name)
context.list_card.click_on_add_a_list_button()
context.list_card.verify_added_list_name(list_name)


@when(u'Click on "{data}" add template')
def click_on_card_template_add_template(context, data):
context.list_card = AddAListCardPage(context.driver)
context.list_card.click_on_template_button(list_names[0])
context.list_card.verify_card_template_header(data)
context.list_card.click_on_crate_new_template_button()
name = fake.name()
context.template_name = "template" + name
context.list_card.enter_template_title(context.template_name)
context.list_card.click_on_add_button()


@then(u"Validate template name in form")
def validate_template_name_in_template_card_form(context):
context.list_card = AddAListCardPage(context.driver)
context.list_card.verify_template_card_name()


@when(u'Click on create card button and verify "{card_templates}" form')
def click_on_card_template_add_template(context, card_templates):
context.list_card = AddAListCardPage(context.driver)
context.list_card.click_on_create_card_from_template_button()
context.list_card.verify_create_card_from_template_header(card_templates)


@then(u"Validate card name")
def validate_card_name(context):
context.list_card = AddAListCardPage(context.driver)
context.list_card.verify_card_from_template_textarea(context.template_name)


@when(u"Click on create card button")
def click_on_crate_card_button(context):
context.list_card = AddAListCardPage(context.driver)
context.list_card.click_on_create_card_button()


@when(u"Click on template card name under list")
def click_on_template_card_under_lists(context):
context.list_card = AddAListCardPage(context.driver)
context.list_card.click_on_template_card_name(context.template_name)


@when(u"Click on hide from list button")
def click_on_hide_from_list(context):
context.list_card = AddAListCardPage(context.driver)
context.list_card.click_on_hide_from_list_button()
context.list_card.click_on_close_window()


@then(u"Validate card name under list")
def validate_card_name_under_list(context):
context.list_card = AddAListCardPage(context.driver)
context.list_card.verify_template_card_name_under_list(context.template_name)