Skip to content

Commit

Permalink
should be working now #16
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Maria Walach committed Jun 26, 2015
1 parent 3ac9cbd commit 01dc276
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 43 deletions.
7 changes: 7 additions & 0 deletions src/main/java/utils/CurrentCall.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main.java.utils;

public class CurrentCall {
public String callee;
public String inbound;
public String call_id;
}
2 changes: 1 addition & 1 deletion src/main/java/utils/ExternalCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class ExternalCall {
public String id;
public String current_call;
public CurrentCall current_call;
public String extension;

}
2 changes: 1 addition & 1 deletion src/main/java/utils/TestService.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static boolean hangUp(ExternalCall cust) {
public static boolean isCustomerInCall(ExternalCall cust) {
HttpResponse<JsonNode> response = null;
try {
response = Unirest.post(ADDRESS + "/resource/customer/" + cust.id)
response = Unirest.get(ADDRESS + "/resource/customer/" + cust.id)
.queryString("token", "canihazmagicplease").asJson();
if (response.getStatus() > 299)
return false;
Expand Down
82 changes: 70 additions & 12 deletions src/test/java/cases/BasicUseCases.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.nio.file.Paths;

import main.java.pom.Helpers;
import main.java.pom.home.Contacts;
import main.java.pom.home.Home;
import main.java.utils.ExternalCall;
import main.java.utils.Receptionist;
import main.java.utils.TestService;
Expand Down Expand Up @@ -70,6 +72,7 @@ public void tearDown() {
TestService.releaseCustomer(customer);
TestService.releaseCustomer(employee);
Helpers.waiting(200);
driver.quit();
}

@Test
Expand All @@ -80,12 +83,24 @@ public void should_call_specific_employee() {
+ Constants.DEFAULT_COMPANY);

TestService.dial(customer);
Helpers.waiting(2000);
Helpers.waiting(6000);
HomeView.checkCallQueue(1, driver);

System.out.println("Receptionist pick up the call.");
ShortcutsView.pickup(driver);
Helpers.waiting(2000);
for (int i = 0; i < 5; i++) {
if (Home.opts_Calls(driver).size() == 1) {
break;
} else {
System.out
.println("Receptionist failed to picked up, trying again.");
Helpers.waiting(1000);
ShortcutsView.pickup(driver);

}
}
HomeView.checkMyCalls(1, driver);

System.out
.println("Customer asks for: " + Constants.DEFAULT_EMPLOYEE_1);
Expand All @@ -107,11 +122,20 @@ public void should_call_specific_employee() {
+ Constants.DEFAULT_EMPLOYEE_1);

Helpers.waiting(500);
// HomeView.callSelectedPerson(driver);
TestService.dial_ext(employee, rep);
HomeView.callNumber(driver, employee.extension);

Helpers.waiting(2000);
for (int i = 0; i < 5; i++) {
if (Home.opts_Calls(driver).size() == 2) {
break;
} else {
System.out.println("Receptionist failed to call, wait.");
Helpers.waiting(1000);
}
}
HomeView.checkMyCalls(2, driver);

System.out.println(Constants.DEFAULT_EMPLOYEE_1 + " answers");
Helpers.waiting(1000);
TestService.pickup(employee);
Helpers.waiting(1000);

Expand Down Expand Up @@ -141,12 +165,24 @@ public void should_call_specific_employee_by_keywords() {
+ Constants.DEFAULT_COMPANY);

TestService.dial(customer);
Helpers.waiting(2000);
Helpers.waiting(6000);
HomeView.checkCallQueue(1, driver);

System.out.println("Receptionist pick up the call.");
ShortcutsView.pickup(driver);
Helpers.waiting(2000);
for (int i = 0; i < 5; i++) {
if (Home.opts_Calls(driver).size() == 1) {
break;
} else {
System.out
.println("Receptionist failed to picked up, trying again.");
Helpers.waiting(1000);
ShortcutsView.pickup(driver);

}
}
HomeView.checkMyCalls(1, driver);

System.out.println("Customer asks for someone with knowledge about: "
+ Constants.DEFAULT_KEYWORD);
Expand All @@ -155,6 +191,7 @@ public void should_call_specific_employee_by_keywords() {
Common.sendToLastActiveElement(Constants.DEFAULT_KEYWORD, driver);

System.out.println("Receptionist checks, if employee is available.");
Helpers.waiting(1000);

ShortcutsView.switchToCompanyCalendar(driver);
HomeView.checkCalendar(Constants.CALENDAR_ENTRIES_BS, driver);
Expand All @@ -163,16 +200,19 @@ public void should_call_specific_employee_by_keywords() {
HomeView.checkContactEvents(Constants.EVENTS_ENTRIES_THOMAS, driver);

System.out.println("Receptionist informs, that employee is available.");
ShortcutsView.park(driver);

System.out.println("Receptionist calls: "
+ Constants.DEFAULT_EMPLOYEE_2);

Helpers.waiting(500);
// HomeView.callSelectedPerson(driver);
TestService.dial_ext(employee, rep);
HomeView.callNumber(driver, employee.extension);

System.out.println(Constants.DEFAULT_EMPLOYEE_2 + " answers");
Helpers.waiting(2000);
HomeView.checkMyCalls(2, driver);
Helpers.waiting(1000);

System.out.println(Constants.DEFAULT_EMPLOYEE_2 + " answers");
TestService.pickup(employee);
Helpers.waiting(1000);

Expand Down Expand Up @@ -203,19 +243,32 @@ public void should_find_another_employee() {
+ Constants.DEFAULT_COMPANY);

TestService.dial(customer);
Helpers.waiting(2000);
Helpers.waiting(6000);
HomeView.checkCallQueue(1, driver);

System.out.println("Receptionist pick up the call.");
ShortcutsView.pickup(driver);
Helpers.waiting(2000);
for (int i = 0; i < 5; i++) {
if (Home.opts_Calls(driver).size() == 1) {
break;
} else {
System.out
.println("Receptionist failed to picked up, trying again.");
Helpers.waiting(1000);
ShortcutsView.pickup(driver);

}
}
HomeView.checkMyCalls(1, driver);

System.out
.println("Customer asks for: " + Constants.DEFAULT_EMPLOYEE_2);
ShortcutsView.switchToSearch(driver);
Common.sendToLastActiveElement(Constants.DEFAULT_EMPLOYEE_2, driver);

System.out.println("Receptionist checks, if employee is available.");
Helpers.waiting(1000);

ShortcutsView.switchToCompanyCalendar(driver);
HomeView.checkCalendar(Constants.CALENDAR_ENTRIES_BS, driver);
Expand All @@ -229,10 +282,12 @@ public void should_find_another_employee() {
System.out
.println("Customer asks for: " + Constants.DEFAULT_EMPLOYEE_1);
ShortcutsView.switchToSearch(driver);
Contacts.txt_fd_SearchContact(driver).clear();
Common.sendToLastActiveElement(Constants.DEFAULT_EMPLOYEE_1, driver);

System.out
.println("Receptionist checks, if another employee is available.");
Helpers.waiting(1000);

ShortcutsView.switchToContactCalendar(driver);
HomeView.checkContactEvents(Constants.EVENTS_ENTRIES_KIM, driver);
Expand All @@ -242,16 +297,19 @@ public void should_find_another_employee() {

System.out
.println("Receptionist informs, that another employee is available.");
ShortcutsView.park(driver);

System.out.println("Receptionist calls: "
+ Constants.DEFAULT_EMPLOYEE_1);

Helpers.waiting(500);
// HomeView.callSelectedPerson(driver);
TestService.dial_ext(employee, rep);
HomeView.callNumber(driver, employee.extension);

System.out.println(Constants.DEFAULT_EMPLOYEE_1 + " answers");
Helpers.waiting(2000);
HomeView.checkMyCalls(2, driver);
Helpers.waiting(1000);

System.out.println(Constants.DEFAULT_EMPLOYEE_1 + " answers");
TestService.pickup(employee);
Helpers.waiting(1000);

Expand Down
60 changes: 46 additions & 14 deletions src/test/java/cases/EmployeeHatesYouUseCases.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.nio.file.Paths;

import main.java.pom.Helpers;
import main.java.pom.home.Home;
import main.java.pom.home.Message;
import main.java.utils.ExternalCall;
import main.java.utils.Receptionist;
Expand Down Expand Up @@ -82,20 +83,32 @@ public void should_leave_message() {
System.out.println("Customer calls company: "
+ Constants.DEFAULT_COMPANY);
TestService.dial(customer);
Helpers.waiting(3000);
Helpers.waiting(6000);
HomeView.checkCallQueue(1, driver);

System.out.println("Receptionist pick up the call.");
ShortcutsView.pickup(driver);
Helpers.waiting(2000);
for (int i = 0; i < 5; i++) {
if (Home.opts_Calls(driver).size() == 1) {
break;
} else {
System.out
.println("Receptionist failed to picked up, trying again.");
Helpers.waiting(1000);
ShortcutsView.pickup(driver);

}
}
HomeView.checkMyCalls(1, driver);

System.out
.println("Customer asks for: " + Constants.DEFAULT_EMPLOYEE_1);
ShortcutsView.switchToSearch(driver);
Common.sendToLastActiveElement(Constants.DEFAULT_EMPLOYEE_1, driver);

System.out.println("Receptionist checks, if employee is available.");

Helpers.waiting(1000);
ShortcutsView.switchToContactCalendar(driver);
HomeView.checkContactEvents(Constants.EVENTS_ENTRIES_KIM, driver);

Expand Down Expand Up @@ -123,20 +136,31 @@ public void should_not_answer() {
System.out.println("Customer calls company: "
+ Constants.DEFAULT_COMPANY);
TestService.dial(customer);
Helpers.waiting(3000);
Helpers.waiting(6000);
HomeView.checkCallQueue(1, driver);

System.out.println("Receptionist pick up the call.");
ShortcutsView.pickup(driver);
Helpers.waiting(2000);

for (int i = 0; i < 5; i++) {
if (Home.opts_Calls(driver).size() == 1) {
break;
} else {
System.out
.println("Receptionist failed to picked up, trying again.");
Helpers.waiting(1000);
ShortcutsView.pickup(driver);

}
}
HomeView.checkMyCalls(1, driver);
System.out
.println("Customer asks for: " + Constants.DEFAULT_EMPLOYEE_1);
ShortcutsView.switchToSearch(driver);
Common.sendToLastActiveElement(Constants.DEFAULT_EMPLOYEE_1, driver);

System.out.println("Receptionist checks, if employee is available.");

Helpers.waiting(1000);
ShortcutsView.switchToContactCalendar(driver);
HomeView.checkContactEvents(Constants.EVENTS_ENTRIES_KIM, driver);

Expand All @@ -150,11 +174,9 @@ public void should_not_answer() {
System.out.println("Receptionist calls: "
+ Constants.DEFAULT_EMPLOYEE_1);

// HomeView.callSelectedPerson(driver);
TestService.dial_ext(employee, rep);
// TODO should not answer
HomeView.callNumber(driver, employee.extension);

Helpers.waiting(1000);
Helpers.waiting(2000);
HomeView.checkMyCalls(2, driver);

System.out.println(Constants.DEFAULT_EMPLOYEE_1 + " doesnt't answer.");
Expand All @@ -178,20 +200,32 @@ public void should_refuse_contact() {
System.out.println("Customer calls company: "
+ Constants.DEFAULT_COMPANY);
TestService.dial(customer);
Helpers.waiting(3000);
Helpers.waiting(6000);
HomeView.checkCallQueue(1, driver);

System.out.println("Receptionist pick up the call.");
ShortcutsView.pickup(driver);
Helpers.waiting(2000);
for (int i = 0; i < 5; i++) {
if (Home.opts_Calls(driver).size() == 1) {
break;
} else {
System.out
.println("Receptionist failed to picked up, trying again.");
Helpers.waiting(1000);
ShortcutsView.pickup(driver);

}
}
HomeView.checkMyCalls(1, driver);

System.out
.println("Customer asks for: " + Constants.DEFAULT_EMPLOYEE_1);
ShortcutsView.switchToSearch(driver);
Common.sendToLastActiveElement(Constants.DEFAULT_EMPLOYEE_1, driver);

System.out.println("Receptionist checks, if employee is available.");

Helpers.waiting(1000);
ShortcutsView.switchToContactCalendar(driver);
HomeView.checkContactEvents(Constants.EVENTS_ENTRIES_KIM, driver);

Expand All @@ -205,9 +239,7 @@ public void should_refuse_contact() {
System.out.println("Receptionist calls: "
+ Constants.DEFAULT_EMPLOYEE_1);

// HomeView.callSelectedPerson(driver);
TestService.dial_ext(employee, rep);

HomeView.callNumber(driver, employee.extension);
Helpers.waiting(3000);
HomeView.checkMyCalls(2, driver);

Expand Down
Loading

0 comments on commit 01dc276

Please sign in to comment.