Skip to content

Commit bd8ecfa

Browse files
committed
Merge remote-tracking branch 'IntionLee/master'
# Conflicts: # Back-end/public/js/scripts.js
2 parents a5497f7 + 3accaee commit bd8ecfa

9 files changed

+201
-3
lines changed

Back-end/glup.bat

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
gulp
2+
pause

Back-end/public/js/scripts.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Empty JS for your own code to be here
1+
// Empty JS for your own code to be here
22

33
$(document).ready(function() {
44
// login页面,忘记账户/密码
@@ -60,7 +60,7 @@ $(document).ready(function() {
6060
for (var j = 0; j < $inputs.length; j++) {
6161
$($inputs[j]).val('');
6262
}
63-
window.location.reload();
63+
window.location.reload();
6464
}
6565
});
6666
}
@@ -220,7 +220,7 @@ $(document).ready(function() {
220220
for (var j = 0; j < $inputs.length; j++) {
221221
$($inputs[j]).val('');
222222
}
223-
window.location.reload();
223+
window.location.reload();
224224
}
225225
});
226226
}

Testing/Testing Code/test_chief.java

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package test1;
2+
3+
import com.thoughtworks.selenium.*;
4+
import org.junit.After;
5+
import org.junit.Before;
6+
import org.junit.Test;
7+
import static org.junit.Assert.*;
8+
import java.util.regex.Pattern;
9+
10+
public class test_chief extends SeleneseTestCase {
11+
private Selenium selenium;
12+
13+
@Before
14+
public void setUp() throws Exception {
15+
//selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:9000/");
16+
selenium = new DefaultSelenium("localhost", 4444, "*googlechrome", "http://localhost:9000/");
17+
selenium.start();
18+
}
19+
20+
@Test
21+
public void testTest_chief() throws Exception {
22+
selenium.open("/");
23+
selenium.type("id=name", "test_chief");
24+
selenium.type("id=password", "test_chief");
25+
selenium.click("css=button.btn.btn-default");
26+
selenium.waitForPageToLoad("30000");
27+
selenium.click("css=a.btn.btn-default");
28+
selenium.waitForPageToLoad("30000");
29+
selenium.addSelection("id=waiting-list", "label=dish3");
30+
selenium.click("css=button.btn.btn-default");
31+
assertEquals("쌈데냥묘", selenium.getAlert());
32+
selenium.addSelection("id=waiting-list", "label=dish2");
33+
selenium.click("link=朞淃");
34+
selenium.click("css=div.col-md-6.body-main");
35+
selenium.click("css=button.btn.btn-default");
36+
assertEquals("쌈데냥묘", selenium.getAlert());
37+
selenium.click("link=朞淃");
38+
selenium.click("link=쌈데");
39+
selenium.waitForPageToLoad("30000");
40+
selenium.click("link=看女");
41+
selenium.waitForPageToLoad("30000");
42+
selenium.click("link=朞淃");
43+
selenium.click("link=되놔");
44+
selenium.waitForPageToLoad("30000");
45+
}
46+
47+
@After
48+
public void tearDown() throws Exception {
49+
selenium.stop();
50+
}
51+
}
+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package test1;
2+
3+
import com.thoughtworks.selenium.*;
4+
import org.junit.After;
5+
import org.junit.Before;
6+
import org.junit.Test;
7+
import static org.junit.Assert.*;
8+
import java.util.regex.Pattern;
9+
10+
public class test_manager extends SeleneseTestCase {
11+
private Selenium selenium;
12+
13+
@Before
14+
public void setUp() throws Exception {
15+
//selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:9000/");
16+
selenium = new DefaultSelenium("localhost", 4444, "*googlechrome", "http://localhost:9000/");
17+
selenium.start();
18+
}
19+
20+
@Test
21+
public void testTest_manager() throws Exception {
22+
selenium.open("/");
23+
selenium.type("id=name", "test_manager");
24+
selenium.type("id=password", "test_manager");
25+
selenium.click("css=button.btn.btn-default");
26+
selenium.waitForPageToLoad("30000");
27+
selenium.click("css=a.btn.btn-default");
28+
selenium.waitForPageToLoad("30000");
29+
selenium.type("id=dishName", "test_dish1");
30+
selenium.type("name=dish[price]", "10");
31+
selenium.type("id=quantity", "20");
32+
selenium.click("css=button.btn.btn-default");
33+
selenium.waitForPageToLoad("30000");
34+
selenium.click("css=a.btn.btn-default");
35+
selenium.waitForPageToLoad("30000");
36+
selenium.type("id=dishName", "test_dish2");
37+
selenium.type("name=dish[price]", "20");
38+
selenium.type("id=quantity", "100");
39+
selenium.click("css=button.btn.btn-default");
40+
selenium.waitForPageToLoad("30000");
41+
selenium.click("xpath=(//a[contains(text(),'修改菜品库存')])[2]");
42+
selenium.waitForPageToLoad("30000");
43+
selenium.click("name=dish-check");
44+
selenium.type("name=count", "10");
45+
selenium.click("//button[@type='submit']");
46+
assertEquals("修改成功", selenium.getAlert());
47+
selenium.click("name=dish-check");
48+
selenium.click("xpath=(//input[@name='dish-check'])[2]");
49+
selenium.type("name=count", "20");
50+
selenium.type("xpath=(//input[@name='count'])[2]", "20");
51+
selenium.click("//button[@type='submit']");
52+
assertEquals("修改成功", selenium.getAlert());
53+
selenium.click("link=首页");
54+
selenium.waitForPageToLoad("30000");
55+
selenium.click("xpath=(//a[contains(text(),'删除菜品')])[2]");
56+
selenium.waitForPageToLoad("30000");
57+
selenium.addSelection("id=all-dish-list", "label=test_dish2");
58+
selenium.click("css=button.btn.btn-default");
59+
assertEquals("删除成功", selenium.getAlert());
60+
selenium.addSelection("id=all-dish-list", "label=test_dish1");
61+
selenium.click("css=button.btn.btn-default");
62+
assertEquals("删除成功", selenium.getAlert());
63+
selenium.click("link=首页");
64+
selenium.waitForPageToLoad("30000");
65+
selenium.click("link=选项");
66+
selenium.click("link=添加菜品");
67+
selenium.waitForPageToLoad("30000");
68+
selenium.click("link=选项");
69+
selenium.click("link=删除菜品");
70+
selenium.waitForPageToLoad("30000");
71+
selenium.click("link=选项");
72+
selenium.click("link=修改菜品库存");
73+
selenium.waitForPageToLoad("30000");
74+
selenium.click("link=选项");
75+
selenium.click("link=登出");
76+
selenium.waitForPageToLoad("30000");
77+
}
78+
79+
@After
80+
public void tearDown() throws Exception {
81+
selenium.stop();
82+
}
83+
}

