Skip to content

Commit a905e45

Browse files
author
Ramon Medeiros
committed
Change structure for tests
1 parent 890f82d commit a905e45

File tree

11 files changed

+71
-215
lines changed

11 files changed

+71
-215
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ po/gen-pot
3838
*.rej
3939
*.pem
4040
ui/pages/help/*/*.html
41-
uiTests/.env
41+
tests/ui/.env
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Kimchi E2E Tests
22

3-
The tests are located in uiTests. You should go to the directory to start them
3+
The tests are located in `tests/ui`. You should go to the directory to start them
44
```
5-
$ cd uiTests
5+
$ cd tests/ui
66
```
77

88
## How to run
@@ -22,20 +22,22 @@ $ pip install -r requirements.txt
2222
```
2323

2424
### Run in headless mode
25-
The Makefile expect some environment variables to run kimchi, which are:
25+
The script expect some environment variables to run kimchi-project tests, which are:
2626

2727
```
2828
Expect environment variables:
29-
KIMCHI_USERNAME: username for the host default: root
30-
KIMCHI_PASSWORD: password for the host
31-
KIMCHI_HOST: host for kimchi default: localhost
32-
KIMCHI_PORT: port for kimchi default: 8001
29+
USERNAME: username for the host default: root
30+
PASSWORD: password for the host
31+
HOST: host for kimchi default: localhost
32+
PORT: port for kimchi default: 8001
3333
```
3434

3535
So, if you are running against a remote host:
3636

3737
```
38-
$ read -s pass; KIMCHI_HOST=<HOST> KIMCHI_PASSWORD=$pass make
38+
$ HOST=<HOST> ./run_tests.sh
39+
Type password for host USER@HOST
40+
3941
```
4042

4143
### Run in debug mode
@@ -44,5 +46,7 @@ If you use the command above, the browser will no be visible for you.
4446
To see the browser action, add the variable `DEBUG`
4547

4648
```
47-
$ read -s pass; KIMCHI_HOST=<HOST> KIMCHI_PASSWORD=$pass DEBUG=true make
49+
$ HOST=<HOST> DEBUG=true ./run_tests.sh
50+
Type password for host USER@HOST
51+
4852
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import utils
2-
from .login import KimchiLoginPage
2+
from pages.login import KimchiLoginPage
33

44
VIRTUALIZATION_TAB = "//a[@class = 'item virtualizationTab']"
55
TEMPLATES_TAB = "//a[@href = 'plugins/kimchi/tabs/templates.html']"

tests/ui/pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
verbose = True
3+
log_cli = True
4+
log_cli_level = INFO

tests/ui/run_tests.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
HOST=${HOST:-localhost}
4+
PORT=${PORT:-8001}
5+
USERNAME=${USERNAME:-root}
6+
7+
# ask for password if not passed
8+
if [ -z $PASSWORD ]; then
9+
echo "Type password for host ${USERNAME}@${HOST}"
10+
read -s PASSWORD
11+
fi
12+
13+
# ../../../../../../ is wok root
14+
15+
HOST=${HOST} PASSWORD=${PASSWORD} USERNAME=${USERNAME} PORT=${PORT} \
16+
PYTHONPATH=$PYTHONPATH:../../../../../../tests/ui/ python3 -m pytest

tests/ui/test_templates.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import unittest
2+
3+
from utils import getBrowser
4+
from pages.templates import KimchiTemplatePage
5+
EXPECTED_TEMPLATES = [['Debian', '10', 'Not Available'],
6+
['Fedora', '30', 'Not Available'],
7+
['Fedora', '31', 'Not Available'],
8+
['Opensuse', '15.1', 'Not Available'],
9+
['Ubuntu', '19.04', 'Not Available'],
10+
['Ubuntu', '19.10', 'Not Available']
11+
]
12+
13+
14+
15+
VIRTUALIZATION_TAB = "//a[@class = 'item virtualizationTab']"
16+
TEMPLATES_TAB = "//a[@href = 'plugins/kimchi/tabs/templates.html']"
17+
ADD_TEMPLATE = "template-add"
18+
ISOS_LIST = "list-local-iso"
19+
20+
21+
class TestTemplate(unittest.TestCase):
22+
23+
def setUp(self):
24+
self.browser = getBrowser()
25+
self.templatePage = KimchiTemplatePage(self.browser)
26+
27+
def test_default_templates(self):
28+
templates = self.templatePage.retrieveDefaulTemplates()
29+
30+
# assert templates
31+
for template in templates:
32+
assert template in EXPECTED_TEMPLATES, f"{template} not found"
33+
34+
def tearDown(self):
35+
self.browser.close()
36+

uiTests/pages/kimchi_project/login.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

uiTests/pytest.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

uiTests/test_templates.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)