Skip to content
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

Sourcery refactored main branch #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion functional/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def medulla_connect(page: Page) -> None:
page.fill('#password', 'siveo')
page.click('#connect_button')

expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=main&action=default")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=main&action=default"
)
Comment on lines -35 to +37
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function medulla_connect refactored with the following changes:




Expand Down
23 changes: 18 additions & 5 deletions functional/test_00001_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def test_dashboard_createuser(page: Page) -> None:
medulla_connect(page)

page.click("//html/body/div/div[4]/div/div[3]/div[1]/div[2]/div[1]/ul/li/a")
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=add")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=add"
)
Comment on lines -22 to +24
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_dashboard_createuser refactored with the following changes:




Expand All @@ -28,7 +30,9 @@ def test_dashboard_creategroup(page: Page) -> None:
medulla_connect(page)

page.click("//html/body/div/div[4]/div/div[3]/div[1]/div[2]/div[2]/ul/li/a")
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=add")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=add"
)
Comment on lines -31 to +35
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_dashboard_creategroup refactored with the following changes:


def test_create_groupe_by_dashboard_os_system(page: Page) -> None:
medulla_connect(page)
Expand Down Expand Up @@ -89,11 +93,17 @@ def template_create_group_by_status(page: Page, selector, group_name) -> None:
page.click(".edit a")
expect(page).to_have_url(re.compile(".*submod=computers&action=computersgroupedit*"))

page.fill("//html/body/div/div[4]/div/form/table/tbody/tr[1]/td[3]/input", "Group Created by playwright By Dashboard " + group_name)
page.fill(
"//html/body/div/div[4]/div/form/table/tbody/tr[1]/td[3]/input",
f"Group Created by playwright By Dashboard {group_name}",
)

page.click(".btnPrimary[type='submit']")

result_on_server = sqlcheck("dyngroup", "SELECT count(*) from Groups WHERE name = 'Group Created by playwright By Dashboard " + group_name + "'")
result_on_server = sqlcheck(
"dyngroup",
f"SELECT count(*) from Groups WHERE name = 'Group Created by playwright By Dashboard {group_name}'",
)
Comment on lines -92 to +106
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function template_create_group_by_status refactored with the following changes:


assert result_on_server == 1

Expand All @@ -103,7 +113,10 @@ def template_create_group_by_status(page: Page, selector, group_name) -> None:
def test_create_groupe_by_dashboard_machine_online(page: Page) -> None:
medulla_connect(page)

status = sqlcheck("xmppmaster", "SELECT status FROM uptime_machine WHERE hostname = '" + machineName + "' ORDER BY id DESC LIMIT 1")
status = sqlcheck(
"xmppmaster",
f"SELECT status FROM uptime_machine WHERE hostname = '{machineName}' ORDER BY id DESC LIMIT 1",
)
Comment on lines -106 to +119
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_create_groupe_by_dashboard_machine_online refactored with the following changes:


if(status == 1):
template_create_group_by_status(page, ".computersonline-graphLabel0 a", "Machine Online")
Expand Down
42 changes: 30 additions & 12 deletions functional/test_00002_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,55 +26,73 @@ def test_open_groups(page: Page) -> None:
medulla_connect(page)

page.click('#navbargroups')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index"
)
Comment on lines -29 to +31
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_open_groups refactored with the following changes:



def test_create_groups(page: Page) -> None:

medulla_connect(page)

page.click('#navbargroups')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index"
)

page.click('#add')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=add")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=add"
)

page.fill('#groupname', TestGroup_Name)
page.fill('#groupdesc', 'Description du groupe')
page.click(".btnPrimary[type='submit']")
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index"
)
Comment on lines -37 to +53
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_create_groups refactored with the following changes:


def test_display_groups(page: Page) -> None:

medulla_connect(page)

page.click('#navbargroups')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index"
)

machine_inventory = "#g_" + TestGroup_Name + " .display a"
machine_inventory = f"#g_{TestGroup_Name} .display a"
page.click(machine_inventory)
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=members&group=" + TestGroup_Name)
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=members&group={TestGroup_Name}"
)
Comment on lines -52 to +68
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_display_groups refactored with the following changes:



def test_edit_groups(page: Page) -> None:

medulla_connect(page)

page.click('#navbargroups')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index"
)

machine_inventory = "#g_" + TestGroup_Name + " .edit a"
machine_inventory = f"#g_{TestGroup_Name} .edit a"
page.click(machine_inventory)
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=edit&group=" + TestGroup_Name)
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=edit&group={TestGroup_Name}"
)
Comment on lines -64 to +84
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_edit_groups refactored with the following changes:


def test_delete_groups(page: Page) -> None:

medulla_connect(page)

page.click('#navbargroups')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index"
)

machine_inventory = "#g_" + TestGroup_Name + " .delete a"
machine_inventory = f"#g_{TestGroup_Name} .delete a"
Comment on lines -75 to +95
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_delete_groups refactored with the following changes:

page.click(machine_inventory)
page.click(".btnPrimary[type='submit']")

Expand Down
48 changes: 34 additions & 14 deletions functional/test_00003_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,24 @@ def test_open_users(page: Page) -> None:
medulla_connect(page)

page.click('#navbarusers')
expect(page).to_have_url( test_server + "/mmc/main.php?module=base&submod=users&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=index"
)
Comment on lines -39 to +41
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_open_users refactored with the following changes:



def test_create_users(page: Page) -> None:

medulla_connect(page)

page.click('#navbarusers')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=index"
)

page.click('#base_users_add')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=add")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=add"
)
Comment on lines -47 to +56
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_create_users refactored with the following changes:


page.fill('#uid', test_user)
page.fill('#pass', password)
Expand All @@ -57,10 +63,10 @@ def test_create_users(page: Page) -> None:
page.fill('#title', 'title')

page.click(".btnPrimary[type='submit']")

# Testing if the popup is from the alert-success class and if it has the right text
locator = page.locator('#__popup_container .alert.alert-success')
expect(locator).to_have_text('User ' + test_user + ' successfully created')
expect(locator).to_have_text(f'User {test_user} successfully created')

def test_edit_users_empty(page: Page) -> None:
"""
Expand All @@ -70,9 +76,13 @@ def test_edit_users_empty(page: Page) -> None:
medulla_connect(page)

page.click('#navbarusers')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=index"
)
page.click(id_code + test_user + ' .edit')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=edit&user=test_user")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=edit&user=test_user"
)
Comment on lines -73 to +85
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_edit_users_empty refactored with the following changes:

page.click(".btnPrimary[type='submit']")

time.sleep(1)
Expand All @@ -89,9 +99,13 @@ def test_edit_users(page: Page) -> None:

medulla_connect(page)
page.click('#navbarusers')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=index"
)
page.click(id_code + test_user + ' .edit')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=edit&user=test_user")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=edit&user=test_user"
)
Comment on lines -92 to +108
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_edit_users refactored with the following changes:

page.fill('#sn', 'Familly Name Edited')
page.click(".btnPrimary[type='submit']")

Expand All @@ -107,10 +121,14 @@ def test_duplicated_user(page: Page) -> None:
medulla_connect(page)

page.click('#navbarusers')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=index"
)

page.locator('#base_users_add').click()
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=add")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=add"
)
Comment on lines -110 to +131
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_duplicated_user refactored with the following changes:


page.fill('#uid', test_user)
page.fill('#pass', password)
Expand All @@ -132,14 +150,16 @@ def test_delete_users(page: Page) -> None:
medulla_connect(page)

page.click('#navbarusers')
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index")
expect(page).to_have_url(
f"{test_server}/mmc/main.php?module=base&submod=users&action=index"
)
page.click(id_code + test_user + ' .delete a')
page.click('#delfiles')
page.click(".btnPrimary[type='submit']")

# Testing if the popup is from the alert-success class and if it has the right text
locator = page.locator('#__popup_container .alert.alert-success')
expect(locator).to_have_text('User ' + test_user + ' has been successfully deleted')
expect(locator).to_have_text(f'User {test_user} has been successfully deleted')
Comment on lines -135 to +162
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_delete_users refactored with the following changes:

page.click('#__popup_container button')

time.sleep(1)
Loading