Testing/Testing Code/test_server.java

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package test1;
2+
3+
import com.thoughtworks.selenium.*;
4+
import org.junit.After;
5+
import org.junit.Before;
6+
import org.junit.Test;
7+
import static org.junit.Assert.*;
8+
import java.util.regex.Pattern;
9+
10+
public class test_server extends SeleneseTestCase {
11+
private Selenium selenium;
12+
13+
@Before
14+
public void setUp() throws Exception {
15+
//selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:9000/");
16+
selenium = new DefaultSelenium("localhost", 4444, "*googlechrome", "http://localhost:9000/");
17+
selenium.start();
18+
}
19+
20+
@Test
21+
public void testTest_server() throws Exception {
22+
selenium.open("/");
23+
selenium.type("id=name", "test_server");
24+
selenium.type("id=password", "test_server");
25+
selenium.click("css=button.btn.btn-default");
26+
selenium.waitForPageToLoad("30000");
27+
selenium.click("css=a.btn.btn-default");
28+
selenium.waitForPageToLoad("30000");
29+
selenium.click("xpath=(//input[@name='dish-check'])[3]");
30+
selenium.type("xpath=(//input[@name='order-count'])[3]", "1");
31+
selenium.click("//button[@type='submit']");
32+
assertEquals("点菜成功", selenium.getAlert());
33+
selenium.click("xpath=(//input[@name='dish-check'])[2]");
34+
selenium.click("xpath=(//input[@name='dish-check'])[3]");
35+
selenium.type("xpath=(//input[@name='order-count'])[2]", "2");
36+
selenium.type("xpath=(//input[@name='order-count'])[3]", "1");
37+
selenium.click("//button[@type='submit']");
38+
assertEquals("点菜成功", selenium.getAlert());
39+
selenium.click("link=首页");
40+
selenium.waitForPageToLoad("30000");
41+
selenium.click("link=选项");
42+
selenium.click("link=点单");
43+
selenium.waitForPageToLoad("30000");
44+
selenium.click("link=选项");
45+
selenium.click("link=登出");
46+
selenium.waitForPageToLoad("30000");
47+
}
48+
49+
@After
50+
public void tearDown() throws Exception {
51+
selenium.stop();
52+
}
53+
}
54+

Testing/read me.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
1.��������ʹ��seleniumIDE��firefox¼�Ʋ����ɽű�
2+
2.�ű�ʹ������Ϊjava junit4
3+
3.������Ŀ����web�����������Խ�ǿ�����ܲ��Բ����ֶ�����������Զ�����Ч�ʸ��ߣ���˱���Ŀ�Ĺ��ܲ������ֶ�������ɣ������Զ�����������Ŀ������ɺ����Բ�����Ŀ�ڲ�ͬƽ̨�ļ����ԣ���Ŀ�ű�¼�ƻ���firefox���������˼����Բ�����Ҫ������Ŀ��google chrome�ϵĹ����Ƿ�����ִ�С�
4+
4.��ԭ�����⻹�����jar������ֱ�ӵ���jar����eclipse���С�
5+
5.���ڲ���������Ҫ����selenium RC������м���ע�����
6+
һ������ר������ҪAdd external JARS,��selenium-server-standalone-2.53.0.jar��selenium-java-2.53.0.jar����jar�����ӽ�����
7+
���������в�������ǰ��Ҫ����rc server������������ʾ��java -jar selenium-server-standalone-2.53.0.jar
8+
������������������ֱ����eclipse�����в����������ɡ�

Testing/selenium-java-2.53.0.jar

1.77 MB
Binary file not shown.
20.2 MB
Binary file not shown.

Testing/test.jar

4.75 KB
Binary file not shown.

0 commit comments

Comments
 (0)