2017-11-08 1 views
1

저는 재스민을 처음 접했고 페이지 객체와 함께 각도기를 사용하고 있습니다. 이 나타나는 다음 페이지 객체는 사양에 의해 호출 기능을 갖춘입니다 :toract가 각도기의 페이지 객체와 함께 작동하지 않습니다.

'use strict'; 

module.exports = { 
    structure: { 
     cliButton: element(by.id('cliSubmit')), 
     cliInput: element(by.id('commandLineInterface')), 
     casDrawButton: element(by.id('casdrawTrigger')), 
     benzeneIcon: element(by.id('cdBenzene')), 
     casDrawCanvas: element(by.id('cdCanvasContainer')), 
     saveUploadButton: element(by.id('cdOK')), 
     lastCommandResponse: element(by.id('commandResponse3')), 
     myFilesLink: element(by.id('my-stn-toggle')), 
     structuresLink: element(by.id('structureOptionsToggle')), 
     firstStructureName: element(by.id('structureNameLabel-0')), 
     returnHome: element(by.className('return-link')), 
     importStructure: element(by.id('importStructure')), 
     importBrowse: element(by.id('structureImportBrowse')), 
     importOK: element(by.id('structureImportModalOk')), 
     editStructureName: element(by.id('editStructureNameSave-0')), 
     structureDateTime: element(by.id('structureDate-0')), 
     structureSnippet: element(by.id('structureImage-0')), 
     firstEditButton: element(by.id('editStructure-0')), 
     firstUploadButton: element(by.id('uploadStructure-0')), 
     firstActionsButton: element(by.id('scriptActions-0')), 
     firstDeleteButton: element(by.id('confirmDelete-0')), 
     selectAll: element(by.id('selectAll')), 
     deleteAll: element(by.id('deleteStructures')), 
     selectCheckboxes: element(by.xpath("//*[contains(@id,'selectStructure')]")) 
    }, 

    casDrawSteps: function() { 
     var structure = this.structure; 
     var today = new Date(); 
     var year = today.getFullYear(); 

     structure.cliInput.sendKeys('fil reg'); 
     structure.cliButton.click(); 
     structure.casDrawButton.click(); 
     browser.sleep(6000); 
     structure.benzeneIcon.isEnabled(); 
     structure.casDrawCanvas.isEnabled(); 
     structure.benzeneIcon.click(); 
     structure.casDrawCanvas.click(); 
     structure.saveUploadButton.click(); 
     structure.cliButton.isEnabled(); 
     browser.sleep(6000); 
     expect(structure.lastCommandResponse.getText()).toContain('STRUCTURE UPLOADED'); 
     structure.myFilesLink.click(); 
     structure.structuresLink.click(); 
     expect(structure.firstStructureName.getText()).toMatch(year + '_' + /\d*/ + '_Structure'); 
     structure.returnHome.click(); 
     structure.cliButton.isEnabled() 

    }, 
}; 

문제 gettext를 후 toMatch, 그것은해야 정규식 일치, 그리고 내가 찾을 수있는 모든 정규식 참조에 따라되지 않는 것입니다 . 나는 jasmine-matchers를 설치했기 때문에 왜 이런 일이 일어나는지 확신 할 수 없다. 다음은이 함수로 스펙을 실행할 때받은 스택입니다.

Failures: 
1) Protractor STNext Smoke Test - Structure: CASDraw creates a structure in CasDraw and verifies the response in Messenger 
    Message: 
    Expected '2017_0013_Structure' to match '2017_/\d*/_Structure'. 
    Stack: 
    Error: Failed expectation 
     at Object.casDrawSteps (/home/heb29/Desktop/casnc/repos/stn-kraken-qa/spec/pages/structure_page.js:50:56) 
     at UserContext.<anonymous> (/home/heb29/Desktop/casnc/repos/stn-kraken-qa/spec/smoke_spec.js:93:23) 
     at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:112:25 
     at new ManagedPromise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1067:7) 
     at ControlFlow.promise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2396:12) 
     at schedulerExecute (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:95:18) 
     at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2970:14) 
     at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2953:27) 
     at asyncRun (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2860:25) 

무엇이 누락 되었습니까?

답변

관련 문제