久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='TIKvE'></bdo><ul id='TIKvE'></ul>

      <legend id='TIKvE'><style id='TIKvE'><dir id='TIKvE'><q id='TIKvE'></q></dir></style></legend>

        <small id='TIKvE'></small><noframes id='TIKvE'>

        <tfoot id='TIKvE'></tfoot>
      1. <i id='TIKvE'><tr id='TIKvE'><dt id='TIKvE'><q id='TIKvE'><span id='TIKvE'><b id='TIKvE'><form id='TIKvE'><ins id='TIKvE'></ins><ul id='TIKvE'></ul><sub id='TIKvE'></sub></form><legend id='TIKvE'></legend><bdo id='TIKvE'><pre id='TIKvE'><center id='TIKvE'></center></pre></bdo></b><th id='TIKvE'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='TIKvE'><tfoot id='TIKvE'></tfoot><dl id='TIKvE'><fieldset id='TIKvE'></fieldset></dl></div>

        在量角器中定義頁面對象的規范方法

        Canonical way to define page objects in Protractor(在量角器中定義頁面對象的規范方法)
          • <bdo id='5F1Ll'></bdo><ul id='5F1Ll'></ul>
              <tfoot id='5F1Ll'></tfoot>

                    <tbody id='5F1Ll'></tbody>
                1. <legend id='5F1Ll'><style id='5F1Ll'><dir id='5F1Ll'><q id='5F1Ll'></q></dir></style></legend>
                  <i id='5F1Ll'><tr id='5F1Ll'><dt id='5F1Ll'><q id='5F1Ll'><span id='5F1Ll'><b id='5F1Ll'><form id='5F1Ll'><ins id='5F1Ll'></ins><ul id='5F1Ll'></ul><sub id='5F1Ll'></sub></form><legend id='5F1Ll'></legend><bdo id='5F1Ll'><pre id='5F1Ll'><center id='5F1Ll'></center></pre></bdo></b><th id='5F1Ll'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5F1Ll'><tfoot id='5F1Ll'></tfoot><dl id='5F1Ll'><fieldset id='5F1Ll'></fieldset></dl></div>

                  <small id='5F1Ll'></small><noframes id='5F1Ll'>

                  本文介紹了在量角器中定義頁面對象的規范方法的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我們使用 頁面對象模式 已經有一段時間了.它絕對有助于組織端到端測試并使測試更具可讀性和簡潔性.

                  We've been using the Page Object pattern for quite a while. It definitely helps to organize the end-to-end tests and makes tests more readable and clean.

                  正如 使用頁面對象組織測試 Protractor 文檔頁面向我們展示的那樣,我們將每個頁面對象定義為一個函數并使用 new 來實例化"它:

                  As Using Page Objects to Organize Tests Protractor documentation page shows us, we are defining every page object as a function and use new to "instantiate" it:

                  "use strict";
                  
                  var HeaderPage = function () {
                      this.logo = element(by.css("div.navbar-header img"));
                  }
                  
                  module.exports = HeaderPage;
                  

                  用法:

                  "use strict";
                  
                  var HeaderPage = require("./../po/header.po.js");
                  
                  describe("Header Look and Feel", function () {
                      var header;
                  
                      beforeEach(function () {
                          browser.get("/#login");
                          header = new HeaderPage();
                      });
                  
                      it("should show logo", function () {
                          expect(header.logo.isDisplayed()).toBe(true);
                      });
                  
                  });
                  

                  但是,最近在 Protractor:Angular 測試變得容易谷歌測試博客文章,我注意到一個頁面對象被定義為一個對象:

                  But, recently in the Protractor: Angular testing made easy Google Testing Blog post, I've noticed that a page object is defined as an object:

                  var angularHomepage = {
                      nameInput : element(by.model('yourName')),
                      greeting : element(by.binding('yourName')),
                      get : function() {
                          browser.get('index.html');
                      },
                      setName : function(name) {
                          this.nameInput.sendKeys(name);
                      }
                  };
                  

                  這兩種引入Page Objects的方式有什么區別?我應該更喜歡一個嗎?

                  What is the difference between these two ways to introduce Page Objects? Should I prefer one against the other?

                  推薦答案

                  歸根結底,我覺得還是個人喜好問題.

                  Ultimately, I think it is a question of personal preference.

                  是的,您可以使用構造函數模式并在每個測試套件中實例化一個單例...是的,您可以使用上面的簡單對象文字...是的,您可以使用工廠函數...

                  Yes, you can use the constructor pattern and instantiate a singleton in each test suite... yes you could use a simple object literal as above... yes you could use a factory function...

                  通過類"(無論是偽語法還是 ES2015 語法)使用繼承來構建代碼與通過 mixins 擴展的對象在一般應用程序開發中是一個更廣泛的爭論,更不用說 e2e 測試了!

                  Structuring code using inheritance via "classes" (whether pseudo- or ES2015 syntax) vs objects extended via mixins is a much wider debate within application development in general, never mind e2e tests!

                  主要是在您的測試套件中進行清晰、一致的實踐,并盡可能提高代碼的可重用性.

                  The main thing is clear, consistent practice across your test suites and promoting code reusability wherever possible.

                  這篇關于在量角器中定義頁面對象的規范方法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)
                      <i id='Zsns6'><tr id='Zsns6'><dt id='Zsns6'><q id='Zsns6'><span id='Zsns6'><b id='Zsns6'><form id='Zsns6'><ins id='Zsns6'></ins><ul id='Zsns6'></ul><sub id='Zsns6'></sub></form><legend id='Zsns6'></legend><bdo id='Zsns6'><pre id='Zsns6'><center id='Zsns6'></center></pre></bdo></b><th id='Zsns6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Zsns6'><tfoot id='Zsns6'></tfoot><dl id='Zsns6'><fieldset id='Zsns6'></fieldset></dl></div>

                        • <bdo id='Zsns6'></bdo><ul id='Zsns6'></ul>
                          <legend id='Zsns6'><style id='Zsns6'><dir id='Zsns6'><q id='Zsns6'></q></dir></style></legend>
                            <tbody id='Zsns6'></tbody>

                            <tfoot id='Zsns6'></tfoot>

                            <small id='Zsns6'></small><noframes id='Zsns6'>

                            主站蜘蛛池模板: 黄a免费看 | 成人精品一区 | 精品国产不卡一区二区三区 | 午夜视频在线免费观看 | 久久国内精品 | 亚洲精品粉嫩美女一区 | 日日碰狠狠躁久久躁婷婷 | 国产农村妇女毛片精品久久麻豆 | 日韩国产精品一区二区三区 | 久久免费小视频 | 91精品一区二区三区久久久久 | 美女国内精品自产拍在线播放 | www.久久.com| 日本在线免费观看 | 亚洲国产中文在线 | 日韩一二区在线 | 精品国产黄色片 | 国产精品1 | 国产精品一二区 | 91欧美| 日韩精品不卡 | 欧美在线一区视频 | 欧美成人视屏 | 亚洲二区在线 | 欧美久操网| 户外露出一区二区三区 | 日韩精品免费在线观看 | 久久精品国产亚洲 | 亚洲综合字幕 | 成人深夜福利在线观看 | 日日日操 | 国产激情在线 | 婷婷久久精品一区二区 | 九九热视频这里只有精品 | 伊人网在线综合 | 日韩免费一区二区 | 精品久久久久久中文字幕 | 日本高清不卡视频 | 夜久久 | 毛片一级片 | 情侣黄网站免费看 |