Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Testing-Sonarqube1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Tjahyadi
Testing-Sonarqube1
Commits
2c9fe8a9
Commit
2c9fe8a9
authored
1 year ago
by
Felix Tjahyadi
Browse files
Options
Downloads
Patches
Plain Diff
testmore#4
parent
b66338e5
No related branches found
No related tags found
No related merge requests found
Pipeline
#195203
failed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stock_monitoring/tests/test_selenium.py
+6
-6
6 additions, 6 deletions
stock_monitoring/tests/test_selenium.py
with
6 additions
and
6 deletions
stock_monitoring/tests/test_selenium.py
+
6
−
6
View file @
2c9fe8a9
from
django.test
import
LiveServerTestCase
from
stock_monitoring.models
import
Barang
,
Pergerakan
from
stock_monitoring.models
import
Obat
from
selenium
import
webdriver
from
selenium.webdriver.chrome.options
import
Options
from
selenium.webdriver.common.keys
import
Keys
...
...
@@ -13,8 +13,8 @@ class SeleniumShowAllBarangTestCase(LiveServerTestCase):
self
.
driver
.
implicitly_wait
(
10
)
# Implicit wait to handle dynamic elements
# Create some Barang objects for testing pagination
Barang
.
objects
.
create
(
barang_id
=
"
a
"
,
barang_nama
=
'
Product A
'
,
barang_qty
=
100
,
barang_expired
=
'
2024-06-30
'
,
barang_kondisi
=
'
New
'
,
barang_jenis
=
'
Type A
'
,
barang_unit
=
'
Unit A
'
,
barang_gambar
=
'
ristek.link/panadol
'
)
Barang
.
objects
.
create
(
barang_id
=
"
b
"
,
barang_nama
=
'
Product B
'
,
barang_qty
=
50
,
barang_expired
=
'
2024-08-15
'
,
barang_kondisi
=
'
Used
'
,
barang_jenis
=
'
Type B
'
,
barang_unit
=
'
Unit B
'
,
barang_gambar
=
'
ristek.link/panadol
'
)
Obat
.
objects
.
create
(
barang_id
=
"
a
"
,
barang_nama
=
'
Product A
'
,
barang_qty
=
100
,
barang_expired
=
'
2024-06-30
'
,
barang_kondisi
=
'
New
'
,
barang_jenis
=
'
Type A
'
,
barang_unit
=
'
Unit A
'
,
barang_gambar
=
'
ristek.link/panadol
'
)
Obat
.
objects
.
create
(
barang_id
=
"
b
"
,
barang_nama
=
'
Product B
'
,
barang_qty
=
50
,
barang_expired
=
'
2024-08-15
'
,
barang_kondisi
=
'
Used
'
,
barang_jenis
=
'
Type B
'
,
barang_unit
=
'
Unit B
'
,
barang_gambar
=
'
ristek.link/panadol
'
)
def
test_show_all_barang_pagination
(
self
):
# Open the browser and navigate to the live server
...
...
@@ -53,7 +53,7 @@ class SeleniumShowAllBarangTestCase(LiveServerTestCase):
def
test_show_all_barang_empty_object
(
self
):
# Positive Test
# Delete all Barang objects to simulate an empty database
Barang
.
objects
.
all
().
delete
()
Obat
.
objects
.
all
().
delete
()
# Make a request to the view
self
.
driver
.
get
(
self
.
live_server_url
+
'
/stock_monitoring/
'
)
...
...
@@ -90,7 +90,7 @@ class SeleniumShowDetailBarangTestCase(LiveServerTestCase):
self
.
driver
.
implicitly_wait
(
10
)
# Implicit wait to handle dynamic elements
# Create some Barang objects for testing
self
.
barang_1
=
Barang
.
objects
.
create
(
self
.
barang_1
=
Obat
.
objects
.
create
(
barang_id
=
"
one
"
,
barang_nama
=
'
Barang 1
'
,
barang_qty
=
100
,
...
...
@@ -101,7 +101,7 @@ class SeleniumShowDetailBarangTestCase(LiveServerTestCase):
barang_gambar
=
'
ristek.link/obat_1
'
)
self
.
barang_2
=
Barang
.
objects
.
create
(
self
.
barang_2
=
Obat
.
objects
.
create
(
barang_id
=
"
two
"
,
barang_nama
=
'
Barang 2
'
,
barang_qty
=
100
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment