-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic tests for each components (#78)
- Loading branch information
1 parent
6a95382
commit f4ea096
Showing
7 changed files
with
153 additions
and
28 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,18 +26,37 @@ def test_should_render_material_login(page: Page): | |
frame = page.frame_locator( | ||
'iframe[title="material_login\\.material_login"]' | ||
) | ||
component_return_value = page.get_by_test_id('stMarkdownContainer') | ||
component_return_value_json = page.get_by_test_id('stJson') | ||
|
||
email_field = frame.get_by_placeholder("[email protected]") | ||
password_field = frame.get_by_placeholder("your password") | ||
invalid_username_text = frame.get_by_text("username must be a valid email") | ||
invalid_password_text = frame.get_by_text("password is a required field") | ||
login_button = frame.get_by_role("button", name="Login") | ||
cancel_button = frame.get_by_role("button", name="Cancel") | ||
|
||
email_field.click() | ||
email_field.fill("hello") | ||
|
||
expect(invalid_username_text).to_be_visible() | ||
expect(invalid_password_text).to_be_visible() | ||
expect(login_button).to_be_disabled() | ||
|
||
email_field.click() | ||
email_field.fill("[email protected]") | ||
password_field.click() | ||
password_field.fill("password") | ||
frame.get_by_role("button", name="Login").click() | ||
|
||
page.get_by_text("\"username\":\"[email protected]\"") | ||
frame.get_by_role("button", name="Cancel").click() | ||
expect(invalid_username_text).to_be_hidden() | ||
expect(invalid_password_text).to_be_hidden() | ||
expect(component_return_value).to_have_text('None') | ||
login_button.click() | ||
|
||
expect(component_return_value_json).to_contain_text("\"username\":\"[email protected]\"") | ||
expect(component_return_value_json).to_contain_text("\"password\":\"password\"") | ||
cancel_button.click() | ||
expect(email_field).to_be_empty() | ||
expect(password_field).to_be_empty() | ||
|
||
expect(invalid_username_text).to_be_hidden() | ||
expect(invalid_password_text).to_be_hidden() | ||
expect(component_return_value_json).to_have_text('{}') |
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
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
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
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