Skip to content

Commit dee56de

Browse files
committed
fixed the tests, but the website is not working, POST /register api throws 500 due to which the error is not shown
1 parent 27cde2e commit dee56de

5 files changed

Lines changed: 84 additions & 8 deletions

File tree

docker-compose-toolshop-new.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
version: '2'
2+
services:
3+
laravel-api:
4+
image: testsmith/practice-software-testing-sprint5-api
5+
environment:
6+
- "PHP_OPCACHE_VALIDATE_TIMESTAMPS=1"
7+
- "DB_PORT=3306"
8+
- "DB_HOST=mariadb"
9+
- "host=localhost"
10+
- DISABLE_LOGGING=${DISABLE_LOGGING}
11+
volumes:
12+
- laravel-app-code:/var/www
13+
14+
angular-ui:
15+
image: testsmith/practice-software-testing-sprint5-ui
16+
ports:
17+
- 4200:4200
18+
command: >
19+
bash -c "ng serve --host 0.0.0.0 --port 4200"
20+
21+
# The Web Server
22+
web:
23+
image: testsmith/practice-software-testing-web
24+
ports:
25+
- 8091:80
26+
- 8000:81
27+
depends_on:
28+
- laravel-api
29+
30+
cron:
31+
image: testsmith/practice-software-testing-cron
32+
restart: always
33+
depends_on:
34+
- mariadb
35+
- laravel-api
36+
volumes:
37+
- laravel-app-code:/var/www
38+
working_dir: /var/www
39+
command: sh -c "crond -f -l 8"
40+
environment:
41+
- "PHP_OPCACHE_VALIDATE_TIMESTAMPS=1"
42+
- "DB_PORT=3306"
43+
- "DB_HOST=mariadb"
44+
- "host=localhost"
45+
- DISABLE_LOGGING=${DISABLE_LOGGING}
46+
47+
mariadb:
48+
image: yobasystems/alpine-mariadb:10.6.11
49+
ports:
50+
- 3306:3306
51+
expose:
52+
- 3306
53+
environment:
54+
MYSQL_ROOT_PASSWORD: root
55+
MYSQL_USER: user
56+
MYSQL_PASSWORD: root
57+
MYSQL_DATABASE: toolshop
58+
59+
mailcatcher:
60+
image: dockage/mailcatcher:0.9.0
61+
ports:
62+
- 1025:1025 # smtp server
63+
- 1080:1080 # web ui
64+
65+
volumes:
66+
laravel-app-code:

src/test/java/io/github/mfaisalkhatri/data/RegistrationData.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class RegistrationData {
1111
private String lastName;
1212
private String dob;
1313
private String street;
14+
private String houseNumber;
1415
private String postalCode;
1516
private String city;
1617
private String state;

src/test/java/io/github/mfaisalkhatri/pages/RegistrationPage.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ public void fillRegistrationForm (final RegistrationData registrationData) {
2929
lastNameField ().clear ();
3030
lastNameField ().sendKeys (registrationData.getLastName ());
3131
dobField ().sendKeys (registrationData.getDob ());
32-
streetField ().clear ();
33-
streetField ().sendKeys (registrationData.getStreet ());
32+
selectCountryVisibleText (registrationData.getCountry ());
3433
postalCodeField ().clear ();
3534
postalCodeField ().sendKeys (registrationData.getPostalCode ());
36-
cityField ().clear ();
37-
cityField ().sendKeys (registrationData.getCity ());
38-
stateField ().clear ();
39-
stateField ().sendKeys (registrationData.getState ());
40-
selectCountryVisibleText (registrationData.getCountry ());
35+
houseNumber().clear();
36+
houseNumber().sendKeys(registrationData.getHouseNumber());
37+
//streetField ().clear ();
38+
//streetField ().sendKeys (registrationData.getStreet ());
39+
//cityField ().clear ();
40+
//cityField ().sendKeys (registrationData.getCity ());
41+
//stateField ().clear ();
42+
//stateField ().sendKeys (registrationData.getState ());
4143
phoneField ().clear ();
4244
phoneField ().sendKeys (registrationData.getPhone ());
4345
emailAddressField ().clear ();
@@ -103,6 +105,10 @@ private WebElement registerButton () {
103105
return this.driver.findElement (By.cssSelector (".btnSubmit"));
104106
}
105107

108+
private WebElement houseNumber () {
109+
return this.driver.findElement(By.id("house_number"));
110+
}
111+
106112
private void selectCountryVisibleText (final String countryName) {
107113
new Select (countryField ()).selectByVisibleText (countryName);
108114
}

src/test/java/io/github/mfaisalkhatri/test/BaseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public WebDriver getDriver () {
2121
@BeforeClass
2222
public void setup () {
2323
ChromeOptions chromeOptions = new ChromeOptions ();
24-
chromeOptions.addArguments ("--headless=new","--no-sandbox","--window-size=1920,1080");
24+
//chromeOptions.addArguments ("--headless=new","--no-sandbox","--window-size=1920,1080");
2525

2626
this.driver = new ChromeDriver (chromeOptions);
2727
this.driver.manage ()

src/test/resources/testdata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"dob": "1987-11-19",
77
"street": "11/2, Fort Street",
88
"postalCode": "113445",
9+
"houseNumber": 25,
910
"city": "California",
1011
"state": "Holland",
1112
"country": "Benin",
@@ -20,6 +21,7 @@
2021
"dob": "1985-04-23",
2122
"street": "21/4, Dallas Street",
2223
"postalCode": "12976",
24+
"houseNumber": 11,
2325
"city": "California",
2426
"state": "Dallas",
2527
"country": "American Samoa",
@@ -35,6 +37,7 @@
3537
"street": "30/2, Texas Street",
3638
"postalCode": "155642",
3739
"city": "California",
40+
"houseNumber": 30,
3841
"state": "Duckberg",
3942
"country": "Austria",
4043
"phone": "0483678",

0 commit comments

Comments
 (0)