Skip to content

Commit 04dc8cd

Browse files
author
Matécsa Dániel
committed
Selenium testing started
1 parent c0d5f32 commit 04dc8cd

5 files changed

Lines changed: 110 additions & 23 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM ubuntu:24.04
2+
3+
# Install dependencies
4+
RUN apt-get update && apt-get install -y curl unzip wget gnupg2 software-properties-common \
5+
fonts-dejavu fonts-liberation fonts-noto
6+
7+
ENV LANG=C.UTF-8
8+
ENV LC_ALL=C.UTF-8
9+
10+
# Install Java
11+
RUN add-apt-repository ppa:openjdk-r/ppa && \
12+
apt-get update && \
13+
apt-get install -y openjdk-8-jdk
14+
15+
# Install Gradle
16+
ENV GRADLE_VERSION=7.4
17+
RUN wget -q https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip && \
18+
unzip gradle-$GRADLE_VERSION-bin.zip && \
19+
rm gradle-$GRADLE_VERSION-bin.zip && \
20+
mv gradle-$GRADLE_VERSION /opt/gradle && \
21+
ln -s /opt/gradle/bin/gradle /usr/bin/gradle
22+
23+
# Set environment variables
24+
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
25+
ENV GRADLE_HOME=/opt/gradle
26+
27+
# Add Gradle and Java to PATH
28+
ENV PATH=$PATH:$GRADLE_HOME/bin:$JAVA_HOME/bin
29+
30+
RUN apt-get update && apt-get install -y sudo
31+
32+
ARG uid
33+
ARG UNAME=selenium
34+
35+
RUN usermod -l $UNAME ubuntu && \
36+
usermod -d /home/$UNAME -m $UNAME && \
37+
groupmod -n $UNAME ubuntu && \
38+
usermod -aG sudo $UNAME && \
39+
usermod -g $UNAME $UNAME && \
40+
if ! id -u $UID >/dev/null 2>&1; then \
41+
usermod -u $UID $UNAME; \
42+
fi && \
43+
chown -R $UNAME:$UNAME /home/$UNAME
44+
45+
ENV TZ=Europe/Budapest
46+
ENV DEBIAN_FRONTEND=noninteractive
47+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
48+
49+
USER $UNAME
50+
WORKDIR /home/$UNAME
51+
ENV HOME=/home/$UNAME
52+
53+
CMD ["/bin/bash"]

docker-compose.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: "3.8"
2+
3+
services:
4+
selenium:
5+
image: selenium/standalone-chrome:latest
6+
container_name: docker-sandbox-selenium2
7+
shm_size: 2gb
8+
environment:
9+
- LANG=C.UTF-8
10+
- LC_ALL=C.UTF-8
11+
- SE_VNC_NO_PASSWORD=1
12+
- SE_SCREEN_WIDTH=1800
13+
- SE_SCREEN_HEIGHT=960
14+
- SE_NODE_MAX_SESSIONS=5
15+
- SE_NODE_OVERRIDE_MAX_SESSIONS=true
16+
ports:
17+
- "4444:4444"
18+
- "7900:7900"
19+
20+
ubuntu:
21+
build:
22+
context: .
23+
args:
24+
uid: ${USER_ID:-1000}
25+
container_name: docker-sandbox-ubuntu2
26+
stdin_open: true
27+
tty: true
28+
volumes:
29+
- ./tests:/home/selenium/tests
30+
depends_on:
31+
- selenium

points.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# ============================================================
99

1010
student:
11-
website_under_test: ""
11+
website_under_test: "https://sandbox.moodledemo.net"
1212

1313

1414
# ----------------------------------------------------------
@@ -33,47 +33,47 @@ ai_usage:
3333
# ----------------------------------------------------------
3434
quality:
3535
gitignore: # required for grade 2+
36-
done: false
36+
done: true
3737
description: "Unnecessary files are ignored (.gitignore covers build output, IDE files, etc.)"
3838

3939
structured_code: # required for grade 3+
40-
done: false
40+
done: true
4141
description: "Code is organized into classes and functions, not one big file"
4242

4343
readable_code: # required for grade 4+
44-
done: false
44+
done: true
4545
description: "Function and method names describe what they do, test suite reads like a test description"
4646

