Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 2c9fe8a9 authored by Felix Tjahyadi's avatar Felix Tjahyadi
Browse files

testmore#4

parent b66338e5
No related branches found
No related tags found
No related merge requests found
Pipeline #195203 failed
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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment