-
Notifications
You must be signed in to change notification settings - Fork 5k
[Improvement-17874][ApiServer] Remove the default value of expireTime and let the user choose the time #17907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
8ae8863
942910a
8bfdb4d
33f6b50
b4f9a60
b512cad
549bacc
e56b551
0a303bd
d513edc
c8a2fc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,7 @@ public TokenPage create(String userName) { | |
|
|
||
| WebDriverWaitFactory.createWebDriverWait(driver) | ||
| .until(ExpectedConditions.elementToBeClickable(createTokenForm().selectUserNameDropdown())); | ||
| setExpireTime(30); | ||
| createTokenForm().selectUserNameDropdown().click(); | ||
| WebDriverWaitFactory.createWebDriverWait(driver) | ||
| .until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName( | ||
|
|
@@ -161,4 +162,27 @@ public class TokenForm { | |
| private WebElement buttonCancel; | ||
|
|
||
| } | ||
|
|
||
| private void setExpireTime(int daysAfter) { | ||
| try { | ||
| WebElement datePickerInput = driver.findElement(By.cssSelector(".n-date-picker input")); | ||
|
|
||
| LocalDateTime futureDate = LocalDateTime.now().plusDays(daysAfter); | ||
| DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | ||
| String futureDateStr = futureDate.format(formatter); | ||
|
|
||
| datePickerInput.clear(); | ||
| datePickerInput.sendKeys(futureDateStr.substring(0, 10)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better not to use truncated strings to get dates. |
||
|
|
||
| Thread.sleep(100); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use |
||
| WebElement timeInput = driver.findElement(By.cssSelector(".n-time-picker input")); | ||
| timeInput.clear(); | ||
| timeInput.sendKeys(futureDateStr.substring(11)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
| timeInput.sendKeys(Keys.ENTER); | ||
|
|
||
| Thread.sleep(100); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
| } catch (Exception e) { | ||
| throw new RuntimeException("Failed to set expire time", e); | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to use css selectors, please use a more rigorous writing, which will lead to an flaky exception in getting elements.