Example #1
0
def test_merge(actions: Actions, driver: WebDriver,
               github_user_with_repo: GitHubUserWithRepo):
    """
    Merge
    """
    github_login_page = GitHubLogin(actions)
    github_login_page.open()
    github_login_page.goto_login_form()
    github_login_page.login(username=github_user_with_repo.user.username,
                            password=github_user_with_repo.user.password)
    github_merge_page = GitHubMerge(actions, github_user_with_repo)
    github_merge_page.open()
    github_merge_page.pick_pull_requests()
    github_merge_page.create()
    assert XpathExists('//span[@title="Status: Merged"]'), 'nie zrobiono merge'
Example #2
0
def test_delete_branch(actions: Actions, driver: WebDriver,
                       github_user_with_repo: GitHubUserWithRepo,
                       branchname: str):
    """
    Usunięcie brancha

    """
    github_login_page = GitHubLogin(actions)
    github_login_page.open()
    github_login_page.goto_login_form()
    github_login_page.login(username=github_user_with_repo.user.username,
                            password=github_user_with_repo.user.password)
    github_branches_page = GitHubBranches(actions, github_user_with_repo)
    github_branches_page.open()
    github_branches_page.delete_branch(branchname=branchname)
    xpath_format = f'//li//div[contains(.,"{branchname}") and contains(.,"Deleted just now by ")]'
    assert XpathExists(xpath_format), 'Nie usunięto repo'
Example #3
0
def test_create_pull_request(actions: Actions, driver: WebDriver,
                             github_user_with_repo: GitHubUserWithRepo,
                             branchname: str):
    """
    Stworzenie pull request
    """
    github_login_page = GitHubLogin(actions)
    github_login_page.open()
    github_login_page.goto_login_form()
    github_login_page.login(username=github_user_with_repo.user.username,
                            password=github_user_with_repo.user.password)
    github_new_pull_request_page = GitHubNewPullRequest(
        actions, github_user_with_repo, branchname)
    github_new_pull_request_page.open()
    github_new_pull_request_page.create()
    assert XpathExists(
        '//span[contains(.,"Create")]'), 'Nie powstał pull request'
Example #4
0
def test_add_new_branch(actions: Actions, driver: WebDriver,
                        github_user_with_repo: GitHubUserWithRepo,
                        branchname: str):
    """
    Stworzenie nowego brancha

    """
    github_login_page = GitHubLogin(actions)
    github_login_page.open()
    github_login_page.goto_login_form()
    github_login_page.login(username=github_user_with_repo.user.username,
                            password=github_user_with_repo.user.password)
    github_repo_page = GitHubRepoMain(actions, github_user_with_repo)
    github_repo_page.open()
    github_repo_page.add_branch(branchname=branchname)
    xpath_format = f'//span[@class="css-truncate-target" and contains(.,"{branchname}")]'
    assert XpathExists(xpath_format), 'nie powstało nowe repo'
Example #5
0
def test_add_new_issue(actions: Actions, driver: WebDriver,
                       github_user: GitHubUser, reponame: str, title: str,
                       comment: str):
    """
    Dodanie new issue

    """
    github_login_page = GitHubLogin(actions)
    github_login_page.open()
    github_login_page.goto_login_form()
    github_login_page.login(username=github_user.username,
                            password=github_user.password)
    github_add_new_issue_page = GitHubNewIssue(actions=actions,
                                               github_user=github_user,
                                               reponame=reponame)
    github_add_new_issue_page.open()
    github_add_new_issue_page.fill_form(title=title, comment=comment)
    github_add_new_issue_page.submit()
    xpath_issue_created = f'//span[contains(.,"{title}")]'
    assert XpathExists(xpath_issue_created), 'new issue nie dodane'
Example #6
0
def test_google_search(actions: Actions):
    """
    Szukaj z uzyciem samych actions'ow
    Mozesz dodawac funkcje jakie dusza zapragnie i wywolywac selenium poprzez actions,
    tam jest pod spodem duzo ogarniete
    czyli robisz np:
    actions.click(selector)
    actions.type_text(selector, text)
    actions.submit()
    itd. omowimy se to
    """
    driver = actions.driver
    search_text = 'dr dissrespect'  # tekst do wpisania
    driver.get('https://google.pl')  # otworz gugle
    search_input_selector = Selector(Using.NAME, 'q')  # definiujesz kontrolke (to se omowic bardziej mozemy)
    actions.type_text(search_input_selector, search_text)  # wpisz text
    actions.submit()  # submit formularza
    search_result_exist_xpath = "//div[@class='g']"  # xpath do poczekania
    actions.wait_for(XpathExists(search_result_exist_xpath))  # jesli ten xpath istnieje to kolejny ekran sie zaladowal

    title = driver.title  # odczytaj tytul stronki
    assert search_text in title, f"tytul strony powinien zawierac: {search_text}"  # asercja
Example #7
0
 def search_for(self, text: str):
     """ wykonaj search - text: fraza jaka trza wpisac w search """
     self.actions.element_provider.driver.get('https://google.pl')
     self.actions.type_text(Selector(Using.NAME, 'q'), text)
     self.actions.submit()
     self.actions.wait_for(XpathExists("//div[@class='g']"))
Example #8
0
 def add_branch(self, branchname: str):
     self.actions.click(self.branches_list)
     self.actions.type_text(self.branch_name_input, branchname)
     self.actions.wait_for(
         XpathExists("//span[contains(.,'Create branch')]"))
     self.actions.click(self.create_branch_button)
Example #9
0
 def login(self, username: str, password: str):
     self.actions.type_text(selector=self.username_input, text=username)
     self.actions.type_text(selector=self.password_input, text=password)
     self.actions.submit()
     self.actions.wait_for(XpathExists("//div[@id='dashboard']"))