Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
1
1606889830-practice
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
PMPL
Collection of Practice
2019
1606889830-practice
Merge requests
!7
Latihan 5 – Input Validation dan Test Organization
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Latihan 5 – Input Validation dan Test Organization
exercise_5
into
master
Overview
0
Commits
6
Pipelines
1
Changes
10
Merged
LUTHFI DZAKY SAIFUDDIN
requested to merge
exercise_5
into
master
5 years ago
Overview
0
Commits
6
Pipelines
1
Changes
10
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
1fa91823
6 commits,
5 years ago
10 files
+
230
−
129
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
10
Search (e.g. *.vue) (Ctrl+P)
functional_tests/base.py
0 → 100644
+
46
−
0
Options
from
selenium
import
webdriver
from
django.contrib.staticfiles.testing
import
StaticLiveServerTestCase
from
selenium.webdriver.common.keys
import
Keys
from
selenium.webdriver.chrome.options
import
Options
from
selenium.common.exceptions
import
WebDriverException
from
unittest
import
skip
import
time
MAX_WAIT
=
10
class
FunctionalTest
(
StaticLiveServerTestCase
):
def
setUp
(
self
):
chrome_options
=
Options
()
chrome_options
.
add_argument
(
'
--dns-prefetch-disable
'
)
chrome_options
.
add_argument
(
'
--no-sandbox
'
)
chrome_options
.
add_argument
(
'
--headless
'
)
chrome_options
.
add_argument
(
'
disable-gpu
'
)
self
.
browser
=
webdriver
.
Chrome
(
executable_path
=
"
./chromedriver
"
,
options
=
chrome_options
)
print
(
self
.
live_server_url
)
def
tearDown
(
self
):
self
.
browser
.
quit
()
def
wait_for_row_in_list_table
(
self
,
row_text
):
start_time
=
time
.
time
()
while
True
:
try
:
table
=
self
.
browser
.
find_element_by_id
(
'
id_list_table
'
)
rows
=
table
.
find_elements_by_tag_name
(
'
tr
'
)
self
.
assertIn
(
row_text
,
[
row
.
text
for
row
in
rows
])
return
except
(
AssertionError
,
WebDriverException
)
as
e
:
if
time
.
time
()
-
start_time
>
MAX_WAIT
:
raise
e
time
.
sleep
(
0.5
)
def
wait_for
(
self
,
fn
):
start_time
=
time
.
time
()
while
True
:
try
:
return
fn
()
except
(
AssertionError
,
WebDriverException
)
as
e
:
if
time
.
time
()
-
start_time
>
MAX_WAIT
:
raise
e
time
.
sleep
(
0.5
)
Loading