Skip to content

Added syntax highlighting for java code #1359

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

Merged
merged 1 commit into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ 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,
this offers the service of being able to file a new issue. A basic Page Object would look like:

```
```java
package com.example.webdriver;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -76,7 +76,7 @@ public class EditIssue {

In order to turn this into a LoadableComponent, all we need to do is to set that as the base type:

```
```java
public class EditIssue extends LoadableComponent<EditIssue> {
// rest of class ignored for now
}
Expand All @@ -87,7 +87,7 @@ represents a LoadableComponent that loads the EditIssue page.

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");
Expand All @@ -108,7 +108,7 @@ it's possible to give users of the class clear information that can be used to d

With a little rework, our PageObject looks like:

```
```java
package com.example.webdriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -177,7 +177,7 @@ That doesn't seem to have bought us much, right? One thing it has done is encaps
the information about how to navigate to the page into the page itself, meaning that
this information's not scattered through the code base. It also means that we can do this in our tests:

```
```java
EditIssue page = new EditIssue(driver).get();
```

Expand All @@ -203,7 +203,7 @@ The end result, in addition to the EditIssue class above is:

ProjectPage.java:

```
```java
package com.example.webdriver;

import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -236,7 +236,7 @@ public class ProjectPage extends LoadableComponent<ProjectPage> {

and SecuredPage.java:

```
```java
package com.example.webdriver;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -293,7 +293,7 @@ public class SecuredPage extends LoadableComponent<SecuredPage> {

The "load" method in EditIssue now looks like:

```
```java
@Override
protected void load() {
securedPage.get();
Expand All @@ -306,7 +306,7 @@ This shows that the components are all "nested" within each other.
A call to `get()` in EditIssue will cause all its dependencies to
load too. The example usage:

```
```java
public class FooTest {
private EditIssue editIssue;

Expand Down Expand Up @@ -345,7 +345,7 @@ A "bot" is an action-oriented abstraction over the raw Selenium APIs.
This means that if you find that commands aren't doing the Right Thing
for your app, it's easy to change them. As an example:

```
```java
public class ActionBot {
private final WebDriver driver;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ LoadableComponentは、PageObjectsの作成の負担を軽減することを目
テスト作成者の観点から、これは新しい問題を提出できるサービスを提供します。
基本的なページオブジェクトは次のようになります。

```
```java
package com.example.webdriver;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -73,7 +73,7 @@ public class EditIssue {

これをLoadableComponentに変換するには、これを基本型として設定するだけです。

```
```java
public class EditIssue extends LoadableComponent<EditIssue> {
// rest of class ignored for now
}
Expand All @@ -83,7 +83,7 @@ public class EditIssue extends LoadableComponent<EditIssue> {

このベースクラスを拡張することにより、2つの新しいメソッドを実装する必要があります。

```
```java
@Override
protected void load() {
driver.get("https://github.com/SeleniumHQ/selenium/issues/new");
Expand All @@ -103,7 +103,7 @@ public class EditIssue extends LoadableComponent<EditIssue> {

少し手直しすると、PageObjectは次のようになります。

```
```java
package com.example.webdriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -173,7 +173,7 @@ public class EditIssue extends LoadableComponent<EditIssue> {
つまり、この情報はコードベース全体に散らばっていません。
これは、テストで下記を実行できることも意味します。

```
```java
EditIssue page = new EditIssue(driver).get();
```

Expand All @@ -199,7 +199,7 @@ LoadableComponentsは、他のLoadableComponentsと組み合わせて使用す

ProjectPage.java:

```
```java
package com.example.webdriver;

import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -232,7 +232,7 @@ public class ProjectPage extends LoadableComponent<ProjectPage> {

and SecuredPage.java:

```
```java
package com.example.webdriver;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -289,7 +289,7 @@ public class SecuredPage extends LoadableComponent<SecuredPage> {

EditIssueの "load" メソッドは次のようになります。

```
```java
@Override
protected void load() {
securedPage.get();
Expand All @@ -302,7 +302,7 @@ EditIssueの "load" メソッドは次のようになります。
EditIssueで `get()` を呼び出すと、そのすべての依存関係も読み込まれます。
使用例:

```
```java
public class FooTest {
private EditIssue editIssue;

Expand Down Expand Up @@ -338,7 +338,7 @@ PageObjectsは、テストでの重複を減らすための便利な方法です
つまり、コマンドがアプリに対して正しいことをしていないことがわかった場合、コマンドを簡単に変更できます。
例として:

```
```java
public class ActionBot {
private final WebDriver driver;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ the [new issue](https://github.com/SeleniumHQ/selenium/issues/new) 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
package com.example.webdriver;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -79,7 +79,7 @@ public class EditIssue {

In order to turn this into a LoadableComponent, all we need to do is to set that as the base type:

```
```java
public class EditIssue extends LoadableComponent<EditIssue> {
// rest of class ignored for now
}
Expand All @@ -90,7 +90,7 @@ represents a LoadableComponent that loads the EditIssue page.

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");
Expand All @@ -113,7 +113,7 @@ used to debug tests.

With a little rework, our PageObject looks like:

```
```java
package com.example.webdriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -183,7 +183,7 @@ encapsulate the information about how to navigate to the page into the page
itself, meaning that this information's not scattered through the code base.
It also means that we can do this in our tests:

```
```java
EditIssue page = new EditIssue(driver).get();
```

Expand All @@ -209,7 +209,7 @@ the parent. The end result, in addition to the EditIssue class above is:

ProjectPage.java:

```
```java
package com.example.webdriver;

import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -242,7 +242,7 @@ public class ProjectPage extends LoadableComponent<ProjectPage> {

and SecuredPage.java:

```
```java
package com.example.webdriver;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -299,7 +299,7 @@ public class SecuredPage extends LoadableComponent<SecuredPage> {

The "load" method in EditIssue now looks like:

```
```java
@Override
protected void load() {
securedPage.get();
Expand All @@ -310,7 +310,7 @@ The "load" method in EditIssue now looks like:

This shows that the components are all "nested" within each other. A call to `get()` in EditIssue will cause all its dependencies to load too. The example usage:

```
```java
public class FooTest {
private EditIssue editIssue;

Expand Down Expand Up @@ -345,7 +345,7 @@ Although PageObjects are a useful way of reducing duplication in your tests, it'

A "bot" is an action-oriented abstraction over the raw Selenium APIs. This means that if you find that commands aren't doing the Right Thing for your app, it's easy to change them. As an example:

```
```java
public class ActionBot {
private final WebDriver driver;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ the [new issue](https://github.com/SeleniumHQ/selenium/issues/new) 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
package com.example.webdriver;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -88,7 +88,7 @@ public class EditIssue {

In order to turn this into a LoadableComponent, all we need to do is to set that as the base type:

```
```java
public class EditIssue extends LoadableComponent<EditIssue> {
// rest of class ignored for now
}
Expand All @@ -99,7 +99,7 @@ this class represents a LoadableComponent that loads the EditIssue page.

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");
Expand All @@ -122,7 +122,7 @@ can be used to debug tests.

With a little rework, our PageObject looks like:

```
```java
package com.example.webdriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -192,7 +192,7 @@ is encapsulate the information about how to navigate to the page into
the page itself, meaning that this information's not scattered through
the code base. It also means that we can do this in our tests:

```
```java
EditIssue page = new EditIssue(driver).get();
```

Expand All @@ -218,7 +218,7 @@ the parent. The end result, in addition to the EditIssue class above is:

ProjectPage.java:

```
```java
package com.example.webdriver;

import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -251,7 +251,7 @@ public class ProjectPage extends LoadableComponent<ProjectPage> {

and SecuredPage.java:

```
```java
package com.example.webdriver;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -308,7 +308,7 @@ public class SecuredPage extends LoadableComponent<SecuredPage> {

The "load" method in EditIssue now looks like:

```
```java
@Override
protected void load() {
securedPage.get();
Expand All @@ -320,7 +320,7 @@ The "load" method in EditIssue now looks like:
This shows that the components are all "nested" within each other.
A call to `get()` in EditIssue will cause all its dependencies to load too. The example usage:

```
```java
public class FooTest {
private EditIssue editIssue;

Expand Down Expand Up @@ -359,7 +359,7 @@ A "bot" is an action-oriented abstraction over the raw Selenium APIs.
This means that if you find that commands aren't doing the Right Thing
for your app, it's easy to change them. As an example:

```
```java
public class ActionBot {
private final WebDriver driver;

Expand Down