Skip to content

Commit

Permalink
서명 요청 종료 -> 팝업 안잡히는 부분 수정 필요2
Browse files Browse the repository at this point in the history
  • Loading branch information
신준오 authored and 신준오 committed Feb 12, 2023
1 parent 9e6ad52 commit da6b6dc
Show file tree
Hide file tree
Showing 10 changed files with 567 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Selenium</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
89 changes: 89 additions & 0 deletions SeleniumJO/src/test/java/Test/Testrail.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package Test;

import java.io.IOException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

import org.aspectj.bridge.AbortException;
import org.json.simple.JSONObject;
import org.testng.ITestContext;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;

import TestrailAPI.APIClient;
import TestrailAPI.APIException;
import TestrailAPI.TestRails;

public class Testrail extends _1_modusign {

APIClient client = null;
String PROJECT_ID = "13";

public static final int TEST_CASE_PASSED_STATUS = 1;
public static final int TEST_CASE_FAILED_STATUS = 5;

@BeforeSuite
public void createSuite(ITestContext ctx) throws IOException, AbortException, APIException {
client = new APIClient("https://modusign.testrail.io");
client.setUser("[email protected]");
client.setPassword("1120319sA!");

Map data = new HashMap();
data.put("include_all", true);
data.put("name", "Selenium 자동화 테스트 진행");
// data.put("name","Selenium" + System.currentTimeMillis());

JSONObject c = null;
c = (JSONObject) client.sendPost("add_run/" + PROJECT_ID, data);

Long suite_id = (Long) c.get("id");
ctx.setAttribute("suiteId", suite_id);

}

@BeforeMethod
public void beforeTest(ITestContext ctx, Method method) throws NoSuchMethodException {
Method m = _1_modusign.class.getMethod(method.getName());

if (m.isAnnotationPresent(TestRails.class)) {
TestRails ta = m.getAnnotation(TestRails.class);
System.out.println(ta.id());
ctx.setAttribute("caseId", ta.id());

}
}


@AfterMethod
public void afterTest(ITestResult result, ITestContext ctx) throws IOException, APIException {

Map data = new HashMap();
if (result.isSuccess()) {
data.put("status_id", 1);
data.put("comment", "Pass");


} else {
data.put("status_id", 5);
data.put("comment", "Fail_log\n\n"

+ "< 대표적인 오류 >\n" + "1.NoSuchWindowException = NoSuch 에러는 항목(Element, window등 ..) 을 찾지 못했다. \n"
+ "2.또 뭐있더라\n\n"

+ result.getThrowable().toString());
}

String caseId = (String) ctx.getAttribute("caseId");
Long suiteId = (Long) ctx.getAttribute("suiteId");

//System.out.println("스투이트 아이디" + suiteId + "케이스 아이디" + caseId);

client.sendPost("add_result_for_case/" + suiteId + "/" + caseId, data);
}
}


23 changes: 23 additions & 0 deletions SeleniumJO/src/test/java/Test/_2_modusign_temple.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package Test;

import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;

import TestrailAPI.TestRails;

public class _2_modusign_temple extends _1_modusign {

@TestRails(id = "7650")
@Test(priority = 21) // 기타설정 화면 > 문서 이름 수정 완료 버튼
public void StepProgressBar_step123123() throws InterruptedException {
WebDriverWait wait = new WebDriverWait(driver, 10);

wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".css-1kr9snj")));
driver.findElement(By.cssSelector(".css-1kr9snj")).click();


}
}

37 changes: 37 additions & 0 deletions SeleniumJO/src/test/java/pages/HomePage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class HomePage {
protected WebDriver driver;

// <h1>Hello userName</h1>
private By messageBy = By.tagName("h1");

public HomePage(WebDriver driver){
this.driver = driver;
if (!driver.getTitle().equals("Home Page of logged in user")) {
throw new IllegalStateException("This is not Home Page of logged in user," +
" current page is: " + driver.getCurrentUrl());
}
}

/**
* Get message (h1 tag)
*
* @return String message text
*/
public String getMessageText() {
return driver.findElement(messageBy).getText();
}

public HomePage manageProfile() {
// Page encapsulation to manage profile functionality
return new HomePage(driver);
}
/* More methods offering the services represented by Home Page
of Logged User. These methods in turn might return more Page Objects
for example click on Compose mail button could return ComposeMail class object */
}

42 changes: 42 additions & 0 deletions SeleniumJO/src/test/java/pages/SingInPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class SingInPage {
protected WebDriver driver;

// <input name="user_name" type="text" value="">


private By useremail = By.name("email");
// <input name="password" type="password" value="">
private By passwordBy = By.name("password");
// <input name="sign_in" type="submit" value="SignIn">
private By signinBy = By.cssSelector(".tagGNBContractSetupStartBtn");

public SingInPage(WebDriver driver){
this.driver = driver;
if (!driver.getTitle().equals("Sign In Page")) {
throw new IllegalStateException("This is not Sign In Page," +
" current page is: " + driver.getCurrentUrl());
}
}
/**
* Login as valid user
*
* @param userName
* @param password
* @return HomePage object
*/
public HomePage loginValidUser(String userName, String password) {
driver.findElement(useremail).sendKeys(userName);
driver.findElement(passwordBy).sendKeys(password);
driver.findElement(signinBy).click();
return new HomePage(driver);
}
}




Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="DESKTOP-F3B2TKP" failures="0" tests="5" name="Modusign_automation.modusign" time="5.883" errors="0" timestamp="2023-02-12T19:29:50 KST" skipped="0">
<testcase classname="Modusign_automation.modusign" name="Dashboard" time="2.705"/>
<system-out/>
<testcase classname="Modusign_automation.modusign" name="Login_email" time="0.716"/>
<system-out/>
<testcase classname="Modusign_automation.modusign" name="Login_Password" time="0.597"/>
<system-out/>
<testcase classname="Modusign_automation.modusign" name="Login_btn" time="1.261"/>
<system-out/>
<testcase classname="Modusign_automation.modusign" name="ContractSetupStart_btn" time="0.604"/>
<system-out/>
</testsuite> <!-- Modusign_automation.modusign -->
95 changes: 95 additions & 0 deletions SeleniumJO/test-output/junitreports/TEST-Test.Testrail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="DESKTOP-F3B2TKP" failures="0" tests="13" name="Test.Testrail" time="12.713" errors="1" timestamp="2023-02-12T23:39:26 KST" skipped="0">
<testcase classname="Test.Testrail" name="Homepage" time="2.700"/>
<system-out/>
<testcase classname="Test.Testrail" name="Login_email" time="0.642"/>
<system-out/>
<testcase classname="Test.Testrail" name="Login_Password" time="0.570"/>
<system-out/>
<testcase classname="Test.Testrail" name="Login_btn" time="0.519"/>
<system-out/>
<testcase classname="Test.Testrail" name="ContractSetupStart_btn" time="1.542"/>
<system-out/>
<testcase classname="Test.Testrail" name="CLOUD_DRIVE_btn" time="0.615"/>
<system-out/>
<testcase classname="Test.Testrail" name="LOCAL_btn" time="0.519"/>
<system-out/>
<testcase classname="Test.Testrail" name="SAMPLE_DOCUMENTS_btn" time="1.816"/>
<system-out/>
<testcase classname="Test.Testrail" name="StepProgressBar_stepname1" time="1.219"/>
<system-out/>
<testcase classname="Test.Testrail" name="StepProgressBar_stepname2" time="0.639"/>
<system-out/>
<testcase classname="Test.Testrail" name="StepProgressBar_stepname3" time="0.611"/>
<system-out/>
<testcase classname="Test.Testrail" name="StepProgressBar_stepname5" time="0.838"/>
<system-out/>
<testcase classname="Test.Testrail" name="StepProgressBar_stepname6" time="0.483">
<error message="no such element: Unable to locate element: {&quot;method&quot;:&quot;xpath&quot;,&quot;selector&quot;:&quot;//button[@aria-label=&#039;다음 단계zddasdsa&#039;]&quot;}
(Session info: chrome=110.0.5481.77)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: &#039;3.141.59&#039;, revision: &#039;e82be7d358&#039;, time: &#039;2018-11-14T08:17:03&#039;
System info: host: &#039;DESKTOP-F3B2TKP&#039;, ip: &#039;112.148.26.220&#039;, os.name: &#039;Windows 11&#039;, os.arch: &#039;amd64&#039;, os.version: &#039;10.0&#039;, java.version: &#039;17.0.4.1&#039;
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 110.0.5481.77, chrome: {chromedriverVersion: 110.0.5481.77 (65ed616c6e8e..., userDataDir: C:\Users\tncls\AppData\Loca...}, goog:chromeOptions: {debuggerAddress: localhost:62045}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: 436d749349cb8474cd56aacabdd2da67
*** Element info: {Using=xpath, value=//button[@aria-label=&#039;다음 단계zddasdsa&#039;]}" type="org.openqa.selenium.NoSuchElementException">
<![CDATA[org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//button[@aria-label='다음 단계zddasdsa']"}
(Session info: chrome=110.0.5481.77)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-F3B2TKP', ip: '112.148.26.220', os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.4.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 110.0.5481.77, chrome: {chromedriverVersion: 110.0.5481.77 (65ed616c6e8e..., userDataDir: C:\Users\tncls\AppData\Loca...}, goog:chromeOptions: {debuggerAddress: localhost:62045}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: 436d749349cb8474cd56aacabdd2da67
*** Element info: {Using=xpath, value=//button[@aria-label='다음 단계zddasdsa']}
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
at org.openqa.selenium.By$ByXPath.findElement(By.java:353)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
at Test.modusign.StepProgressBar_stepname6(modusign.java:228)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:794)
at org.testng.TestRunner.run(TestRunner.java:596)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
at org.testng.SuiteRunner.run(SuiteRunner.java:276)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
at org.testng.TestNG.runSuites(TestNG.java:1063)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
]]>
</error>
</testcase> <!-- StepProgressBar_stepname6 -->
<system-out/>
</testsuite> <!-- Test.Testrail -->
Loading

0 comments on commit da6b6dc

Please sign in to comment.