diff --git a/website_and_docs/content/documentation/test_practices/design_strategies.en.md b/website_and_docs/content/documentation/test_practices/design_strategies.en.md index e154621960a3..6db4fe03c094 100644 --- a/website_and_docs/content/documentation/test_practices/design_strategies.en.md +++ b/website_and_docs/content/documentation/test_practices/design_strategies.en.md @@ -34,7 +34,7 @@ There is currently an implementation in Java that ships as part of Selenium 2, b ### Simple Usage As an example of a UI that we'd like to model, take a look at -the [new issue](https://github.com/SeleniumHQ/selenium/issues/new) page. From the point of view of a test author, +the [new issue](https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+) page. From the point of view of a test author, this offers the service of being able to file a new issue. A basic Page Object would look like: ```java @@ -52,18 +52,53 @@ public class EditIssue { this.driver = driver; } - public void setSummary(String summary) { - WebElement field = driver.findElement(By.name("summary")); - clearAndType(field, summary); + public void setTitle(String title) { + WebElement field = driver.findElement(By.id("issue_title"))); + clearAndType(field, title); } - public void enterDescription(String description) { - WebElement field = driver.findElement(By.name("comment")); - clearAndType(field, description); + public void setBody(String body) { + WebElement field = driver.findElement(By.id("issue_body")); + clearAndType(field, body); + } + + public void setHowToReproduce(String howToReproduce) { + WebElement field = driver.findElement(By.id("issue_form_repro-command")); + clearAndType(field, howToReproduce); + } + + public void setLogOutput(String logOutput) { + WebElement field = driver.findElement(By.id("issue_form_logs")); + clearAndType(field, logOutput); + } + + public void setOperatingSystem(String operatingSystem) { + WebElement field = driver.findElement(By.id("issue_form_operating-system")); + clearAndType(field, operatingSystem); + } + + public void setSeleniumVersion(String seleniumVersion) { + WebElement field = driver.findElement(By.id("issue_form_selenium-version")); + clearAndType(field, logOutput); + } + + public void setBrowserVersion(String browserVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-versions")); + clearAndType(field, browserVersion); + } + + public void setDriverVersion(String driverVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-driver-versions")); + clearAndType(field, driverVersion); + } + + public void setUsingGrid(String usingGrid) { + WebElement field = driver.findElement(By.id("issue_form_selenium-grid-version")); + clearAndType(field, usingGrid); } public IssueList submit() { - driver.findElement(By.id("submit")).click(); + driver.findElement(By.cssSelector("button[type='submit']")).click(); return new IssueList(driver); } @@ -90,7 +125,7 @@ By extending this base class, we need to implement two new methods: ```java @Override protected void load() { - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } @Override @@ -123,16 +158,13 @@ public class EditIssue extends LoadableComponent { private final WebDriver driver; // By default the PageFactory will locate elements with the same name or id - // as the field. Since the summary element has a name attribute of "summary" + // as the field. Since the issue_title element has an id attribute of "issue_title" // we don't need any additional annotations. - private WebElement summary; + private WebElement issue_title; - // Same with the submit element, which has the ID "submit" - private WebElement submit; - - // But we'd prefer a different name in our code than "comment", so we use the + // But we'd prefer a different name in our code than "issue_body", so we use the // FindBy annotation to tell the PageFactory how to locate the element. - @FindBy(name = "comment") private WebElement description; + @FindBy(id = "issue_body") private WebElement body; public EditIssue(WebDriver driver) { this.driver = driver; @@ -143,7 +175,7 @@ public class EditIssue extends LoadableComponent { @Override protected void load() { - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } @Override @@ -151,17 +183,44 @@ public class EditIssue extends LoadableComponent { String url = driver.getCurrentUrl(); assertTrue("Not on the issue entry page: " + url, url.endsWith("/new")); } - - public void setSummary(String issueSummary) { - clearAndType(summary, issueSummary); + + public void setHowToReproduce(String howToReproduce) { + WebElement field = driver.findElement(By.id("issue_form_repro-command")); + clearAndType(field, howToReproduce); + } + + public void setLogOutput(String logOutput) { + WebElement field = driver.findElement(By.id("issue_form_logs")); + clearAndType(field, logOutput); + } + + public void setOperatingSystem(String operatingSystem) { + WebElement field = driver.findElement(By.id("issue_form_operating-system")); + clearAndType(field, operatingSystem); } - public void enterDescription(String issueDescription) { - clearAndType(description, issueDescription); + public void setSeleniumVersion(String seleniumVersion) { + WebElement field = driver.findElement(By.id("issue_form_selenium-version")); + clearAndType(field, logOutput); + } + + public void setBrowserVersion(String browserVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-versions")); + clearAndType(field, browserVersion); + } + + public void setDriverVersion(String driverVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-driver-versions")); + clearAndType(field, driverVersion); + } + + public void setUsingGrid(String usingGrid) { + WebElement field = driver.findElement(By.id("issue_form_selenium-grid-version")); + clearAndType(field, usingGrid); } public IssueList submit() { - submit.click(); + driver.findElement(By.cssSelector("button[type='submit']")).click(); return new IssueList(driver); } @@ -298,7 +357,7 @@ The "load" method in EditIssue now looks like: protected void load() { securedPage.get(); - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } ``` @@ -323,9 +382,17 @@ public class FooTest { public void demonstrateNestedLoadableComponents() { editIssue.get(); - editIssue.setSummary("Summary"); - editIssue.enterDescription("This is an example"); + editIssue.title.sendKeys('Title'); + editIssue.body.sendKeys('What Happened'); + editIssue.setHowToReproduce('How to Reproduce'); + editIssue.setLogOutput('Log Output'); + editIssue.setOperatingSystem('Operating System'); + editIssue.setSeleniumVersion('Selenium Version'); + editIssue.setBrowserVersion('Browser Version'); + editIssue.setDriverVersion('Driver Version'); + editIssue.setUsingGrid('I Am Using Grid'); } + } ``` diff --git a/website_and_docs/content/documentation/test_practices/design_strategies.ja.md b/website_and_docs/content/documentation/test_practices/design_strategies.ja.md index 5ef10220466c..34dfec87e6bf 100644 --- a/website_and_docs/content/documentation/test_practices/design_strategies.ja.md +++ b/website_and_docs/content/documentation/test_practices/design_strategies.ja.md @@ -30,7 +30,7 @@ LoadableComponentは、PageObjectsの作成の負担を軽減することを目 ### 簡単な使用方法 -モデル化するUIの例として、[新しいissue](https://github.com/SeleniumHQ/selenium/issues/new)のページをご覧ください。 +モデル化するUIの例として、[新しいissue](https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+)のページをご覧ください。 テスト作成者の観点から、これは新しい問題を提出できるサービスを提供します。 基本的なページオブジェクトは次のようになります。 @@ -49,18 +49,53 @@ public class EditIssue { this.driver = driver; } - public void setSummary(String summary) { - WebElement field = driver.findElement(By.name("summary")); - clearAndType(field, summary); + public void setTitle(String title) { + WebElement field = driver.findElement(By.id("issue_title"))); + clearAndType(field, title); } - public void enterDescription(String description) { - WebElement field = driver.findElement(By.name("comment")); - clearAndType(field, description); + public void setBody(String body) { + WebElement field = driver.findElement(By.id("issue_body")); + clearAndType(field, body); + } + + public void setHowToReproduce(String howToReproduce) { + WebElement field = driver.findElement(By.id("issue_form_repro-command")); + clearAndType(field, howToReproduce); + } + + public void setLogOutput(String logOutput) { + WebElement field = driver.findElement(By.id("issue_form_logs")); + clearAndType(field, logOutput); + } + + public void setOperatingSystem(String operatingSystem) { + WebElement field = driver.findElement(By.id("issue_form_operating-system")); + clearAndType(field, operatingSystem); + } + + public void setSeleniumVersion(String seleniumVersion) { + WebElement field = driver.findElement(By.id("issue_form_selenium-version")); + clearAndType(field, logOutput); + } + + public void setBrowserVersion(String browserVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-versions")); + clearAndType(field, browserVersion); + } + + public void setDriverVersion(String driverVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-driver-versions")); + clearAndType(field, driverVersion); + } + + public void setUsingGrid(String usingGrid) { + WebElement field = driver.findElement(By.id("issue_form_selenium-grid-version")); + clearAndType(field, usingGrid); } public IssueList submit() { - driver.findElement(By.id("submit")).click(); + driver.findElement(By.cssSelector("button[type='submit']")).click(); return new IssueList(driver); } @@ -86,7 +121,7 @@ public class EditIssue extends LoadableComponent { ```java @Override protected void load() { - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } @Override @@ -118,16 +153,13 @@ public class EditIssue extends LoadableComponent { private final WebDriver driver; // By default the PageFactory will locate elements with the same name or id - // as the field. Since the summary element has a name attribute of "summary" + // as the field. Since the issue_title element has an id attribute of "issue_title" // we don't need any additional annotations. - private WebElement summary; + private WebElement issue_title; - // Same with the submit element, which has the ID "submit" - private WebElement submit; - - // But we'd prefer a different name in our code than "comment", so we use the + // But we'd prefer a different name in our code than "issue_body", so we use the // FindBy annotation to tell the PageFactory how to locate the element. - @FindBy(name = "comment") private WebElement description; + @FindBy(id = "issue_body") private WebElement body; public EditIssue(WebDriver driver) { this.driver = driver; @@ -138,7 +170,7 @@ public class EditIssue extends LoadableComponent { @Override protected void load() { - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } @Override @@ -146,17 +178,44 @@ public class EditIssue extends LoadableComponent { String url = driver.getCurrentUrl(); assertTrue("Not on the issue entry page: " + url, url.endsWith("/new")); } - - public void setSummary(String issueSummary) { - clearAndType(summary, issueSummary); + + public void setHowToReproduce(String howToReproduce) { + WebElement field = driver.findElement(By.id("issue_form_repro-command")); + clearAndType(field, howToReproduce); + } + + public void setLogOutput(String logOutput) { + WebElement field = driver.findElement(By.id("issue_form_logs")); + clearAndType(field, logOutput); + } + + public void setOperatingSystem(String operatingSystem) { + WebElement field = driver.findElement(By.id("issue_form_operating-system")); + clearAndType(field, operatingSystem); + } + + public void setSeleniumVersion(String seleniumVersion) { + WebElement field = driver.findElement(By.id("issue_form_selenium-version")); + clearAndType(field, logOutput); + } + + public void setBrowserVersion(String browserVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-versions")); + clearAndType(field, browserVersion); + } + + public void setDriverVersion(String driverVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-driver-versions")); + clearAndType(field, driverVersion); } - public void enterDescription(String issueDescription) { - clearAndType(description, issueDescription); + public void setUsingGrid(String usingGrid) { + WebElement field = driver.findElement(By.id("issue_form_selenium-grid-version")); + clearAndType(field, usingGrid); } public IssueList submit() { - submit.click(); + driver.findElement(By.cssSelector("button[type='submit']")).click(); return new IssueList(driver); } @@ -294,7 +353,7 @@ EditIssueの "load" メソッドは次のようになります。 protected void load() { securedPage.get(); - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } ``` @@ -319,8 +378,15 @@ public class FooTest { public void demonstrateNestedLoadableComponents() { editIssue.get(); - editIssue.setSummary("Summary"); - editIssue.enterDescription("This is an example"); + editIssue.title.sendKeys('Title'); + editIssue.body.sendKeys('What Happened'); + editIssue.setHowToReproduce('How to Reproduce'); + editIssue.setLogOutput('Log Output'); + editIssue.setOperatingSystem('Operating System'); + editIssue.setSeleniumVersion('Selenium Version'); + editIssue.setBrowserVersion('Browser Version'); + editIssue.setDriverVersion('Driver Version'); + editIssue.setUsingGrid('I Am Using Grid'); } } ``` @@ -367,4 +433,4 @@ public class ActionBot { } ``` -これらの抽象化が構築され、テストでの重複が特定されると、ボットの上にPageObjectsを階層化することができます。 \ No newline at end of file +これらの抽象化が構築され、テストでの重複が特定されると、ボットの上にPageObjectsを階層化することができます。 diff --git a/website_and_docs/content/documentation/test_practices/design_strategies.pt-br.md b/website_and_docs/content/documentation/test_practices/design_strategies.pt-br.md index d2174f34adaf..ff0c94c48c00 100644 --- a/website_and_docs/content/documentation/test_practices/design_strategies.pt-br.md +++ b/website_and_docs/content/documentation/test_practices/design_strategies.pt-br.md @@ -36,7 +36,7 @@ but the approach used is simple enough to be implemented in any language. ### Simple Usage As an example of a UI that we'd like to model, take a look at -the [new issue](https://github.com/SeleniumHQ/selenium/issues/new) page. From +the [new issue](https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+) page. From the point of view of a test author, this offers the service of being able to file a new issue. A basic Page Object would look like: @@ -55,18 +55,53 @@ public class EditIssue { this.driver = driver; } - public void setSummary(String summary) { - WebElement field = driver.findElement(By.name("summary")); - clearAndType(field, summary); + public void setTitle(String title) { + WebElement field = driver.findElement(By.id("issue_title"))); + clearAndType(field, title); } - public void enterDescription(String description) { - WebElement field = driver.findElement(By.name("comment")); - clearAndType(field, description); + public void setBody(String body) { + WebElement field = driver.findElement(By.id("issue_body")); + clearAndType(field, body); + } + + public void setHowToReproduce(String howToReproduce) { + WebElement field = driver.findElement(By.id("issue_form_repro-command")); + clearAndType(field, howToReproduce); + } + + public void setLogOutput(String logOutput) { + WebElement field = driver.findElement(By.id("issue_form_logs")); + clearAndType(field, logOutput); + } + + public void setOperatingSystem(String operatingSystem) { + WebElement field = driver.findElement(By.id("issue_form_operating-system")); + clearAndType(field, operatingSystem); + } + + public void setSeleniumVersion(String seleniumVersion) { + WebElement field = driver.findElement(By.id("issue_form_selenium-version")); + clearAndType(field, logOutput); + } + + public void setBrowserVersion(String browserVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-versions")); + clearAndType(field, browserVersion); + } + + public void setDriverVersion(String driverVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-driver-versions")); + clearAndType(field, driverVersion); + } + + public void setUsingGrid(String usingGrid) { + WebElement field = driver.findElement(By.id("issue_form_selenium-grid-version")); + clearAndType(field, usingGrid); } public IssueList submit() { - driver.findElement(By.id("submit")).click(); + driver.findElement(By.cssSelector("button[type='submit']")).click(); return new IssueList(driver); } @@ -93,7 +128,7 @@ By extending this base class, we need to implement two new methods: ```java @Override protected void load() { - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } @Override @@ -128,16 +163,13 @@ public class EditIssue extends LoadableComponent { private final WebDriver driver; // By default the PageFactory will locate elements with the same name or id - // as the field. Since the summary element has a name attribute of "summary" + // as the field. Since the issue_title element has an id attribute of "issue_title" // we don't need any additional annotations. - private WebElement summary; + private WebElement issue_title; - // Same with the submit element, which has the ID "submit" - private WebElement submit; - - // But we'd prefer a different name in our code than "comment", so we use the + // But we'd prefer a different name in our code than "issue_body", so we use the // FindBy annotation to tell the PageFactory how to locate the element. - @FindBy(name = "comment") private WebElement description; + @FindBy(id = "issue_body") private WebElement body; public EditIssue(WebDriver driver) { this.driver = driver; @@ -148,7 +180,7 @@ public class EditIssue extends LoadableComponent { @Override protected void load() { - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } @Override @@ -156,17 +188,44 @@ public class EditIssue extends LoadableComponent { String url = driver.getCurrentUrl(); assertTrue("Not on the issue entry page: " + url, url.endsWith("/new")); } - - public void setSummary(String issueSummary) { - clearAndType(summary, issueSummary); + + public void setHowToReproduce(String howToReproduce) { + WebElement field = driver.findElement(By.id("issue_form_repro-command")); + clearAndType(field, howToReproduce); + } + + public void setLogOutput(String logOutput) { + WebElement field = driver.findElement(By.id("issue_form_logs")); + clearAndType(field, logOutput); + } + + public void setOperatingSystem(String operatingSystem) { + WebElement field = driver.findElement(By.id("issue_form_operating-system")); + clearAndType(field, operatingSystem); + } + + public void setSeleniumVersion(String seleniumVersion) { + WebElement field = driver.findElement(By.id("issue_form_selenium-version")); + clearAndType(field, logOutput); + } + + public void setBrowserVersion(String browserVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-versions")); + clearAndType(field, browserVersion); + } + + public void setDriverVersion(String driverVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-driver-versions")); + clearAndType(field, driverVersion); } - public void enterDescription(String issueDescription) { - clearAndType(description, issueDescription); + public void setUsingGrid(String usingGrid) { + WebElement field = driver.findElement(By.id("issue_form_selenium-grid-version")); + clearAndType(field, usingGrid); } public IssueList submit() { - submit.click(); + driver.findElement(By.cssSelector("button[type='submit']")).click(); return new IssueList(driver); } @@ -304,7 +363,7 @@ The "load" method in EditIssue now looks like: protected void load() { securedPage.get(); - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } ``` @@ -327,8 +386,15 @@ public class FooTest { public void demonstrateNestedLoadableComponents() { editIssue.get(); - editIssue.setSummary("Summary"); - editIssue.enterDescription("This is an example"); + editIssue.title.sendKeys('Title'); + editIssue.body.sendKeys('What Happened'); + editIssue.setHowToReproduce('How to Reproduce'); + editIssue.setLogOutput('Log Output'); + editIssue.setOperatingSystem('Operating System'); + editIssue.setSeleniumVersion('Selenium Version'); + editIssue.setBrowserVersion('Browser Version'); + editIssue.setDriverVersion('Driver Version'); + editIssue.setUsingGrid('I Am Using Grid'); } } ``` diff --git a/website_and_docs/content/documentation/test_practices/design_strategies.zh-cn.md b/website_and_docs/content/documentation/test_practices/design_strategies.zh-cn.md index a4c82b251a5c..9326b0fa8f55 100644 --- a/website_and_docs/content/documentation/test_practices/design_strategies.zh-cn.md +++ b/website_and_docs/content/documentation/test_practices/design_strategies.zh-cn.md @@ -45,7 +45,7 @@ but the approach used is simple enough to be implemented in any language. ### Simple Usage As an example of a UI that we'd like to model, take a look at -the [new issue](https://github.com/SeleniumHQ/selenium/issues/new) page. +the [new issue](https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+) page. From the point of view of a test author, this offers the service of being able to file a new issue. A basic Page Object would look like: @@ -64,18 +64,53 @@ public class EditIssue { this.driver = driver; } - public void setSummary(String summary) { - WebElement field = driver.findElement(By.name("summary")); - clearAndType(field, summary); + public void setTitle(String title) { + WebElement field = driver.findElement(By.id("issue_title"))); + clearAndType(field, title); } - public void enterDescription(String description) { - WebElement field = driver.findElement(By.name("comment")); - clearAndType(field, description); + public void setBody(String body) { + WebElement field = driver.findElement(By.id("issue_body")); + clearAndType(field, body); + } + + public void setHowToReproduce(String howToReproduce) { + WebElement field = driver.findElement(By.id("issue_form_repro-command")); + clearAndType(field, howToReproduce); + } + + public void setLogOutput(String logOutput) { + WebElement field = driver.findElement(By.id("issue_form_logs")); + clearAndType(field, logOutput); + } + + public void setOperatingSystem(String operatingSystem) { + WebElement field = driver.findElement(By.id("issue_form_operating-system")); + clearAndType(field, operatingSystem); + } + + public void setSeleniumVersion(String seleniumVersion) { + WebElement field = driver.findElement(By.id("issue_form_selenium-version")); + clearAndType(field, logOutput); + } + + public void setBrowserVersion(String browserVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-versions")); + clearAndType(field, browserVersion); + } + + public void setDriverVersion(String driverVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-driver-versions")); + clearAndType(field, driverVersion); + } + + public void setUsingGrid(String usingGrid) { + WebElement field = driver.findElement(By.id("issue_form_selenium-grid-version")); + clearAndType(field, usingGrid); } public IssueList submit() { - driver.findElement(By.id("submit")).click(); + driver.findElement(By.cssSelector("button[type='submit']")).click(); return new IssueList(driver); } @@ -102,7 +137,7 @@ By extending this base class, we need to implement two new methods: ```java @Override protected void load() { - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } @Override @@ -137,16 +172,13 @@ public class EditIssue extends LoadableComponent { private final WebDriver driver; // By default the PageFactory will locate elements with the same name or id - // as the field. Since the summary element has a name attribute of "summary" + // as the field. Since the issue_title element has an id attribute of "issue_title" // we don't need any additional annotations. - private WebElement summary; + private WebElement issue_title; - // Same with the submit element, which has the ID "submit" - private WebElement submit; - - // But we'd prefer a different name in our code than "comment", so we use the + // But we'd prefer a different name in our code than "issue_body", so we use the // FindBy annotation to tell the PageFactory how to locate the element. - @FindBy(name = "comment") private WebElement description; + @FindBy(id = "issue_body") private WebElement body; public EditIssue(WebDriver driver) { this.driver = driver; @@ -157,7 +189,7 @@ public class EditIssue extends LoadableComponent { @Override protected void load() { - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } @Override @@ -165,17 +197,44 @@ public class EditIssue extends LoadableComponent { String url = driver.getCurrentUrl(); assertTrue("Not on the issue entry page: " + url, url.endsWith("/new")); } - - public void setSummary(String issueSummary) { - clearAndType(summary, issueSummary); + + public void setHowToReproduce(String howToReproduce) { + WebElement field = driver.findElement(By.id("issue_form_repro-command")); + clearAndType(field, howToReproduce); + } + + public void setLogOutput(String logOutput) { + WebElement field = driver.findElement(By.id("issue_form_logs")); + clearAndType(field, logOutput); + } + + public void setOperatingSystem(String operatingSystem) { + WebElement field = driver.findElement(By.id("issue_form_operating-system")); + clearAndType(field, operatingSystem); + } + + public void setSeleniumVersion(String seleniumVersion) { + WebElement field = driver.findElement(By.id("issue_form_selenium-version")); + clearAndType(field, logOutput); + } + + public void setBrowserVersion(String browserVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-versions")); + clearAndType(field, browserVersion); + } + + public void setDriverVersion(String driverVersion) { + WebElement field = driver.findElement(By.id("issue_form_browser-driver-versions")); + clearAndType(field, driverVersion); } - public void enterDescription(String issueDescription) { - clearAndType(description, issueDescription); + public void setUsingGrid(String usingGrid) { + WebElement field = driver.findElement(By.id("issue_form_selenium-grid-version")); + clearAndType(field, usingGrid); } public IssueList submit() { - submit.click(); + driver.findElement(By.cssSelector("button[type='submit']")).click(); return new IssueList(driver); } @@ -313,7 +372,7 @@ The "load" method in EditIssue now looks like: protected void load() { securedPage.get(); - driver.get("https://github.com/SeleniumHQ/selenium/issues/new"); + driver.get("https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+"); } ``` @@ -337,8 +396,15 @@ public class FooTest { public void demonstrateNestedLoadableComponents() { editIssue.get(); - editIssue.setSummary("Summary"); - editIssue.enterDescription("This is an example"); + editIssue.title.sendKeys('Title'); + editIssue.body.sendKeys('What Happened'); + editIssue.setHowToReproduce('How to Reproduce'); + editIssue.setLogOutput('Log Output'); + editIssue.setOperatingSystem('Operating System'); + editIssue.setSeleniumVersion('Selenium Version'); + editIssue.setBrowserVersion('Browser Version'); + editIssue.setDriverVersion('Driver Version'); + editIssue.setUsingGrid('I Am Using Grid'); } } ```