-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added initial explorer test for poc validation #16
base: main
Are you sure you want to change the base?
Changes from all commits
f8b818e
b7ec30d
7bf2635
6843f5f
c792c0f
ffb1182
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Explorer: | ||
def __init__(self, page, url): | ||
self.page = page | ||
self.url = url | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After fixing this line , the URL will not be needed. |
||
|
||
def open(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. function name here is so generic , you need to specify which page you need to open just to make it easy for any one else understand what the function does and search about it easily despicably if you have large testing framework, you can refer to policies page to see how we name the function in page object model pattern. |
||
self.page.get_by_role("link", name="Explorer").click() | ||
|
||
def search(self, term): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. function name here is so generic , you need to specify which control exactly you need to get just to make it easy for any one else understand what the function does and search about it easily despicably if you have large testing framework, you can refer to policies page to see how we name the function in page object model pattern. |
||
self.page.goto(f"{self.url}/explorer/query?descending=false&terms={term}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In automation testing you need to interact more with controls in the page instead of drop the URL easily in the address bar to make sure that this controls and fields respond correctly. Explorer_Search.mp4 |
||
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need to create a Folder for each section we add tests for, we just Append our tests files to the test_weave_gitops_enterprise and name the file a name refers to what exactly it tests so in this case the file name will be test_explorer_search.py |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
|
||
from playwright.sync_api import Playwright, sync_playwright, expect | ||
from pages.explorer_page import Explorer | ||
import pytest | ||
|
||
@pytest.mark.usefixtures("login") | ||
class TestExplorer: | ||
|
||
@pytest.fixture(autouse=True) | ||
def _obj(self, login): | ||
self.URL = os.getenv("URL") | ||
self.page = login | ||
self.explorer_page = Explorer(self.page, self.URL) | ||
|
||
def test_search(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test function name here is so generic also , you need to specify what exactly you need to test, you can refer to this file to see how we name the testing functions in page object model pattern. |
||
self.explorer_page.open() | ||
expect(self.page).to_have_url(f"{self.URL}/explorer/query") | ||
self.explorer_page.search("flux-system") | ||
expect(self.page.locator("tbody")).to_contain_text("flux-system") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we eventually should have the latest release