hank9653
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- robots: noindex, nofollow tags: nuwa GA: UA-124732989-1 --- # step :::warning Recommended to use [**Book mode** <i class="fa fa-book"></i>](https://hackmd.io/c/rJwpejduE/%2F7FSjZv6LQ8-eJbwmcz6TRg) ::: GUI 的測試步驟由多個不同動作的介面操作所形成的集合,以搜尋的測試步驟為例,我們可以拆分成三個不同的動作,如下所述: 1. `輸入`搜尋關鍵字 2. `點擊`搜尋按鈕 3. `驗證`搜尋結果 在 Nuwa TestCafe 裡我們使用 YAML 定義測試步驟的動作([Action](#Action)),下面章節將會介紹如何使用。 ## Action 我們可以在測試(Test)裡定義測試步驟的動作,在 Nuwa TestCafe 提供五種 Action 讓使用者定義測試步驟。 - [click](#Click) - [navigateTo](#NavigateTo) - [executes](#Executes) - [expect](#Expect) - [customMethod](#CustomMethod) 測試步驟的結構如下範例所示,在 `test` 裡使用 `steps` 關鍵字進行測試步驟的定義,在執行測試時會依照順序對 GUI 介面進行操作及驗證。 ```yaml - test: steps: - typeText: parameter: String options: Object - click: parameter: String options: Object - expect: parameter: string {Assertion}: Array ``` ### Click ```yaml - click: element: element selector ``` | parameter | type | descrption | | ------------------ | ------ | ------------------------------------------------------------------------------------------------- | | element | String | 網頁上欲點擊的 element selector | | options (optional) | Object | 請參考 [Click Action Options](#Click-Action-Options) | ### TypeText ```yaml - typeText: element: element selector input: string ``` | parameter | type | descrption | | ------------------ | ------ | ------------------------------------------------------------------------------------------------------- | | element | String | 網頁上輸入框的 element selector | | input | String | 欲輸入至輸入框的文字 | | options (optional) | Object | 請參考 [TypeText Action Options](#TypeText-Action-Options) | ### NavigateTo ```yaml - navigateTo: url: 'https://www.google.com/' ``` | parameter | type | descrption | | --------- | ------ | ---------------- | | url | String | 欲跳轉頁面之網址 | ### Executes ```yaml - executes: - 'stepgroups/login.yml' ``` 可參考 [Advanced Features 的 Step Group](https://hackmd.io/c/rJwpejduE/%2FIEWwlsp6QSWBnh1CugUwDg) ### Expect ```yaml - expect: element: element slector contains: [innerText, 'string'] ``` | parameter | type | description | | ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------- | | element | String | 欲比對之網頁 element | | message (optional) | String | 如果測試失敗,則在報告中顯示的斷言消息。 | | options (optional) | Object | 請參考 [Testcafe Assertion Options](https://devexpress.github.io/testcafe/documentation/test-api/assertions/#assertion-options) | | {Assertion} | Array | 比對的方法,請參考以下之 [Assertion](#Assertion) | #### Assertion - [eql](#Deep-Equal-eql) - [notEql](#Not-Deep-Equal-notEql) - [ok](#Ok-ok) - [notOk](#Not-Ok-notOk) - [contains](#Contains-contains) - [notContains](#Not-Contains-notContains) - [typeOf](#Type-of-typeOf) - [notTypeOf](#Not-Type-of-notTypeOf) - [gt](#Greater-than-gt) - [gte](#Greater-than-or-Equal-to-gte) - [lt](#Less-than-lt) - [lte](#Less-than-or-Equal-to-lte) - within ( not support ) - notWithin ( not support ) - match ( not support ) - notMatch ( not support ) ##### Deep Equal (eql) | parameter | type | description | | --------- | -------------- | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | expected | String, Number | an expected value. | ```yaml eql: [ property, expected ] ``` ##### Not Deep Equal (notEql) | parameter | type | description | | ---------- | -------------- | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | unexpected | String, Number | an unexpected value. | ```yaml notEql: [ property, unexpected ] ``` ##### Ok (ok) | parameter | type | description | | --------- | ------ | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | ```yaml ok: [ property ] ``` ##### Not Ok (notOk) | parameter | type | description | | --------- | ------ | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | ```yaml notOk: [ property ] ``` ##### Contains (contains) | parameter | type | description | | --------- | -------------- | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | expected | String, Number | the expected value. | ```yaml contains: [ property, expected ] ``` ##### Not Contains (notContains) | parameter | type | description | | --------- | -------------- | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | expected | String, Number | the expected value. | ```yaml notContains: [ property, expected ] ``` ##### Type of (typeOf) | parameter | type | description | | --------- | ------ | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | typeName | String | the expected type | ```yaml typeOf: [ property, typeName ] ``` ##### Not Type of (notTypeOf) | parameter | type | description | | --------- | ------ | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | typeName | String | the unexpected type | ```yaml notTypeOf: [ property, typeName ] ``` ##### Greater than (gt) | parameter | type | description | | --------- | ------ | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | expected | Number | a comparison value | ```yaml gt: [ property, expected ] ``` ##### Greater than or Equal to (gte) | parameter | type | description | | --------- | ------ | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | expected | Number | a comparison value | ```yaml gte: [ property, expected ] ``` ##### Less than (lt) | parameter | type | description | | --------- | ------ | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | expected | Number | a comparison value | ```yaml lt: [ property, expected ] ``` ##### Less than or Equal to (lte) | parameter | type | description | | --------- | ------ | -------------------------------------------------- | | property | String | element 欲比對的屬性,若不需要使用屬性可輸入空字串 | | expected | Number | a comparison value | ```yaml lte: [ property, expected ] ``` ### CustomMethod 請參考進階功能的 [Custom Method](/WRvUzwfWTCWeSt5UPXvufA) ## Options 當有些動作需要另外的參數做處理時可以使用 Option 進行配置。 ### Click Action Options ```yaml - click: element: 'btn' options: modifiers: ctrl: Boolean alt: Boolean shift: Boolean meta: Boolean offsetX: Number offsetY: Number caretPos: Number speed: Number ``` 參數說明可以參考 TestCafe 官方的 [Click Action Options](https://devexpress.github.io/testcafe/documentation/test-api/actions/action-options.html#click-action-options) ### TypeText Action Options ```yaml - typeText: element: selector path input: 'hi' options: modifiers: ctrl: Boolean alt: Boolean shift: Boolean meta: Boolean offsetX: Number offsetY: Number caretPos: Number replace: Boolean paste: Boolean speed: Number ``` 參數說明可以參考 TestCafe 官方的 [TypeText Action Options](https://devexpress.github.io/testcafe/documentation/test-api/actions/action-options.html#typing-action-options)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully