How to use assert_text_visible method in SeleniumBase

Best Python code snippet using SeleniumBase

test_update_ticket.py

Source:test_update_ticket.py Github

copy

Full Screen

...50 self.type("#update-form-price", str(test_ticket.price))51 self.type("#update-form-expiration-date", test_ticket.expiration_date)52 self.click("#update-form-submit")53 # Check that ticket is updated54 self.assert_text_visible(55 "Successfully updated ticket", "#flash-message")56 def test_ticket_is_not_alphanumeric(self, *_):57 """58 The name of the ticket has to be alphanumeric-only - negative59 Test case ID: R5.1.260 """61 # Invalidate previous session62 self.open(base_url + '/logout')63 # Login user64 self.open(base_url + '/login')65 self.type("#email", test_user.email)66 self.type("#password", test_user.password)67 self.click("#btn-submit")68 # Open /69 self.open(base_url)70 # Update ticket info71 self.type("#update-form-name", 'hello $$$')72 self.type("#update-form-quantity", str(test_ticket.quantity))73 self.type("#update-form-price", str(test_ticket.price))74 self.type("#update-form-expiration-date", test_ticket.expiration_date)75 self.click("#update-form-submit")76 # Check that ticket is updated77 self.assert_text_visible(78 "Name must have alphanumeric characters only.", "#flash-message")79 def test_ticket_name_is_too_long(self, *_):80 """81 The name of the ticket is no longer than 60 characters - negative82 Test case ID: R5.2.283 """84 # Invalidate previous session85 self.open(base_url + '/logout')86 # Login user87 self.open(base_url + '/login')88 self.type("#email", test_user.email)89 self.type("#password", test_user.password)90 self.click("#btn-submit")91 # Open /92 self.open(base_url)93 # Update ticket info94 self.type("#update-form-name",95 'thisis61characterslongaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')96 self.type("#update-form-quantity", str(test_ticket.quantity))97 self.type("#update-form-price", str(test_ticket.price))98 self.type("#update-form-expiration-date", test_ticket.expiration_date)99 self.click("#update-form-submit")100 # Check that ticket is updated101 self.assert_text_visible(102 "Name must be less than 60 characters.", "#flash-message")103 def test_ticket_quantity_is_not_valid(self, *_):104 """105 The quantity of the tickets has to be more than 0, and less than or equal to 100. - negative106 Test case ID: R5.3.2107 """108 # Invalidate previous session109 self.open(base_url + '/logout')110 # Login user111 self.open(base_url + '/login')112 self.type("#email", test_user.email)113 self.type("#password", test_user.password)114 self.click("#btn-submit")115 # Open /116 self.open(base_url)117 # Update ticket info118 self.type("#update-form-name", test_ticket.name)119 self.type("#update-form-quantity", str(0))120 self.type("#update-form-price", str(test_ticket.price))121 self.type("#update-form-expiration-date", test_ticket.expiration_date)122 self.click("#update-form-submit")123 # Check that ticket is updated124 self.assert_text_visible(125 "Quantity must be between 1 and 100.", "#flash-message")126 def test_ticket_price_is_not_valid(self, *_):127 """128 Price has to be of range [10, 100] - negative129 Test case ID: R5.4.2130 """131 # Invalidate previous session132 self.open(base_url + '/logout')133 # Login user134 self.open(base_url + '/login')135 self.type("#email", test_user.email)136 self.type("#password", test_user.password)137 self.click("#btn-submit")138 # Open /139 self.open(base_url)140 # Update ticket info141 self.type("#update-form-name", test_ticket.name)142 self.type("#update-form-quantity", str(test_ticket.quantity))143 self.type("#update-form-price", str(0))144 self.type("#update-form-expiration-date", test_ticket.expiration_date)145 self.click("#update-form-submit")146 # Check that ticket is updated147 self.assert_text_visible(148 "Price must be between 10 and 100 inclusive.", "#flash-message")149 def test_ticket_date_is_not_valid(self, *_):150 """151 Date must be given in the format YYYYMMDD - negative152 Test case ID: R5.5.2153 """154 # Invalidate previous session155 self.open(base_url + '/logout')156 # Login user157 self.open(base_url + '/login')158 self.type("#email", test_user.email)159 self.type("#password", test_user.password)160 self.click("#btn-submit")161 # Open /162 self.open(base_url)163 # Update ticket info164 self.type("#update-form-name", test_ticket.name)165 self.type("#update-form-quantity", str(test_ticket.quantity))166 self.type("#update-form-price", str(test_ticket.price))167 self.type("#update-form-expiration-date", '123456789')168 self.click("#update-form-submit")169 # Check that ticket is updated170 self.assert_text_visible(171 "Date must be in the format YYYYMMDD.", "#flash-message")172 def test_ticket_does_exist(self, *_):173 """174 The ticket of the given name must exist - positive175 Test case ID: R5.6.1176 """177 # Invalidate previous session178 self.open(base_url + '/logout')179 # Login user180 self.open(base_url + '/login')181 self.type("#email", test_user.email)182 self.type("#password", test_user.password)183 self.click("#btn-submit")184 # Open /185 self.open(base_url)186 # Update ticket info187 self.type("#update-form-name", test_ticket.name)188 self.type("#update-form-quantity", str(test_ticket.quantity))189 self.type("#update-form-price", str(test_ticket.price))190 self.type("#update-form-expiration-date", test_ticket.expiration_date)191 self.click("#update-form-submit")192 # Check that ticket is updated193 self.assert_text_visible(194 "Successfully updated ticket", "#flash-message")195 def test_ticket_does_not_exist(self, *_):196 """197 The ticket of the given name must exist - negative198 Test case ID: R5.6.2199 """200 # Invalidate previous session201 self.open(base_url + '/logout')202 # Login user203 self.open(base_url + '/login')204 self.type("#email", test_user.email)205 self.type("#password", test_user.password)206 self.click("#btn-submit")207 # Open /208 self.open(base_url)209 # Update ticket info210 self.type("#update-form-name", 'fakeTicketName')211 self.type("#update-form-quantity", str(test_ticket.quantity))212 self.type("#update-form-price", str(test_ticket.price))213 self.type("#update-form-expiration-date", test_ticket.expiration_date)214 self.click("#update-form-submit")215 # Check that ticket is updated216 self.assert_text_visible(...

Full Screen

Full Screen

test_end_to_end.py

Source:test_end_to_end.py Github

copy

Full Screen

...29 self.assert_current_url('https://www.saucedemo.com/cart.html')30 # assert item name is correct and added successfully31 self.assert_text(ITEM_NAME, '//*[@class="inventory_item_name"]')32 # assert item price is correct and visible33 self.assert_text_visible(ITEM_PRICE, '//*[@class="inventory_item_price"]')34 # click button to view checkout information page35 self.click('//*[@id="checkout"]')36 # ----- Checkout Information Page -----37 # assert current url is correct38 self.assert_current_url('https://www.saucedemo.com/checkout-step-one.html')39 # Enter First Name40 self.set_text('//*[@id="first-name"]', FIRST_NAME)41 # Enter Last Name42 self.set_text('//*[@id="last-name"]', LAST_NAME)43 # Enter ZipCode44 self.set_text('//*[@id="postal-code"]', ZIP_POSTAL_CODE)45 # click continue to proceed to checkout overview page46 self.click('//*[@id="continue"]')47 # ----- Checkout Overview Page -----48 # assert current url is correct49 self.assert_current_url('https://www.saucedemo.com/checkout-step-two.html')50 # assert ITEM NAME is visible and correct51 self.assert_text_visible(ITEM_NAME, '//*[@class="inventory_item_name"]')52 # assert ITEM PRICE is visible and correct53 self.assert_text_visible(ITEM_PRICE, '//*[@class="inventory_item_price"]')54 # click button finish - to proceed to Check Out Complete page55 self.click('//*[@id="finish"]')56 # ----- Checkout Complete Page -----57 # assert current url is correct58 self.assert_current_url('https://www.saucedemo.com/checkout-complete.html')59 # assert PONY LOGO is visible60 self.assert_element_visible('//*[@class="pony_express"]')61 # save screenshot to verify successful end to end test...

Full Screen

Full Screen

test_login.py

Source:test_login.py Github

copy

Full Screen

...9 self.assert_element_visible(LoginPage.page_title)10 self.type(LoginPage.username_field, "tomsmith")11 self.type(LoginPage.password_field, "SuperSecretPassword!")12 self.click(LoginPage.login_button)13 self.assert_text_visible("You logged into a secure area!", LoginPage.message)14 @allure.description("Login with invalid credentials")15 def test_invalid_login(self):16 self.click_link_text(MainPage.form_authentication)17 self.assert_element_visible(LoginPage.page_title)18 self.type(LoginPage.username_field, "elias")19 self.type(LoginPage.password_field, "elias123")20 self.click(LoginPage.login_button)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful