Skip to content

Commit

Permalink
[test-2559][e2e] test data configure isolation  (apache#3712)
Browse files Browse the repository at this point in the history
* Add task connection 

* Optimize test cases
 

* Modify variable format
 
 

* Optimize test cases
 

* Update BrowserCommon.java

* Update BrowserCommon.java

* Update WorkflowDefineLocator.java

* Optimize waiting time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize project wait time
 

* Optimize wait time
 

* Optimize wait time
 

* open timing testcase 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize wait time
 

* Optimize alert to save workflow
 

* Optimize alert to save workflow
 

* add yaml reader

* add yaml file 

* [e2e] test data configure isolation 

* [e2e] test data configure isolation 

* [e2e] test data configure isolation 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify style AvoidStarImport 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify check code style 

* [e2e] modify check code style 

Co-authored-by: chenxingchun <[email protected]>
  • Loading branch information
xingchun-chen and chenxingchun authored Sep 19, 2020
1 parent 2f584f6 commit 42deff0
Show file tree
Hide file tree
Showing 31 changed files with 369 additions and 312 deletions.
10 changes: 10 additions & 0 deletions e2e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@
<artifactId>commons-pool2</artifactId>
<version>${commons-pool2.version}</version>
</dependency>
<dependency>
<groupId>org.jyaml</groupId>
<artifactId>jyaml</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.1.5.RELEASE</version>
</dependency>
</dependencies>

<build>
Expand Down
45 changes: 45 additions & 0 deletions e2e/src/main/java/org/apache/dolphinscheduler/util/YmlReader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.dolphinscheduler.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;

import org.ho.yaml.Yaml;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;

/**
* read yml file
*/
public class YmlReader {
public static HashMap<String,HashMap<String, String>> map;
public String getDataYml(String filePath, String key1, String key2) {
Yaml yaml = new Yaml();
Resource resource = new DefaultResourceLoader().getResource("classpath:" + filePath + ".yml");
try {
InputStream inputStream = resource.getInputStream();
map = yaml.loadType(inputStream, HashMap.class);
} catch (IOException e) {
e.printStackTrace();
}
String data = map.get(key1).get(key2);
return data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;

import java.io.IOException;
import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class LoginData {
*/
public static final String URL = PropertiesReader.getKey("LOGIN_URL");


/**
* Login username
*/
Expand All @@ -38,6 +37,4 @@ public class LoginData {
* Login password
*/
public static final String PASSWORD = PropertiesReader.getKey("PASSWORD");

public static final String TENANT = "租户管理 - DolphinScheduler";
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
*/
package org.apache.dolphinscheduler.data.project;

public class ProcessInstanceData {
//Process Instance page title
public static final String PROCESS_INSTANCE_TITLE = "工作流实例 - DolphinScheduler";
public static final String RERUN_TYPE= "重跑";

import org.apache.dolphinscheduler.util.YmlReader;

public class ProcessInstanceData {
public String getProcessInstanceData(String param) {
YmlReader ymlReader = new YmlReader();
String processInstanceData = ymlReader.getDataYml("testData/workflow_zh_cn", "processInstance", param);
return processInstanceData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
*/
package org.apache.dolphinscheduler.data.project;

public class ProjectData {

public static final String CREATE_PROJECT_BUTTON = "创建项目";
import org.apache.dolphinscheduler.util.YmlReader;

// create project name
public static final String PROJECT_NAME = "selenium_project_1";
// create project description
public static final String DESCRIPTION = "test create project description";
// project page title
public static final String PROJECT_TITLE = "项目 - DolphinScheduler";
public class ProjectData {
public String getProjectData(String param) {
YmlReader ymlReader = new YmlReader();
String projectData = ymlReader.getDataYml("testData/workflow_zh_cn", "projectManage", param);
return projectData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@
*/
package org.apache.dolphinscheduler.data.project;

public class RunWorkflowData {
/**
* run workflow data
*/
//input shell task name
public static final String RECIPIENT = "[email protected]";

//input shell task description
public static final String Cc = "[email protected]";

public static final String RUN_WORKFLOW_TITLE = "工作流定义 - DolphinScheduler";

import org.apache.dolphinscheduler.util.YmlReader;

public class RunWorkflowData {
public String getRunWorkflowData(String param) {
YmlReader ymlReader = new YmlReader();
String runWorkflowData = ymlReader.getDataYml("testData/workflow_zh_cn", "runWorkflow", param);
return runWorkflowData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,12 @@
*/
package org.apache.dolphinscheduler.data.project;

public class TimingData {
/**
* timing data
*/
//input shell task name
public static final String RECIPIENT = "[email protected]";

//input shell task description
public static final String Cc = "[email protected]";

public static final String EDIT_RECIPIENT = "[email protected]";

public static final String EDIT_Cc = "[email protected]";
import org.apache.dolphinscheduler.util.YmlReader;

public static final String TIMING_OFFLINE_STATE = "下线";

public static final String TIMING_ONLINE_STATE = "上线";

public static final String TIMING_TITLE = "定时任务列表 - DolphinScheduler";
public class TimingData {
public String getTimingData(String param) {
YmlReader ymlReader = new YmlReader();
String timingData = ymlReader.getDataYml("testData/workflow_zh_cn", "timing", param);
return timingData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,74 +16,12 @@
*/
package org.apache.dolphinscheduler.data.project;

public class WorkflowDefineData {
/**
* create workflow data
*/

public static final String workflow_define = "工作流定义";

//input shell task name
public static final String SHELL_TASK_NAME = "shell_task_selenium_1";

//input shell task description
public static final String SHELL_TASK_DESCRIPTION = "shell task description test";

//input timeout
public static final String INPUT_TIMEOUT = "60";

//input shell script
public static final String SHELL_SCRIPT = "echo 1111111";

//input custom parameters
public static final String INPUT_CUSTOM_PARAMETERS = "selenium_parameter";

//input custom parameters value
public static final String INPUT_CUSTOM_PARAMETERS_VALUE = "selenium_parameter_123";

//input add custom parameters
public static final String INPUT_ADD_CUSTOM_PARAMETERS = "selenium_parameter_delete";

//input add custom parameters value
public static final String INPUT_ADD_CUSTOM_PARAMETERS_VALUE = "selenium_parameter_delete_456";

//workflow define title
public static final String WORKFLOW_TITLE = "工作流定义 - DolphinScheduler";

//create workflow title
public static final String CREATE_WORKFLOW_TITLE = "创建流程定义 - DolphinScheduler";


/**
* save workflow data
*/
//input workflow name
public static final String INPUT_WORKFLOW_NAME = "selenium_shell_1";

//input workflow description
public static final String INPUT_WORKFLOW_DESCRIPTION = "test selenium_shell_1 description";

//input workflow timeout
public static final String INPUT_WORKFLOW_TIMEOUT = "30";

//input workflow global parameters
public static final String INPUT_WORKFLOW_GLOBAL_PARAMETERS = "selenium_global_parameters_1";

//input workflow global parameters value
public static final String INPUT_WORKFLOW_GLOBAL_PARAMETERS_VALUES = "selenium_global_parameters_value_1";

//input to add workflow global parameters
public static final String INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS = "selenium_global_parameters_2";

//input to add workflow global parameters value
public static final String INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS_VALUES = "selenium_global_parameters_value_2";

/**
* workflowDefine list
*/
public static final String WORKFLOW_ONLINE_STATE = "上线";

public static final String WORKFLOW_OFFLINE_STATE = "下线";

import org.apache.dolphinscheduler.util.YmlReader;

public class WorkflowDefineData {
public String getWorkflowDefineData(String param) {
YmlReader ymlReader = new YmlReader();
String workflowDefineData = ymlReader.getDataYml("testData/workflow_zh_cn", "workflowDefine", param);
return workflowDefineData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@
*/
package org.apache.dolphinscheduler.data.security;

public class AlertManageData {
//Alert Name
public static final String ALERT_NAME = "selenium_alert_Name";
public static final String CREATE_ALERT = "创建告警组";

// Alert Type
public static final String ALERT_TYPE = "邮件";
import org.apache.dolphinscheduler.util.YmlReader;

//Alert Description
public static final String DESCRIPTION = "create alert test";

public static final String ALERT_MANAGE = "告警组管理 - DolphinScheduler";
public class AlertManageData {
public String getAlertData(String param) {
YmlReader ymlReader = new YmlReader();
String alertData = ymlReader.getDataYml("testData/security_zh_cn", "alertManage", param);
return alertData;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,12 @@
*/
package org.apache.dolphinscheduler.data.security;

public class QueueManageData {
/**
* Create Queue Name
*/
public static final String QUEUE_NAME = "selenium_queue_name";

public static final String CREATE_QUEUE = "创建队列";

/**
* Create Queue Value
*/
public static final String QUEUE_VALUE = "selenium_queue_value";

/**
* Edit Queue Name
*/
public static final String EDIT_QUEUE_NAME = "selenium_queue_value_edit";

/**
* Edit Queue Value
*/
public static final String EDIT_QUEUE_VALUE = "selenium_queue_value_edit";

public static final String QUEUE_MANAGE = "队列管理 - DolphinScheduler";
import org.apache.dolphinscheduler.util.YmlReader;

public class QueueManageData {
public String getQueueData(String param) {
YmlReader ymlReader = new YmlReader();
String queueData = ymlReader.getDataYml("testData/security_zh_cn", "queueManage", param);
return queueData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,12 @@
*/
package org.apache.dolphinscheduler.data.security;

import org.apache.dolphinscheduler.util.YmlReader;

public class TenantManageData {
/**
* Tenant Code
*/
public static final String TENANT_CODE = "selenium_tenant_code_1";

/**
* Tenant Name
*/
public static final String TENANT_NAME = "selenium_tenant_Name";

/**
* Queue
*/
public static final String QUEUE = "default";

/**
* Description
*/
public static final String DESCRIPTION = "create tenant test";

public static final String TENANT_MANAGE = "租户管理 - DolphinScheduler";



public String getTenantData(String param) {
YmlReader ymlReader = new YmlReader();
String tenantData = ymlReader.getDataYml("testData/security_zh_cn", "tenantManage", param);
return tenantData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
*/
package org.apache.dolphinscheduler.data.security;

public class TokenManageData {
public static final String TOKEN_MANAGE = "令牌管理 - DolphinScheduler";
public static final String CREATE_TOKEN = "创建令牌";

public static final String DATE = "2038-06-10 00:00:00";
public static final String NAME = "admin";


import org.apache.dolphinscheduler.util.YmlReader;

public class TokenManageData {
public String getTokenData(String param) {
YmlReader ymlReader = new YmlReader();
String tokenData = ymlReader.getDataYml("testData/security_zh_cn", "tokenManage", param);
return tokenData;
}
}
Loading

0 comments on commit 42deff0

Please sign in to comment.