-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_planing_loads.rb
71 lines (69 loc) · 2.78 KB
/
test_planing_loads.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
describe "dummy order planning" do
before(:all) do
@orders_page = Login.new.login_as DISPATCHER_LOGIN, DISPATCHER_PASSWORD
@load_page = @orders_page.open_planning
end
after(:all) do
@orders_page.close_browser
end
after(:each) do
@load_page.accept_browser_alert if @load_page.has_browser_alert
end
context "normal total volume" do
it "add order to morning shift" do
DB.add_dummy_order(MORNING, 1)
@load_page.type_date Time.now.strftime('%m/%d/%Y')
@load_page.select_shift 'morning'
@load_page.click_reopen if @load_page.get_load_status == "Planned for delivery"
@load_page.select_first_available_order
@load_page.click_submit
expect(@load_page.wait_submited_order_presence_in_table(LoadPlanning.planning_table_id)).to be true
end
it "complete load with added order" do
@load_page.click_complete
expect(@load_page.has_browser_alert(BROWSER_ALERT_COMPLETE_LOAD_SUCCESS)).to be true
end
it "add order to afternoon shift" do
DB.add_dummy_order(AFTERNOON, 1)
@load_page.type_date Time.now.strftime('%m/%d/%Y')
@load_page.select_shift 'afternoon'
@load_page.click_reopen if @load_page.get_load_status == "Planned for delivery"
@load_page.select_first_available_order
@load_page.click_submit
expect(@load_page.wait_submited_order_presence_in_table(LoadPlanning.planning_table_id)).to be true
end
it "complete load with added order" do
@load_page.click_complete
expect(@load_page.has_browser_alert(BROWSER_ALERT_COMPLETE_LOAD_SUCCESS)).to be true
end
it "add order to evening shift" do
DB.add_dummy_order(EVENING, 1)
@load_page.type_date Time.now.strftime('%m/%d/%Y')
@load_page.select_shift 'evening'
@load_page.click_reopen if @load_page.get_load_status == "Planned for delivery"
@load_page.select_first_available_order
@load_page.click_submit
expect(@load_page.wait_submited_order_presence_in_table(LoadPlanning.planning_table_id)).to be true
end
it "complete load with added order" do
@load_page.click_complete
expect(@load_page.has_browser_alert(BROWSER_ALERT_COMPLETE_LOAD_SUCCESS)).to be true
end
end
context "total volume too big" do
it "add order to morning shift" do
DB.add_dummy_order(MORNING, MAX_LOAD+1)
@load_page.type_date Time.now.strftime('%m/%d/%Y')
@load_page.select_shift 'morning'
@load_page.click_reopen if @load_page.get_load_status == "Planned for delivery"
@load_page.select_first_available_order
@load_page.click_submit
expect(@load_page.has_browser_alert(BROWSER_ALERT_CAPACITY_ERROR)).to be true
@load_page.accept_browser_alert
end
it "complete load with added order" do
@load_page.click_complete
expect(@load_page.has_browser_alert(BROWSER_ALERT_CAPACITY_ERROR)).to be true
end
end
end