Blame view

src/test/java/com/essa/testSuite/TestActivity.java 3.39 KB
7a44144a   Administrator   sometestCases
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  package com.essa.testSuite;

  

  import org.openqa.selenium.WebDriver;

  import org.openqa.selenium.support.PageFactory;

  import org.testng.annotations.AfterClass;

  import org.testng.annotations.BeforeClass;

  import org.testng.annotations.Test;

  import org.testng.asserts.SoftAssert;

  

  import com.essa.framework.Model;

  import com.essa.pageObject.BaseTest;

  import com.essa.pageObject.HomePage;

  import com.essa.pageObject.inquiryManage.ProductInquiryFeedbackPage;

  import com.essa.pageObject.inquiryManage.ProductInquiryTaskPage;

  import com.essa.pageObject.needDealt.NeedDealtApplyPage;

  

  public class TestActivity extends BaseTest{

  	public WebDriver driver;

  //	private String manager;

  

  	@BeforeClass

  	public void setUp() {

  		initsetUp();

  //		Model.setIsactivity(1);

  //		Model.setManager("linrong");

  	}

  

  	@AfterClass

  	public void tearDown() {

  		driver.quit();

  	}

  	

  	/**

  	 * 活动商品已满足,类目经理走待办

  	 */

  	@Test(description="采购计划单申请,送询价")

  	public void TestActivityToPO() {

  		this.driver = getDriver();

  //		this.manager = Model.getManager();

  		if (Model.getManager() == null) {

  			System.out.println("获取类目经理失败了");

  			driver.quit();

  		}

  		

  		loginValid(Model.getManager());

  		HomePage homePage = PageFactory.initElements(driver, HomePage.class);

  		homePage.applyPurchasePlane();//目前没办法查出待办流水号,只能点击第一个待办,此处后续有必要的话需要优化

  		NeedDealtApplyPage needDealtApplyPage = PageFactory.initElements(driver, NeedDealtApplyPage.class);

  		needDealtApplyPage.submitInquiry();

  	}

  

  	/**

  	 * chenhong对成品询价,目前写死,暂不考虑义务商品

  	 */

  	@Test(description="成品询价")

  	public void productInquiry() {

  		this.driver = getDriver();

  		loginValid("chenhong");//此处是汕头的商品,有可能出现义务的商品,则要用xingchangyong来操作

  		HomePage homePage = PageFactory.initElements(driver, HomePage.class);

  		homePage.toProductInquiryTask();

  		ProductInquiryTaskPage productInquiryTask = PageFactory.initElements(driver, ProductInquiryTaskPage.class);

  		productInquiryTask.toFeedback();

  		ProductInquiryFeedbackPage productInquiryFeedback = PageFactory.initElements(driver,

  				ProductInquiryFeedbackPage.class);

  		productInquiryFeedback.submit();

  		// 断言

  		SoftAssert softAssert = new SoftAssert();

  		softAssert.assertEquals(productInquiryTask.isSucceed(), true, "成品询价失败!");

  		softAssert.assertAll();

  		homePage.sureLogout();

  		

  	}

  	

  	/**

  	 * 类目经理对采购计划进行修订

  	 */

  	@Test(description="采购计划修订")

  	public void planeModify() {

  		this.driver = getDriver();

  		loginValid(Model.getManager());

  		HomePage homePage = PageFactory.initElements(driver, HomePage.class);

  		homePage.toNeedDealtDetailPage();

  		NeedDealtApplyPage needDealtApplyPage = PageFactory.initElements(driver, NeedDealtApplyPage.class);

  		needDealtApplyPage.toAudit();

  		homePage.logout();

  	}

  	

  	/**

  	 * 财务对采购计划进行审核

  	 */

  	@Test(description="财务审核采购计划")

  	public void TestAuditApply() {

  		this.driver = getDriver();

  		loginValid("wangchaomang");

  		HomePage homePage = PageFactory.initElements(driver, HomePage.class);

  		homePage.toNeedDealtDetailPage();

  		NeedDealtApplyPage needDealtApplyPage = PageFactory.initElements(driver, NeedDealtApplyPage.class);

  		needDealtApplyPage.audit();

  	}

  }