4747
low_redundancy: # required for grade 5
48-
done: false
48+
done: true
4949
description: "Minimal code duplication, shared logic is extracted into reusable methods"
5050

5151
# ----------------------------------------------------------
5252
# Basic tasks (B)
5353
# ----------------------------------------------------------
5454
basic:
5555
login_form: # 3 pts | once
56-
done: false
56+
done: true
5757
description: "Fill a simple form and submit it (e.g. login with username and password)"
5858

5959
form_with_user: # 3 pts | once
60-
done: false
60+
done: true
6161
description: "Submit a form that requires a registered/logged-in user"
6262

6363
logout: # 2 pts | once
64-
done: false
64+
done: true
6565
description: "Log out from the application and verify it"
6666

6767
fill_input: # 1 pt each | repeatable | max 10
68-
count: 0
68+
count: 2
6969
description: "Fill an input field (text, radio, checkbox, date, etc.) — each different type counts as one"
7070

7171
send_form: # 1 pt each | repeatable | max 10
72-
count: 0
72+
count: 1
7373
description: "Submit a form (each distinct form counts as one)"
7474

7575
static_page_test: # 2 pts | once
76-
done: false
76+
done: true
7777
description: "Test a static page (verify text content, element presence, etc.)"
7878

7979
multiple_page_test: # 3 pts | once
@@ -98,50 +98,50 @@ basic:
9898
description: "Select or verify a radio button"
9999

100100
at_least_4_classes: # 3 pts | once
101-
done: false
101+
done: true
102102
description: "Project has at least 4 Java classes"
103103

104104
at_least_6_classes: # 3 pts | once
105-
done: false
105+
done: true
106106
description: "Project has at least 6 Java classes (cumulative with above)"
107107

108108
at_least_8_classes: # 3 pts | once
109-
done: false
109+
done: true
110110
description: "Project has at least 8 Java classes (cumulative with above)"
111111

112112
explicit_wait: # 3 pts | once
113-
done: false
113+
done: true
114114
description: "Use explicit wait (WebDriverWait with ExpectedConditions)"
115115
link: "https://www.selenium.dev/documentation/webdriver/waits/"
116116

117117
page_title: # 1 pt | once
118-
done: false
118+
done: true
119119
description: "Read and verify the page title using getTitle()"
120120

121121
page_object_pattern: # 3 pts | once
122-
done: false
122+
done: true
123123
description: "Use Page Object pattern with at least 2 page classes"
124124
link: "https://www.selenium.dev/documentation/test_practices/encouraged/page_object_models/"
125125

126126
base_page_class: # 1 pt | once
127-
done: false
127+
done: true
128128
description: "Create a BasePage class that other page classes extend"
129129

130130
readable_tests: # 3 pts | once
131-
done: false
131+
done: true
132132
description: "Test methods have descriptive names so the suite reads like a test specification"
133133

134134
# ----------------------------------------------------------
135135
# Advanced tasks (A)
136136
# ----------------------------------------------------------
137137
advanced:
138138
webdriver_config: # 4 pts | once
139-
done: false
139+
done: true
140140
description: "Configure WebDriver with custom options (e.g. ChromeOptions, window size, user agent)"
141141
link: "https://www.selenium.dev/documentation/webdriver/drivers/options/"
142142

143143
cookie_manipulation: # 6 pts | once
144-
done: false
144+
done: true
145145
description: "Manipulate cookies meaningfully (e.g. add/delete/read cookies, skip consent popup)"
146146
link: "https://www.selenium.dev/documentation/webdriver/interactions/cookies/"
147147

@@ -175,15 +175,15 @@ advanced:
175175
description: "Verify an e-mail was sent (e.g. registration activation link, password reset)"
176176

177177
random_data: # 8 pts | once
178-
done: false
178+
done: true
179179
description: "Generate random test data (e.g. random username, email) and use it in a test"
180180

181181
download_files: # 12 pts | once
182182
done: false
183183
description: "Download one or more files to a folder and verify they were saved"
184184

185185
config_file: # 6 pts | once
186-
done: false
186+
done: true
187187
description: "Store test settings in an external file (e.g. .properties, .yml, or .env) and read them at runtime — things like base URL, username, password, browser type. No hardcoded values in your test code"
188188

189189
javascript_executor: # 4 pts | once

tests/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

0 commit comments

Comments
 (0)