summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/tests/functional
diff options
context:
space:
mode:
authorAlassane Yattara <alassane.yattara@savoirfairelinux.com>2023-11-09 23:14:55 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-09 22:52:42 +0000
commitb4e16b96e12179f790c6101a66b4af164da6bfd4 (patch)
treeeab2a5e40e7924e65f2fe02ada33777fa5397e74 /bitbake/lib/toaster/tests/functional
parent278d1941a390e3a0053c38ea7dd0d177fbe8294e (diff)
downloadpoky-b4e16b96e12179f790c6101a66b4af164da6bfd4.tar.gz
bitbake: Toaster: Write UI TestCase create new project
Test create new project using: - Project Name: Any string - Release: Master/Kirkstone/Dunfell/Local - Merge Toaster settings: False/True (Bitbake rev: 8502ed9ce3e04e5e0f913a8af60828ac0cefa110) Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/tests/functional')
-rw-r--r--bitbake/lib/toaster/tests/functional/test_create_new_project.py134
1 files changed, 134 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_create_new_project.py b/bitbake/lib/toaster/tests/functional/test_create_new_project.py
new file mode 100644
index 0000000000..81355eaf04
--- /dev/null
+++ b/bitbake/lib/toaster/tests/functional/test_create_new_project.py
@@ -0,0 +1,134 @@
1#! /usr/bin/env python3 #
2# BitBake Toaster UI tests implementation
3#
4# Copyright (C) 2023 Savoir-faire Linux
5#
6# SPDX-License-Identifier: GPL-2.0-only
7#
8
9import re
10import pytest
11from django.urls import reverse
12from selenium.webdriver.support.ui import Select
13from tests.functional.functional_helpers import SeleniumFunctionalTestCase
14from orm.models import Project
15from selenium.webdriver.common.by import By
16
17@pytest.mark.django_db
18class TestCreateNewProject(SeleniumFunctionalTestCase):
19
20 def _create_test_new_project(
21 self,
22 project_name,
23 release,
24 release_title,
25 merge_toaster_settings,
26 ):
27 """ Create/Test new project using:
28 - Project Name: Any string
29 - Release: Any string
30 - Merge Toaster settings: True or False
31 """
32 self.get(reverse('newproject'))
33 self.driver.find_element(By.ID,
34 "new-project-name").send_keys(project_name)
35
36 select = Select(self.find('#projectversion'))
37 select.select_by_value(release)
38
39 # check merge toaster settings
40 checkbox = self.find('.checkbox-mergeattr')
41 if merge_toaster_settings:
42 if not checkbox.is_selected():
43 checkbox.click()
44 else:
45 if checkbox.is_selected():
46 checkbox.click()
47
48 self.driver.find_element(By.ID, "create-project-button").click()
49
50 element = self.wait_until_visible('#project-created-notification')
51 self.assertTrue(
52 self.element_exists('#project-created-notification'),
53 f"Project:{project_name} creation notification not shown"
54 )
55 self.assertTrue(
56 project_name in element.text,
57 f"New project name:{project_name} not in new project notification"
58 )
59 self.assertTrue(
60 Project.objects.filter(name=project_name).count(),
61 f"New project:{project_name} not found in database"
62 )
63
64 # check release
65 self.assertTrue(re.search(
66 release_title,
67 self.driver.find_element(By.XPATH,
68 "//span[@id='project-release-title']"
69 ).text),
70 'The project release is not defined')
71
72 def test_create_new_project_master(self):
73 """ Test create new project using:
74 - Project Name: Any string
75 - Release: Yocto Project master (option value: 3)
76 - Merge Toaster settings: False
77 """
78 release = '3'
79 release_title = 'Yocto Project master'
80 project_name = 'projectmaster'
81 self._create_test_new_project(
82 project_name,
83 release,
84 release_title,
85 False,
86 )
87
88 def test_create_new_project_kirkstone(self):
89 """ Test create new project using:
90 - Project Name: Any string
91 - Release: Yocto Project 4.0 "Kirkstone" (option value: 1)
92 - Merge Toaster settings: True
93 """
94 release = '1'
95 release_title = 'Yocto Project 4.0 "Kirkstone"'
96 project_name = 'projectkirkstone'
97 self._create_test_new_project(
98 project_name,
99 release,
100 release_title,
101 True,
102 )
103
104 def test_create_new_project_dunfull(self):
105 """ Test create new project using:
106 - Project Name: Any string
107 - Release: Yocto Project 3.1 "Dunfell" (option value: 5)
108 - Merge Toaster settings: False
109 """
110 release = '5'
111 release_title = 'Yocto Project 3.1 "Dunfell"'
112 project_name = 'projectdunfull'
113 self._create_test_new_project(
114 project_name,
115 release,
116 release_title,
117 False,
118 )
119
120 def test_create_new_project_local(self):
121 """ Test create new project using:
122 - Project Name: Any string
123 - Release: Local Yocto Project (option value: 2)
124 - Merge Toaster settings: True
125 """
126 release = '2'
127 release_title = 'Local Yocto Project'
128 project_name = 'projectlocal'
129 self._create_test_new_project(
130 project_name,
131 release,
132 release_title,
133 True,
134 )