Skip to content

Conversation

@milkmeowo
Copy link
Collaborator

No description provided.

@summerblue summerblue requested a review from sqrtqiezi February 21, 2017 00:26
## 简介

Laravel Dusk provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require you to install JDK or Selenium on your machine. Instead, Dusk uses a standalone [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/home) installation. However, you are free to utilize any other Selenium compatible driver you wish.
Laravel Dusk 为浏览器提供了丰富而简单易用的自动化测试 APIDusk 并不要求你在你的机器中安装 JDK 或者 SeleniumDusk 而是使用 [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/home)。不过,依然可以按照你自己的需要安装其他 Selenium 兼容的驱动引擎。
Copy link
Collaborator

@oustn oustn Feb 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Laravel Dusk 为浏览器提供了丰富而简单易用的自动化测试 API。 -> Laravel Dusk 提供了富有表现力、简单易用的浏览器自动化以及相应的测试API。 Laravel Dusk 不是为浏览器提供了xxx ,而是为 Laravel 提供了一个浏览器的自动化测试功能,以及相应的 api ,你觉得呢

## 简介

Laravel Dusk provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require you to install JDK or Selenium on your machine. Instead, Dusk uses a standalone [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/home) installation. However, you are free to utilize any other Selenium compatible driver you wish.
Laravel Dusk 为浏览器提供了丰富而简单易用的自动化测试 APIDusk 并不要求你在你的机器中安装 JDK 或者 SeleniumDusk 而是使用 [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/home)。不过,依然可以按照你自己的需要安装其他 Selenium 兼容的驱动引擎。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, Dusk uses a standalone (Dusk 而是使用),这句的翻译貌似没有表达出“单独/独立”的这个概念,而且感觉原文没有一个转折的意思?

安装了 Dusk 之后,你需要注册 `Laravel\Dusk\DuskServiceProvider` 服务提供者。由于 Dusk 提供了登录其他用户的能力,所以为了限制 Dusk 的使用环境,你应该在你的 `AppServiceProvider` 中使用 `register` 方法来注册:

use Laravel\Dusk\DuskServiceProvider;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码中的注释也要翻译~

打开你的 `tests/DuskTestCase.php` 文件,这个文件是你应用中最基础的 Dusk 测试用例。你可以在这个文件中移除 `startChromeDriver` 方法。这样 Dusk 就不会自动运行 ChromeDriver

/**
* Prepare for Dusk test execution.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释也要翻译~

### 点击链接

To click a link, you may use the `clickLink` method on the browser instance. The `clickLink` method will click the link that has the given display text:
你可以在你的浏览器实例中使用 `clickLink` 方法来模拟点击一个链接。`clickLink` 方法会点击传入的显示文本:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

方法会点击传入的显示文本: -> 全角标点

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oustn 好细心

#### 获取和设置值

Dusk provides several methods for interacting with the current display text, value, and attributes of elements on the page. For example, to get the "value" of an element that matches a given selector, use the `value` method:
Dusk 提供了几种方法让你和当前页面元素中的显示文本,值和属性进行交互。举例来说,想获得某个指定选择器对应元素的 「值」,你可以使用 `value` 方法:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文本,值和属性 -> 用顿号会不会好一点

## 页面

Sometimes, tests require several complicated actions to be performed in sequence. This can make your tests harder to read and understand. Pages allow you to define expressive actions that may then be performed on a given page using a single method. Pages also allow you to define short-cuts to common selectors for your application or a single page.
有时候,测试有一些复杂的动作需要顺序执行。 这很容易让你的测试代码变得难读,并且难以理解。页面雨荨你定义语义化的动作行为,然后你可以在给定页面中使用单个方法。页面也允许你为你的应用或者单个页面定义简写的公共选择器。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

雨荨 -> ??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哈哈,这里应该是允许

#### `url` 方法

The `url` method should return the path of the URL that represents the page. Dusk will use this URL when navigating to the page in the browser:
`url` 方法应该返回表示页面 URL 的路径。 Dusk 将会在浏览器中使用这个 URL 来导航到具体页面。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

句尾冒号

Copy link
Collaborator

@oustn oustn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是一个全新的文档,在之前是没有出现过的,所以翻译工作量会大一点。

其中有些错误性的已经指出。

作为一个阅读者,觉得有些语句不是太通顺,英语式语法味道太浓,建议可以润色调整一下,毕竟这个翻译是一个全新的内容,有些地方最好延续之前翻译风格。

对了,代码中的注释有些没有翻译,请补充

@summerblue
Copy link
Member

喵喵哥生病了

@summerblue summerblue merged commit 730d12f into laravel-china:5.4 Feb 23, 2017
@summerblue
Copy link
Member

我先 merge ,并且把 @oustn 建议修改的地方改过来了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants