How to use inlineType method in Playwright Internal

Best JavaScript code snippet using playwright-internal

inlineTypes.spec.js

Source:inlineTypes.spec.js Github

copy

Full Screen

1'use strict';2var components = require('../../src/components');3describe('inlineTypes section', function() {4 describe('login',function() {5 browser.get('/');6 components.login.loginDefault();7 // navigate to definitions tab8 browser.sleep(2000);9 components.layout.goToDefinitions();10 });11 describe('add/remove inlineTypes', function() {12 it('should not add inlineTypes with empty name', function(done) {13 components.definitions.page.pushNewTypeBtn();//open inlineType view14 components.definitions.types.saveType();//save inlineType view15 expect(components.layout.isElementDisplayed(element(by.cssContainingText('.definition-title-edit-error', 'Name is empty. Please select a name.')))).toBe(true);16 browser.sleep(200).then(done);17 });18 it('should add inlineTypes name and save it', function(done) {19 components.definitions.types.setTypeName('name');//set inlineType name20 components.definitions.types.saveType();//save inlineType view21 expect(components.definitions.page.countInlineTypes()).toBe(1);22 browser.sleep(200).then(done);23 });24 it('should not add inlineTypes if name exist', function(done) {25 components.definitions.page.pushNewTypeBtn();//open inlineType view26 components.definitions.types.setTypeName('name');//set inlineType name27 expect(components.layout.isElementDisplayed(element(by.cssContainingText('.definition-title-edit-error', 'Name already in use. Please select a different name.')))).toBe(true);28 components.definitions.types.closeType();//push cancel button29 browser.sleep(200).then(done);30 });31 it('should delete inlineType', function(done) {32 components.definitions.page.deleteInlineTypes();//delete inlineType33 expect(components.definitions.page.countInlineTypes()).toBe(0);34 browser.sleep(200).then(done);35 });36 });37 describe('inlineTypes properties', function() {38 it('should add new inlineType property', function(done) {39 components.definitions.page.pushNewTypeBtn();//open inlineType view40 components.definitions.types.setTypeName('name');//set inlineType name41 components.definitions.types.addNewProperty();//set new inlineType property42 expect(components.definitions.types.countProperties()).toBe(1);43 browser.sleep(200).then(done);44 });45 it('should save properties', function(done) {46 components.definitions.types.saveType();//save inlineType view47 components.definitions.page.pushEditInlineTypeBtn();//edit inlineType view48 expect(components.definitions.types.countProperties()).toBe(1);49 browser.sleep(200).then(done);50 });51 it('should rename property and not save properties with the same names', function(done) {52 components.definitions.types.addNewProperty();//set new inlineType property53 expect(components.definitions.types.countProperties()).toBe(2);54 components.definitions.types.clickProperty(1);//click inlineType property55 components.definitions.types.renameProperty('New_property_1', 'key', 1);//rename inlineType property56 components.definitions.types.clickEnterBtn();57 expect(components.layout.isElementDisplayed(element.all(by.cssContainingText('.nameEditError', 'Property name already in use. Please select a different name.')).get(0))).toBe(true);//error msg should appears58 expect(element(by.cssContainingText('.btn-primary', 'Save')).getAttribute('disabled')).toBe('true');//save btn should be disabled59 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(0).getText()).toBe('New_property_1');//property was renamed60 browser.sleep(200).then(done);61 });62 it('should switch to edit input mode', function(done) {63 components.definitions.types.clickProperty(1);//click inlineType property64 expect(components.layout.isElementDisplayed(element.all(by.model('property.key')).get(1))).toBe(true);//key field should be displayed65 expect(components.layout.isElementDisplayed(element.all(by.model('property.default')).get(1))).toBe(true);//default field btn should be displayed (we use autocomplete and he duplicate input)66 expect(components.layout.isElementDisplayed(element.all(by.model('property.description')).get(1))).toBe(true);//description field btn should be displayed67 browser.sleep(200).then(done);68 });69 it('should not close edit input mode if click on the area what renaming', function(done) {70 components.definitions.types.clickProperty(1);//click on the same property71 expect(components.layout.isElementDisplayed(element.all(by.model('property.key')).get(1))).toBe(true);//key field should be displayed72 expect(components.layout.isElementDisplayed(element.all(by.model('property.default')).get(1))).toBe(true);//default field btn should be displayed (we use autocomplete and he duplicate input)73 expect(components.layout.isElementDisplayed(element.all(by.model('property.description')).get(1))).toBe(true);//description field btn should be displayed74 browser.sleep(200).then(done);75 });76 it('should not rename field if click esc but should switch off edit mode', function(done) {77 components.definitions.types.renameProperty('New_property_5', 'key', 1);//rename inlineType property78 components.definitions.types.renameProperty('default', 'default', 1);//rename inlineType property79 components.definitions.types.renameProperty('description', 'description', 1);//rename inlineType property80 components.definitions.types.clickEscBtn();81 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(0).getText()).toBe('New_property_1');//property wasn't renamed82 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(1).getText()).toBe('');//property wasn't renamed83 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(2).getText()).toBe('');//property wasn't renamed84 expect(components.layout.isElementDisplayed(element.all(by.model('property.key')).get(1))).toBe(false);//key field should be displayed85 expect(components.layout.isElementDisplayed(element.all(by.model('property.default')).get(1))).toBe(false);//default field btn should be displayed (we use autocomplete and he duplicate input)86 expect(components.layout.isElementDisplayed(element.all(by.model('property.description')).get(1))).toBe(false);//description field btn should be displayed87 console.log(10);88 browser.sleep(200).then(done);89 });90 it('should not rename field if click by another property but should switch edit mode on new property', function(done) {91 components.definitions.types.clickProperty(1);//click inlineType property92 components.definitions.types.renameProperty('New_property_5', 'key', 1);//rename inlineType property93 components.definitions.types.renameProperty('default', 'default', 1);//rename inlineType property94 components.definitions.types.renameProperty('description', 'description', 1);//rename inlineType property95 components.definitions.types.clickProperty(0);//click inlineType property96 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(0).getText()).toBe('New_property_1');//property wasn't renamed97 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(1).getText()).toBe('');//property wasn't renamed98 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(2).getText()).toBe('');//property wasn't renamed99 expect(components.layout.isElementDisplayed(element.all(by.model('property.key')).get(1))).toBe(false);//key field should not be displayed100 expect(components.layout.isElementDisplayed(element.all(by.model('property.default')).get(1))).toBe(false);//default field btn should not be displayed (we use autocomplete and he duplicate input)101 expect(components.layout.isElementDisplayed(element.all(by.model('property.description')).get(1))).toBe(false);//description field btn not should be displayed102 expect(components.layout.isElementDisplayed(element.all(by.model('property.key')).get(0))).toBe(true);//key field should be displayed (first property)103 expect(components.layout.isElementDisplayed(element.all(by.model('property.default')).get(0))).toBe(true);//default field btn should be displayed (we use autocomplete and he duplicate input) (first property)104 expect(components.layout.isElementDisplayed(element.all(by.model('property.description')).get(0))).toBe(true);//description field btn should be displayed (first property)105 browser.sleep(200).then(done);106 });107 it('should rename field', function(done) {108 components.definitions.types.clickProperty(1);//click inlineType property109 components.definitions.types.renameProperty('New_property_5', 'key', 1);//rename inlineType property110 components.definitions.types.renameProperty('new_default', 'default', 1);//rename inlineType property111 components.definitions.types.renameProperty('new_description', 'description', 1);//rename inlineType property112 components.definitions.types.clickEnterBtn();//click inlineType property113 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(0).getText()).toBe('New_property_5');114 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(1).getText()).toBe('new_default');115 expect(element.all(by.repeater('property in data track by $index')).get(1).all(by.css('.select-input-height')).get(3).getText()).toBe('new_description');116 expect(components.layout.isElementDisplayed(element.all(by.model('property.key')).get(1))).toBe(false);//key field should not be displayed117 expect(components.layout.isElementDisplayed(element.all(by.model('property.default')).get(1))).toBe(false);//default field btn should not be displayed (we use autocomplete and he duplicate input)118 expect(components.layout.isElementDisplayed(element.all(by.model('property.description')).get(1))).toBe(false);//description field btn not should be displayed119 browser.sleep(200).then(done);120 });121 it('should delete properties', function(done) {122 components.definitions.types.deleteInlineTypeProperties();//save inlineType view123 expect(components.definitions.types.countProperties()).toBe(1);124 components.definitions.types.closeType();//push cancel button125 components.definitions.page.deleteInlineTypes();//delete inlineType126 browser.sleep(200).then(done);127 });128 });129 describe('inlineTypes interfaces and operations', function() {130 it('should add new inlineType interface', function(done) {131 components.definitions.page.pushNewTypeBtn();//open inlineType view132 expect(components.definitions.types.countInterfaces()).toBe(3);//default interfaces equal 3133 components.definitions.types.pushAddNewInterfaceBtn();//push Add New Interface Btn134 expect(components.layout.isElementDisplayed(element.all(by.css('.interfaces-block .add-block')).get(0))).toBe(true);135 components.definitions.types.saveNewInterface();//save new inlineType interface136 expect(components.definitions.types.countInterfaces()).toBe(4);//count interfaces137 browser.sleep(200).then(done);138 });139 it('should not add new inlineType interface if interface name already exist', function(done) {140 components.definitions.types.pushAddNewInterfaceBtn();//push Add New Interface Btn141 components.definitions.types.renameAddNewInterface('New_interface_4');//rename inlineType Interface142 expect(components.layout.isElementDisplayed(element(by.cssContainingText('.interface-config-footer span', 'Add Interface')))).toBe(false);143 components.definitions.types.closeNewInterface();//not save new inlineType interface144 browser.sleep(200).then(done);145 });146 it('should add operation when create interface', function(done) {147 components.definitions.types.pushAddNewInterfaceBtn();//push add new interface Btn148 expect(components.layout.isElementDisplayed(element.all(by.css('.interfaces-block .add-block')).get(0))).toBe(true);149 expect(components.definitions.types.countInterfaceOperations()).toBe(1);150 components.definitions.types.addNewInterfaceOperation(0);//add new interface operation151 expect(components.definitions.types.countInterfaceOperations()).toBe(2);//after added new operation152 components.definitions.types.closeNewInterface();//not save new inlineType interface153 expect(components.definitions.types.countInterfaces()).toBe(4);//should not add new interface154 browser.sleep(200).then(done);155 });156 it('should not add new inlineType interface if operation name already exist', function(done) {157 components.definitions.types.pushAddNewInterfaceBtn();//push add new interface Btn158 components.definitions.types.addNewInterfaceOperation(0);//add new interface operation159 components.definitions.types.createInterfaceRenameOperation('New_Operation_1');//rename inlineType interface operation160 expect(components.layout.isElementDisplayed(element.all(by.cssContainingText('.nameEditError', 'Operation name already in use. Please select a different name.')).get(0))).toBe(true);//error msg should appears161 expect(components.layout.isElementDisplayed(element(by.cssContainingText('.interface-config-footer span', 'Add Interface')))).toBe(false);//Add Interface btn should be hide162 expect(element(by.cssContainingText('.btn-primary', 'Save')).getAttribute('disabled')).toBe('true');//save btn should be disabled163 components.definitions.types.closeNewInterface();//not save new inlineType interface164 expect(components.definitions.types.countInterfaces()).toBe(4);//should not add new interface165 browser.sleep(200).then(done);166 });167 it('should remove operation when creating interface', function(done) {168 components.definitions.types.pushAddNewInterfaceBtn();//push add new interface Btn169 components.definitions.types.addNewInterfaceOperation(0);//add new interface operation170 components.definitions.types.removeInterfaceOperation();//remove operation171 expect(components.definitions.types.countInterfaceOperations()).toBe(1);//after removed new operation172 components.definitions.types.closeNewInterface();//not save new inlineType interface173 expect(components.definitions.types.countInterfaces()).toBe(4);//should not add new interface174 browser.sleep(200).then(done);175 });176 it('should delete custom interface', function(done) {177 expect(components.definitions.types.countInterfaces()).toBe(4);//count interfaces178 components.definitions.types.deleteInterface();//deleted custom interface179 expect(components.definitions.types.countInterfaces()).toBe(3);//after deleted custom interface180 components.definitions.types.closeType();//push cancel button181 browser.sleep(200).then(done);182 });183 it('should not save type if interface name exist', function(done) {184 components.definitions.page.pushNewTypeBtn();//push add new interface Btn185 components.definitions.types.pushAddNewInterfaceBtn();//push Add New Interface Btn186 components.definitions.types.saveNewInterface();//save new inlineType interface187 components.definitions.types.pushAddNewInterfaceBtn();//push Add New Interface Btn188 components.definitions.types.saveNewInterface();//save new inlineType interface189 components.definitions.types.clickInterface(0);//click inlineType interface190 components.definitions.types.renameInterface('New_interface_4', 1);//rename Interface191 components.definitions.types.clickEnterBtn();192 if(browser.browserName === 'chrome'){193 expect(components.layout.isElementDisplayed(element.all(by.cssContainingText('.nameEditError', 'Interface name already in use. Please select a different name.')).get(1))).toBe(true);//interface name error msg should appears194 expect(element(by.cssContainingText('.btn-primary', 'Save')).getAttribute('disabled')).toBe('true');//save btn should be disabled195 }196 console.log(20);197 browser.sleep(200).then(done);198 });199 it('should switch to edit interface mode', function(done) {200 components.definitions.types.clickInterface(0);//click inlineType property201 expect(components.layout.isElementDisplayed(element.all(by.repeater('interface in data track by $index')).get(0).element(by.model('interface.key')))).toBe(true);//key field should be displayed202 browser.sleep(200).then(done);203 });204 it('should not close edit interface mode if click on the area what renaming', function(done) {205 components.definitions.types.clickInterface(0);//click on the same interface206 expect(components.layout.isElementDisplayed(element.all(by.repeater('interface in data track by $index')).get(0).element(by.model('interface.key')))).toBe(true);//key field should be displayed207 browser.sleep(200).then(done);208 });209 it('should not rename field if click esc but should switch off edit mode', function(done) {210 components.definitions.types.renameInterface('New_interface_10', 1);//rename Interface211 components.definitions.types.clickEscBtn();212 expect(element.all(by.repeater('interface in data track by $index')).get(0).all(by.css('.select-input-height')).get(0).getText()).toBe('New_interface_4');//interface wasn't renamed213 expect(components.layout.isElementDisplayed(element.all(by.repeater('interface in data track by $index')).get(0).element(by.model('interface.key')))).toBe(false);//key field should not be displayed214 browser.sleep(200).then(done);215 });216 it('should not rename field if click by another interface field but should switch edit mode on new interface', function(done) {217 components.definitions.types.clickInterface(0);//click inlineType interface218 components.definitions.types.renameInterface('New_interface_10', 1);//rename Interface219 components.definitions.types.clickInterface(1);//click inlineType interface220 expect(element.all(by.repeater('interface in data track by $index')).get(0).all(by.css('.select-input-height')).get(0).getText()).toBe('New_interface_4');//interface wasn't renamed221 expect(components.layout.isElementDisplayed(element.all(by.repeater('interface in data track by $index')).get(0).element(by.model('interface.key')))).toBe(false);//key field should not be displayed222 expect(components.layout.isElementDisplayed(element.all(by.repeater('interface in data track by $index')).get(1).element(by.model('interface.key')))).toBe(true);//key field should be displayed (second interface)223 components.definitions.types.clickEscBtn();224 browser.sleep(200).then(done);225 });226 it('should rename interface field', function(done) {227 components.definitions.types.clickInterface(0);//click inlineType interface228 components.definitions.types.renameInterface('New_interface_10', 1);//rename Interface229 components.definitions.types.clickEnterBtn();230 expect(element.all(by.repeater('interface in data track by $index')).get(0).all(by.css('.select-input-height')).get(0).getText()).toBe('New_interface_10');//interface was renamed231 expect(components.layout.isElementDisplayed(element.all(by.repeater('interface in data track by $index')).get(0).element(by.model('interface.key')))).toBe(false);//key field should not be displayed232 browser.sleep(200).then(done);233 });234 it('should switch to edit operation mode', function(done) { //crash in phantom235 components.definitions.types.addNewInterfaceOperation(1);//add new interface operation236 components.definitions.types.clickOperation(2);//click operation237 if(browser.browserName === 'chrome') {238 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).element(by.model('item.operation ')))).toBe(true);//operation field should be displayed239 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).all(by.model('item.implementation ')).get(0))).toBe(true);//implementation field should be displayed240 }241 browser.sleep(200).then(done);242 });243 it('should not close edit operation mode if click on the area what renaming', function(done) { //crash in phantom244 components.definitions.types.clickOperation(2);//click on the same interface245 if(browser.browserName === 'chrome') {246 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).element(by.model('item.operation ')))).toBe(true);//operation field should be displayed247 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).all(by.model('item.implementation ')).get(0))).toBe(true);//implementation field should be displayed248 }249 browser.sleep(200).then(done);250 });251 /**252 * couldn't adjust operation rename tests(click field to edit) to work with phantomjs (3 tests belllow)253 * watch open issue https://github.com/ariya/phantomjs/issues/11637254 * couldn't overcome the "Element is not currently visible and may not be manipulated exception"255 * works perfectly in chrome.256 */257 it('should not rename field if click esc but should switch off edit mode', function(done) { //crash in phantom258 if(browser.browserName === 'chrome') {259 components.definitions.types.renameOperation('New_operation_10','operation ', 0);//rename operation260 components.definitions.types.renameOperation('implementation','implementation ', 0);//rename implementation261 components.definitions.types.clickEscBtn();262 expect(element.all(by.repeater('item in interface.data track by $index')).get(2).all(by.css('.select-input-height')).get(0).getText()).toBe('New_Operation_1');//operation wasn't renamed263 expect(element.all(by.repeater('item in interface.data track by $index')).get(2).all(by.css('.select-input-height')).get(1).getText()).toBe('');//implementation wasn't renamed264 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).element(by.model('item.operation ')))).toBe(false);//operation field should not be displayed265 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).all(by.model('item.implementation ')).get(0))).toBe(false);//implementation field should not be displayed266 }267 browser.sleep(200).then(done);268 });269 it('should not rename field if click by another operation field but should switch edit mode on new operation', function(done) {270 if(browser.browserName === 'chrome') {271 components.definitions.types.clickOperation(2);//click inlineType operation272 components.definitions.types.renameOperation('New_operation_10', 'operation ', 1);//rename operation273 components.definitions.types.renameOperation('implementation', 'implementation ', 0);//rename implementation274 components.definitions.types.clickOperation(3);//click inlineType interface275 expect(element.all(by.repeater('item in interface.data track by $index')).get(2).all(by.css('.select-input-height')).get(0).getText()).toBe('New_Operation_1');//operation wasn't renamed276 expect(element.all(by.repeater('item in interface.data track by $index')).get(2).all(by.css('.select-input-height')).get(1).getText()).toBe('');//implementation wasn't renamed277 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).element(by.model('item.operation ')))).toBe(false);//operation field should not be displayed278 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).all(by.model('item.implementation ')).get(0))).toBe(false);//implementation field should not be displayed279 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(3).element(by.model('item.operation ')))).toBe(true);//operation field should be displayed (second operation)280 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(3).all(by.model('item.implementation ')).get(0))).toBe(true);//implementation field should be displayed (second operation)281 components.definitions.types.clickEscBtn();282 }283 browser.sleep(200).then(done);284 });285 it('should rename operation field', function(done) { //crash in phantom286 if(browser.browserName === 'chrome') {287 components.definitions.types.clickOperation(2);//click inlineType operation288 components.definitions.types.renameOperation('New_operation_10', 'operation ', 0);//rename operation289 components.definitions.types.renameOperation('implementation', 'implementation ', 0);//rename implementation290 components.definitions.types.clickEnterBtn();291 expect(element.all(by.repeater('interface in data track by $index')).get(0).all(by.css('.select-input-height')).get(0).getText()).toBe('New_interface_10');//operation was renamed292 expect(element.all(by.repeater('interface in data track by $index')).get(0).all(by.css('.select-input-height')).get(2).getText()).toBe('implementation');//implementation was renamed293 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).element(by.model('item.operation ')))).toBe(false);//operation field should not be displayed294 expect(components.layout.isElementDisplayed(element.all(by.repeater('item in interface.data track by $index')).get(2).all(by.model('item.implementation ')).get(0))).toBe(false);//implementation field should not be displayed295 components.definitions.types.closeType();//push cancel button296 }297 browser.sleep(200).then(done);298 });299 });300 describe('inlineTypes inputs', function() {301 it('should add new inlineType input', function(done) {302 if(browser.browserName === 'chrome') {303 components.definitions.page.pushNewTypeBtn();//open inlineType view304 }305 components.definitions.types.pushAddNewInterfaceBtn();//push Add New Interface Btn306 components.definitions.types.saveNewInterface();//save new inlineType interface307 components.definitions.types.openInputsBlock();//open inputs block308 expect(components.layout.isElementDisplayed($$('[ng-show="isInterfaceOperationOpen && item == selectedItem"]').get(0))).toBe(true);//inputs block is appeared309 components.definitions.types.addInput();//add custom input310 expect(components.definitions.types.countInputs()).toBe(1);//count inputs after new input was added311 components.definitions.types.saveInput();//save custom input312 browser.sleep(200).then(done);313 });314 it('should remove inlineType input', function(done) {315 components.definitions.types.openInputsBlock();//open inputs block316 expect(components.definitions.types.countInputs()).toBe(1);//count inputs317 components.definitions.types.removeInput();//remove custom input318 expect(components.definitions.types.countInputs()).toBe(0);//count inputs after new input was removed319 components.definitions.types.saveInput();//save custom input320 browser.sleep(200).then(done);321 });322 it('should not save new inlineType input if name already exist', function(done) {323 components.definitions.types.openInputsBlock();//open inputs block324 components.definitions.types.addInput();//add custom input325 components.definitions.types.saveInput();//save custom input326 components.definitions.types.openInputsBlock();//open inputs block327 components.definitions.types.addInput();//add custom input328 components.definitions.types.clickInput(0);329 if(browser.browserName === 'chrome') { // rename wont work in phantomjs see comment in the above spec.330 components.definitions.types.renameInput('New_Input_2', 'name');//rename custom input331 components.definitions.types.clickEnterBtn();332 expect(components.layout.isElementDisplayed(element.all(by.cssContainingText('.nameEditError', 'Input name already in use. Please select a different name.')).get(0))).toBe(true);//error msg should appears333 expect(components.layout.isElementDisplayed(element.all(by.cssContainingText('.interface-config-footer span', 'Save Changes')).get(0))).toBe(false); //save btn should be hide334 expect(element(by.cssContainingText('.btn-primary', 'Save')).getAttribute('disabled')).toBe('true'); //save btn should be disabled335 }336 browser.sleep(200).then(done);337 });338 it('should switch to edit input mode', function(done) {339 if(browser.browserName === 'chrome') {340 components.definitions.types.clickInput(0);//click inlineType input341 expect(components.layout.isElementDisplayed(element.all(by.model('option.name')).get(0))).toBe(true);//name field should be displayed342 expect(components.layout.isElementDisplayed(element.all(by.model('option.description')).get(0))).toBe(true);//default field btn should be displayed (we use autocomplete and he duplicate input)343 expect(components.layout.isElementDisplayed(element.all(by.model('option.default ')).get(0))).toBe(true);//description field btn should be displayed344 }345 browser.sleep(200).then(done);346 });347 it('should not rename field if click esc but should switch off edit mode', function(done) {348 if(browser.browserName === 'chrome') { // rename wont work in phantomjs see comment in the above spec.349 components.definitions.types.renameInput('New_input_5', 'name');//rename inlineType input350 components.definitions.types.renameInput('default', 'default ');//rename inlineType input351 components.definitions.types.renameInput('description', 'description');//rename inlineType input352 components.definitions.types.clickEscBtn();353 expect(element.all(by.repeater('option in item.data track by $index')).get(0).all(by.css('.select-input-height')).get(0).getText()).toBe('New_Input_2');//property wasn't renamed354 expect(element.all(by.repeater('option in item.data track by $index')).get(0).all(by.css('.select-input-height')).get(1).getText()).toBe('');//property wasn't renamed355 expect(element.all(by.repeater('option in item.data track by $index')).get(0).all(by.css('.select-input-height')).get(2).getText()).toBe('');//property wasn't renamed356 expect(components.layout.isElementDisplayed(element.all(by.model('option.name')).get(0))).toBe(false);//name field should be displayed357 expect(components.layout.isElementDisplayed(element.all(by.model('option.description')).get(0))).toBe(false);//default field btn should be displayed (we use autocomplete and he duplicate input)358 expect(components.layout.isElementDisplayed(element.all(by.model('option.default ')).get(0))).toBe(false);//description field btn should be displayed359 }360 browser.sleep(200).then(done);361 });362 it('should not rename field if click by another input but should switch edit mode on new input', function(done) {363 if(browser.browserName === 'chrome') { // rename wont work in phantomjs see comment in the above spec.364 components.definitions.types.clickInput(0);//click inlineType input365 components.definitions.types.renameInput('New_input_5', 'name');//rename inlineType input366 components.definitions.types.renameInput('default', 'default ');//rename inlineType input367 components.definitions.types.renameInput('description', 'description');//rename inlineType input368 components.definitions.types.clickInput(1);//click inlineType input369 expect(element.all(by.repeater('option in item.data track by $index')).get(0).all(by.css('.select-input-height')).get(0).getText()).toBe('New_Input_2');//input wasn't renamed370 expect(element.all(by.repeater('option in item.data track by $index')).get(0).all(by.css('.select-input-height')).get(1).getText()).toBe('');//input wasn't renamed371 expect(element.all(by.repeater('option in item.data track by $index')).get(0).all(by.css('.select-input-height')).get(2).getText()).toBe('');//input wasn't renamed372 expect(components.layout.isElementDisplayed(element.all(by.model('option.name')).get(0))).toBe(false);//name field should not be displayed373 expect(components.layout.isElementDisplayed(element.all(by.model('option.default ')).get(0))).toBe(false);//default field btn should not be displayed374 expect(components.layout.isElementDisplayed(element.all(by.model('option.description')).get(0))).toBe(false);//description field btn not should be displayed375 expect(components.layout.isElementDisplayed(element.all(by.model('option.name')).get(1))).toBe(true);//name field should be displayed (first input)376 expect(components.layout.isElementDisplayed(element.all(by.model('option.default ')).get(1))).toBe(true);//default field btn should be displayed (first input)377 expect(components.layout.isElementDisplayed(element.all(by.model('option.description')).get(1))).toBe(true);//description field btn should be displayed (first input)378 }379 browser.sleep(200).then(done);380 });381 it('should rename field', function(done) {382 if(browser.browserName === 'chrome') { // rename wont work in phantomjs see comment in the above spec.383 components.definitions.types.clickInput(0);//click inlineType input384 components.definitions.types.renameInput('New_input_5', 'name');//rename inlineType input385 components.definitions.types.renameInput('default', 'default ');//rename inlineType input386 components.definitions.types.renameInput('description', 'description');//rename inlineType input387 components.definitions.types.clickEnterBtn();388 expect(element.all(by.repeater('option in item.data track by $index')).get(0).all(by.css('.select-input-height')).get(0).getText()).toBe('New_input_5');//input wasn't renamed389 expect(element.all(by.repeater('option in item.data track by $index')).get(0).all(by.css('.select-input-height')).get(1).getText()).toBe('description');//input wasn't renamed390 expect(element.all(by.repeater('option in item.data track by $index')).get(0).all(by.css('.select-input-height')).get(2).getText()).toBe('default');//input wasn't renamed391 expect(components.layout.isElementDisplayed(element.all(by.model('option.name')).get(0))).toBe(false);//name field should not be displayed392 expect(components.layout.isElementDisplayed(element.all(by.model('option.default ')).get(0))).toBe(false);//default field btn should not be displayed393 expect(components.layout.isElementDisplayed(element.all(by.model('option.description')).get(0))).toBe(false);//description field btn not should be displayed394 components.definitions.types.closeInputBlock();//doesn't save custom input395 }396 browser.sleep(200).then(done);397 });398 it('should not save new inlineType input', function(done) {399 if(browser.browserName === 'chrome') {400 components.definitions.types.openInputsBlock();//open inputs block401 expect(components.definitions.types.countInputs()).toBe(1);// at this stage this will fail for phantom which will expect 1 to be 2402 }403 components.definitions.types.addInput();//add custom input404 components.definitions.types.closeInputBlock();//close input block without save405 // due to 'refresh' issue I learned phantom has- I'm checking the number of inputs after the addition406 expect(components.definitions.types.countInputs()).toBe(1);//count inputs407 components.definitions.types.openInputsBlock();//open inputs block408 expect(components.definitions.types.countInputs()).toBe(1);//count inputs409 components.definitions.types.closeInputBlock();//close input block without save410 components.definitions.types.closeType();//push cancel button411 browser.sleep(200).then(done);412 });413 });414 describe('inlineTypes derived from', function() {415 it('should change derived from, change and save new default property value', function(done) {416 components.definitions.page.pushNewTypeBtn();//open inlineType view417 components.definitions.types.openDerivedFromDropdown();//open derived from dropdown418 components.definitions.types.setTypeName('test');//set inlineType name419 components.definitions.types.selectNewInlineDerivedFrom('cloudify.nodes.CloudifyManager');//select new derived from420 expect(components.definitions.types.selectedDerivedFrom()).toBe('cloudify.nodes.CloudifyManager');421 expect(components.definitions.types.countProperties()).toBe(2);422 expect(components.definitions.types.countInterfaces()).toBe(3);423 components.definitions.types.clickProperty(0);//click inlineType property424 components.definitions.types.renameProperty('new default value', 'default', 0);//rename inlineType property425 components.definitions.types.clickEnterBtn();426 expect(element.all(by.repeater('property in data track by $index')).get(0).all(by.css('.select-input-height')).get(1).getText()).toBe('new default value');427 components.definitions.types.saveType();//save inlineType view428 console.log(40);429 browser.sleep(200).then(done);430 });431 it('should not set default value in property on the edit page', function(done) {432 components.definitions.types.openSavedType(0);//open saved inlineType view433 expect(element.all(by.repeater('property in data track by $index')).get(0).all(by.css('.select-input-height')).get(1).getText()).toBe('new default value');434 components.definitions.types.saveType();//save inlineType view435 browser.sleep(200).then(done);436 });437 it('should not set default value in property on the edit page after saving blueprint', function(done) {438 components.layout.saveBlueprint();439 components.definitions.types.openSavedType(0);//open saved inlineType view440 expect(components.definitions.types.countProperties()).toBe(2);441 expect(components.definitions.types.countInterfaces()).toBe(3);442 expect(element.all(by.repeater('property in data track by $index')).get(0).all(by.css('.select-input-height')).get(1).getText()).toBe('new default value');443 components.definitions.types.saveType();//save inlineType view444 components.definitions.page.deleteInlineTypes();//delete inlineType445 browser.sleep(200).then(done);446 });447 });448 describe('inlineTypes used', function() {449 it('should delete inlineType if another inlineType not derived from this inlineType', function(done) {450 components.definitions.page.pushNewTypeBtn();//open inlineType view451 components.definitions.types.setTypeName('name');//set inlineType name452 components.definitions.types.saveType();//save inlineType view453 components.definitions.page.pushNewTypeBtn();//open inlineType view454 components.definitions.types.setTypeName('name1');//set inlineType name455 components.definitions.types.saveType();//save inlineType view456 components.definitions.page.deleteInlineTypes();//delete inlineType457 expect(components.definitions.page.countInlineTypes()).toBe(1);458 browser.sleep(200).then(done);459 });460 it('should not delete inlineType if another inlineType derived from this inlineType', function(done) {461 components.definitions.page.pushNewTypeBtn();//open inlineType view462 components.definitions.types.setTypeName('name');//set inlineType name463 components.definitions.types.openDerivedFromDropdown();//open derived from dropdown464 components.definitions.types.selectNewRelationshipDerivedFrom('name1');//select new derived from465 components.definitions.types.saveType();//save inlineType view466 components.definitions.page.clickDeleteInlineTypesBtn();//button should be disabled467 expect(components.layout.isElementPresent(element(by.css('.popover .okBtn')))).toBe(false);//popover should not show468 browser.sleep(1000).then(done);469 });470 });...

Full Screen

Full Screen

docbook.js

Source:docbook.js Github

copy

Full Screen

1/*2* Docbook Plugin for Beacon3*4* Copyright Satya Komaragiri and Beacon Team5* Licensed under GPLv36*7*/8function docbook_dtd() {9 var common = {10 11 inlineChildren: [12 "docbookXref",13 "docbookEmphasis",14 "docbookSubscript",15 "docbookSuperscript",16 "docbookSGMLTag",17 "docbookFileName",18 "docbookCommand",19 "docbookOption",20 "docbookUserInput",21 "docbookComputerOutput",22 "docbookClassName",23 "docbookConstant",24 "docbookFunction",25 "docbookParameter",26 "docbookReplaceable",27 "docbookVarname",28 "docbookStructfield",29 "docbookSystemItem",30 "docbookPackage",31 "docbookPrompt"32 ],33 34 blockSiblings: [35 "docbookScreen", 36 "docbookItemizedList",37 "docbookOrderedList",38 "docbookProcedure",39 "docbookPara",40 "docbookTable",41 "docbookNote",42 "docbookWarning",43 "docbookImportant"44 ]45 46 47 };48 var dtd = {49 docbookArticle: {50 removable: false51 },52 docbookArticleTitle: {53 type: "block",54 editorType: "lineedit",55 removable: false56 },57 docbookSection: {58 type: "block",59 inlineChildren: false,60 blockChildren: ["docbookSectionTitle"],61 siblings: ["docbookSection"],62 markup: {63 requiredChildNodes: ["docbookSectionTitle", "docbookPara"],64 tag: "div",65 attributes: {66 className: "section"67 }68 }69 },70 docbookSectionTitle: {71 type: "block",72 editorType: "lineedit",73 markup: {74 tag: "h2",75 attributes: false,76 sampleText: "Sample Section"77 }78 },79 docbookAffiliation: {80 type: "block",81 editorType: "lineedit",82 markup: {83 tag: "p",84 attributes: false,85 sampleText: "Sample Affiliation"86 }87 },88 docbookStreet: {89 type: "block",90 editorType: "lineedit",91 markup: {92 tag: "p",93 attributes: false,94 sampleText: "Sample Street"95 }96 },97 docbookCity: {98 type: "block",99 editorType: "lineedit",100 markup: {101 tag: "p",102 attributes: false,103 sampleText: "Sample City"104 }105 },106 docbookState: {107 type: "block",108 editorType: "lineedit",109 markup: {110 tag: "p",111 attributes: false,112 sampleText: "Sample State"113 }114 },115 docbookPostcode: {116 type: "block",117 editorType: "lineedit",118 markup: {119 tag: "p",120 attributes: false,121 sampleText: "Sample Postcode"122 }123 },124 docbookPara: {125 type: "block",126 inlineChildren: common.inlineChildren,127 blockChildren: false,128 siblings: common.blockSiblings,129 editorType: "richText",130 markup: {131 tag: "p",132 attributes: false,133 sampleText: "This is a sample paragraph."134 }135 },136 docbookTable: {137 type: "block",138 siblings: common.blockSiblings,139 markup: {140 tag: "table",141 attributes: { tabstyle: "striped", frame:"all", cols: "3"},142 requiredChildNodes: ["docbookThead","docbookTbody"]143 }144 },145 146 docbookThead: {147 type: "block",148 markup: {149 tag: "thead",150 attributes: false,151 requiredChildNodes: ["docbookRow"]152 }153 },154 docbookTbody: {155 type: "block",156 markup: {157 tag: "tbody",158 attributes: false,159 requiredChildNodes: ["docbookRow","docbookRow"]160 }161 },162 163 docbookRow: {164 type: "block",165 markup: {166 tag: "tr",167 attributes: false,168 requiredChildNodes: ["docbookEntry","docbookEntry","docbookEntry"]169 }170 },171 docbookEntry: {172 type: "block",173 markup: {174 tag: "td",175 attributes: false,176 requiredChildNodes: ["docbookPara"]177 }178 },179 docbookItemizedList: {180 type: "block",181 siblings: common.blockSiblings,182 markup: {183 requiredChildNodes: ["docbookItemizedListContainer"],184 tag: "div",185 attributes: false186 }187 },188 docbookItemizedListTitle: {189 type: "block",190 editorType: "lineedit",191 markup: {192 tag: "p",193 attributes: {194 className: "itemizedlistitle"195 },196 sampleText: "Sample Itemized List"197 }198 },199 docbookItemizedListContainer: {200 type: "block",201 markup: {202 requiredChildNodes: ["docbookListItem"],203 tag: "ul",204 attributes: {205 className: "itemizedList"206 }207 }208 },209 docbookOrderedList: {210 type: "block",211 siblings: common.blockSiblings,212 markup: {213 requiredChildNodes: ["docbookOrderedListContainer"],214 tag: "div",215 attributes: false216 }217 },218 docbookOrderedListTitle: {219 type: "block",220 editorType: "lineedit",221 markup: {222 tag: "p",223 attributes: {224 className: "orderedlistitle"225 },226 sampleText: "Sample Ordered List"227 }228 },229 docbookOrderedListContainer: {230 type: "block",231 markup: {232 requiredChildNodes: ["docbookListItem"],233 tag: "ol",234 attributes: {235 className: "orderedList"236 }237 }238 },239 docbookListItem: {240 type: "block",241 siblings: ["docbookListItem"],242 markup: {243 requiredChildNodes: ["docbookPara"],244 tag: "li",245 attributes: false246 }247 },248 docbookProcedure: {249 type: "block",250 siblings: common.blockSiblings,251 markup: {252 requiredChildNodes: ["docbookProcedureTitle", "docbookProcedureContainer"],253 tag: "div",254 attributes: false255 }256 },257 docbookProcedureTitle: {258 type: "block",259 editorType: "lineedit",260 markup: {261 tag: "p",262 attributes: {263 className: "procedurelistitle"264 },265 sampleText: "Sample Procedure"266 }267 },268 docbookProcedureContainer: {269 type: "block",270 markup: {271 requiredChildNodes: ["docbookStep"],272 tag: "ol",273 attributes: {274 className: "procedure"275 }276 }277 },278 docbookStep: {279 type: "block",280 siblings: ["docbookStep"],281 markup: {282 requiredChildNodes: ["docbookPara"],283 tag: "li",284 attributes: false285 }286 },287 docbookNote: {288 type: "block",289 inlineChildren: false,290 blockChildren: false,291 siblings: common.blockSiblings,292 markup: {293 requiredChildNodes: ["docbookNoteTitle", "docbookPara"],294 tag: "div",295 attributes: {296 className: "note"297 },298 }299 },300 docbookNoteTitle: {301 editorType: "lineedit",302 markup: {303 tag: "h2",304 attributes: {305 className: "label"306 },307 sampleText: "Sample Note"308 }309 },310 docbookWarning: {311 type: "block",312 inlineChildren: false,313 blockChildren: false,314 siblings: common.blockSiblings,315 markup: {316 requiredChildNodes: ["docbookWarningTitle", "docbookPara"],317 tag: "div",318 attributes: {319 className: "warning"320 },321 }322 },323 docbookWarningTitle: {324 editorType: "lineedit",325 markup: {326 tag: "h2",327 attributes: {328 className: "label"329 },330 sampleText: "Sample Warning"331 }332 },333 docbookImportant: {334 type: "block",335 inlineChildren: false,336 blockChildren: false,337 siblings: common.blockSiblings,338 markup: {339 requiredChildNodes: ["docbookImportantTitle", "docbookPara"],340 tag: "div",341 attributes: {342 className: "important"343 },344 }345 },346 docbookImportantTitle: {347 editorType: "lineedit",348 markup: {349 tag: "h2",350 attributes: {351 className: "label"352 },353 sampleText: "Sample Important"354 }355 },356 docbookScreen: {357 type: "block",358 inlineChildren: common.inlineChildren,359 blockChildren: false,360 siblings: common.blockSiblings,361 editorType: "richText",362 markup: {363 tag: "pre",364 attributes: {365 className: "screen"366 },367 sampleText: "This is a sample screen."368 }369 },370 // Inline Tags below this371 docbookXref: {372 type: "inline",373 inlineType: "prompt",374 markup: {375 tag: "a",376 attributes: {377 className: "xref",378 linkend: "prompt"379 }380 }381 },382 docbookSGMLTag: {383 type: "inline",384 inlineType: "generic",385 markup: {386 tag: "span",387 attributes: {388 className: "sgmltag-element"389 }390 }391 },392 docbookEmphasis: {393 type: "inline",394 inlineType: "generic",395 markup: {396 tag: "span",397 attributes: {398 className: "emphasis"399 }400 }401 },402 docbookFileName: {403 type: "inline",404 inlineType: "generic",405 markup: {406 tag: "code",407 attributes: {408 className: "filename"409 }410 }411 },412 docbookClassName: {413 type: "inline",414 inlineType: "generic",415 markup: {416 tag: "code",417 attributes: {418 className: "classname"419 }420 }421 },422 docbookConstant: {423 type: "inline",424 inlineType: "generic",425 markup: {426 tag: "code",427 attributes: {428 className: "constant"429 }430 }431 },432 docbookFunction: {433 type: "inline",434 inlineType: "generic",435 markup: {436 tag: "code",437 attributes: {438 className: "function"439 }440 }441 },442 docbookParameter: {443 type: "inline",444 inlineType: "generic",445 markup: {446 tag: "code",447 attributes: {448 className: "parameter"449 }450 }451 },452 docbookReplaceable: {453 type: "inline",454 inlineType: "generic",455 markup: {456 tag: "code",457 attributes: {458 className: "replaceable"459 }460 }461 },462 docbookVarname: {463 type: "inline",464 inlineType: "generic",465 markup: {466 tag: "code",467 attributes: {468 className: "varname"469 }470 }471 },472 docbookStructfield: {473 type: "inline",474 inlineType: "generic",475 markup: {476 tag: "code",477 attributes: {478 className: "structfield"479 }480 }481 },482 docbookSystemItem: {483 type: "inline",484 inlineType: "generic",485 markup: {486 tag: "code",487 attributes: {488 className: "systemitem"489 }490 }491 },492 docbookCommand: {493 type: "inline",494 inlineType: "generic",495 markup: {496 tag: "span",497 attributes: {498 className: "command",499 }500 }501 },502 docbookOption: {503 type: "inline",504 inlineType: "generic",505 markup: {506 tag: "span",507 attributes: {508 className: "option"509 }510 }511 },512 docbookUserInput: {513 type: "inline",514 inlineType: "generic",515 markup: {516 tag: "span",517 attributes: {518 className: "userinput",519 }520 }521 },522 docbookComputerOutput: {523 type: "inline",524 inlineType: "generic",525 markup: {526 tag: "span",527 attributes: {528 className: "computeroutput"529 }530 }531 },532 docbookPackage: {533 type: "inline",534 inlineType: "generic",535 markup: {536 tag: "span",537 attributes: {538 className: "package"539 }540 }541 },542 docbookSubscript: {543 type: "inline",544 inlineType: "generic",545 markup: {546 tag: "sub",547 attributes: false548 }549 },550 docbookSuperscript: {551 type: "inline",552 inlineType: "generic",553 markup: {554 tag: "sup",555 attributes: false556 }557 },558 docbookPrompt: {559 type: "inline",560 inlineType: "generic",561 markup: {562 tag: "code",563 attributes: {564 className: "prompt"565 }566 }567 },568 };569 return dtd;...

Full Screen

Full Screen

index.test.js

Source:index.test.js Github

copy

Full Screen

1/**2 *3 * create by szfeng4 *5 * @flow6 */7import React from 'react';8import 'jest-styled-components';9import Enzyme, { mount } from 'enzyme';10import Adapter from 'enzyme-adapter-react-16';11import Target from '../index';12import NavMenu from '../navmenu';13import renderer from 'react-test-renderer';14import Widget from '../../consts/index';15const data = [16 { value: 'Lugia Design of React', text: 'Lugia Design of React' },17 { value: '快速上手', text: '快速上手' },18 { value: '项目实战', text: '项目实战' },19 { value: '在Lugia-mega中使用', text: '在Lugia-mega中使用' },20 {21 value: 'Components',22 text: 'Components',23 children: [24 {25 value: 'General',26 text: 'General',27 describe: true,28 children: [29 { value: 'Button 按钮', text: 'Button 按钮' },30 { value: 'Icon 图标', text: 'Icon 图标' },31 ],32 },33 {34 value: 'Layout',35 text: 'Layout',36 describe: true,37 children: [38 { value: 'Grid 栅格', text: 'Grid 栅格' },39 { value: 'Layout 布局', text: 'Layout 布局' },40 ],41 },42 {43 value: 'Navigation',44 text: 'Navigation',45 describe: true,46 children: [47 { value: 'Affix 固钉', text: 'Affix 固钉' },48 { value: 'Breadcrumb 面包屑', text: 'Breadcrumb 面包屑' },49 { value: 'Dropdown 下拉菜单', text: 'Dropdown 下拉菜单' },50 { value: 'Menu 导航菜单', text: 'Menu 导航菜单' },51 { value: 'Pagination 分页', text: 'Pagination 分页' },52 { value: 'Steps 步骤条', text: 'Steps 步骤条' },53 ],54 },55 {56 value: 'Data Entry',57 text: 'Data Entry',58 describe: true,59 children: [60 { value: 'AutoComplete 自动完成', text: 'AutoComplete 自动完成' },61 { value: 'Cascader 级联选择', text: 'Cascader 级联选择' },62 { value: 'Checkbox 多选框', text: 'Checkbox 多选框' },63 { value: 'DatePicker 日期选择框', text: 'DatePicker 日期选择框' },64 { value: 'Form 表单', text: 'Form 表单' },65 { value: 'Input 输入框', text: 'Input 输入框' },66 ],67 },68 ],69 },70];71Enzyme.configure({ adapter: new Adapter() });72describe('NavMenu', () => {73 it(' mode inline,inlineType=ellipse', () => {74 const cmp = (75 <Target data={data} mode={'inline'} inlineExpandAll={true} inlineType={'ellipse'} />76 );77 expect(renderer.create(cmp).toJSON()).toMatchSnapshot();78 });79 it(' mode inline,inlineType=ellipse,theme=dark', () => {80 const cmp = (81 <Target82 data={data}83 mode={'inline'}84 theme={'dark'}85 inlineExpandAll={true}86 inlineType={'ellipse'}87 />88 );89 expect(renderer.create(cmp).toJSON()).toMatchSnapshot();90 });91 it('mode=inline,inlineType=primary ', () => {92 const cmp = (93 <Target data={data} mode={'inline'} inlineExpandAll={true} inlineType={'primary'} />94 );95 expect(renderer.create(cmp).toJSON()).toMatchSnapshot();96 });97 it('mode=inline,inlineType=primary,theme=dark ', () => {98 const cmp = (99 <Target100 data={data}101 mode={'inline'}102 theme={'dark'}103 inlineExpandAll={true}104 inlineType={'primary'}105 />106 );107 expect(renderer.create(cmp).toJSON()).toMatchSnapshot();108 });109 it(' mode=vertical ', () => {110 const cmp = <Target data={data} mode={'vertical'} />;111 expect(renderer.create(cmp).toJSON()).toMatchSnapshot();112 });113 it('inlineExpandAll: false', () => {114 const cmp = mount(115 <Target data={data} mode={'inline'} inlineExpandAll={false} inlineType={'primary'} />116 );117 expect(findTreeItem(cmp).length).toBe(5);118 treeItemPropsSelected(cmp, findTreeItem(cmp).length, []);119 clickTreeItem(cmp, 1);120 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [1]);121 clickTreeItem(cmp, 4);122 expect(findTreeItem(cmp).length).toBe(9);123 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [1]);124 });125 it('inlineExpandAll: true', () => {126 const cmp = mount(127 <Target data={data} mode={'inline'} inlineExpandAll={true} inlineType={'primary'} />128 );129 expect(findTreeItem(cmp).length).toBe(25);130 treeItemPropsSelected(cmp, findTreeItem(cmp).length, []);131 clickTreeItem(cmp, 1);132 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [1]);133 clickTreeItem(cmp, 4);134 expect(findTreeItem(cmp).length).toBe(5);135 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [1]);136 clickTreeItem(cmp, 4);137 expect(findTreeItem(cmp).length).toBe(25);138 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [1]);139 clickTreeItem(cmp, 5);140 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [1]);141 clickTreeItem(cmp, 6);142 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [6]);143 });144 it('受限 value', () => {145 const cmp = mount(146 <Target147 data={data}148 value={['项目实战']}149 mode={'inline'}150 inlineExpandAll={true}151 inlineType={'primary'}152 />153 );154 expect(findTreeItem(cmp).length).toBe(25);155 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [2]);156 clickTreeItem(cmp, 3);157 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [2]);158 clickTreeItem(cmp, 4);159 expect(findTreeItem(cmp).length).toBe(5);160 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [2]);161 });162 class LimitDemo extends React.Component<Object, Object> {163 constructor(props) {164 super(props);165 this.state = { value: ['项目实战'] };166 }167 render() {168 return (169 <Target170 inlineType={'ellipse'}171 mode={'inline'}172 data={data}173 separator={'/'}174 value={this.state.value}175 inlineExpandAll={true}176 onSelect={this.onSelect}177 />178 );179 }180 onSelect = target => {181 this.setState({ value: target.value });182 };183 }184 it('受限 value, onSelect setState', () => {185 const cmp = mount(<LimitDemo />);186 expect(findTreeItem(cmp).length).toBe(25);187 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [2]);188 clickTreeItem(cmp, 3);189 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [3]);190 clickTreeItem(cmp, 4);191 expect(findTreeItem(cmp).length).toBe(5);192 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [3]);193 clickTreeItem(cmp, 4);194 expect(findTreeItem(cmp).length).toBe(25);195 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [3]);196 clickTreeItem(cmp, 5);197 expect(findTreeItem(cmp).length).toBe(25);198 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [3]);199 clickTreeItem(cmp, 6);200 expect(findTreeItem(cmp).length).toBe(25);201 treeItemPropsSelected(cmp, findTreeItem(cmp).length, [6]);202 });203 function findTreeItem(cmp: Object) {204 return cmp.find('titleSpan');205 }206 function clickTreeItem(cmp: Object, index: number) {207 findTreeItem(cmp)208 .at(index)209 .simulate('click');210 }211 function treeItemPropsSelected(cmp: Object, allCount: number, checkedData: number[]) {212 for (let i = 0; i < allCount; i++) {213 if (checkedData.includes(i)) {214 expect(215 findTreeItem(cmp)216 .at(i)217 .prop('selected')218 ).toBe(true);219 } else {220 expect(221 findTreeItem(cmp)222 .at(i)223 .prop('selected')224 ).toBe(false);225 }226 }227 }228 function findMenu(cmp: Object) {229 return cmp.find(Widget.Menu);230 }...

Full Screen

Full Screen

typeConstants.js

Source:typeConstants.js Github

copy

Full Screen

1export const INLINE_STYLES = [2 {label: 'Bold', style: 'BOLD', icon: 'fa fa-bold'},3 {label: 'Italic', style: 'ITALIC', icon: 'fa fa-italic'},4 {label: 'Underline', style: 'UNDERLINE', icon: 'fa fa-underline'},5 // {label: 'Monospace', style: 'CODE'},6 {label: 'Strikethrough', style: 'STRIKETHROUGH', icon: 'fa fa-strikethrough'}7];8export const BLOCK_TYPES = [9 {label: 'Normal', style: 'unstyled'},10 {label: 'Heading - Large', style: 'header-one'},11 {label: 'Heading - Medium', style: 'header-two'},12 {label: 'Blockquote', style: 'blockquote'},13 {label: 'Unordered List', style: 'unordered-list-item'},14 {label: 'Ordered List', style: 'ordered-list-item'},15 {label: 'Code Block', style: 'code-block'},16 {label: 'Atomic', style: 'atomic'},17 {label: 'Center', style: 'center-align'},18 {label: 'Left', style: 'unstyled'},19 {label: 'Right', style: 'right-align'},20 {label: 'Justify', style: 'justify-align'},21];22export const POSITION_TYPES = [23 {label: 'Center', style: 'center-align', icon: 'fa fa-align-center'},24 {label: 'Left', style: 'unstyled', icon: 'fa fa-align-left'},25 {label: 'Right', style: 'right-align', icon: 'fa fa-align-right'},26 {label: 'Justify', style: 'justify-align', icon: 'fa fa-align-justify'},27 {label: 'Ordered List', style: 'ordered-list-item', icon: 'fa fa-list-ol'},28 {label: 'Unordered List', style: 'unordered-list-item', icon: 'fa fa-list-ul'},29 {label: 'Quote Block', style: 'blockquote', icon: 'fa fa-quote-right'},30 {label: 'Code Block', style: 'code-block', icon: 'fa fa-code'},31];32export const FONTSIZE_TYPES = [33 {inlineType: 'size', label: '5', style: 'SIZE-5'},34 {inlineType: 'size', label: '5.5', style: 'SIZE-5.5'},35 {inlineType: 'size', label: '6', style: 'SIZE-6'},36 {inlineType: 'size', label: '7.5', style: 'SIZE-7.5'},37 {inlineType: 'size', label: '8', style: 'SIZE-8'},38 {inlineType: 'size', label: '9', style: 'SIZE-9'},39 {inlineType: 'size', label: '9.5', style: 'SIZE-9.5'},40 {inlineType: 'size', label: '10', style: 'SIZE-10'},41 {inlineType: 'size', label: '10.5', style: 'SIZE-10.5'},42 {inlineType: 'size', label: '11', style: 'SIZE-11'},43 {inlineType: 'size', label: '12', style: 'SIZE-12'},44 {inlineType: 'size', label: '14', style: 'SIZE-14'},45 {inlineType: 'size', label: '16', style: 'SIZE-16'},46 {inlineType: 'size', label: '18', style: 'SIZE-18'},47 {inlineType: 'size', label: '20', style: 'SIZE-20'},48 {inlineType: 'size', label: '22', style: 'SIZE-22'},49 {inlineType: 'size', label: '24', style: 'SIZE-24'},50 {inlineType: 'size', label: '26', style: 'SIZE-26'},51 {inlineType: 'size', label: '28', style: 'SIZE-28'},52 {inlineType: 'size', label: '36', style: 'SIZE-36'},53 {inlineType: 'size', label: '48', style: 'SIZE-48'},54 {inlineType: 'size', label: '72', style: 'SIZE-72'},55];56export const TYPEFACE_TYPES = [57 {inlineType: 'typeface', label: 'Arial', style: 'Arial'},58 {inlineType: 'typeface', label: 'Helvetica', style: 'Helvetica'},59 {inlineType: 'typeface', label: 'Times New Roman', style: 'Times New Roman'},60 {inlineType: 'typeface', label: 'Courier New', style: 'Courier New'},61 {inlineType: 'typeface', label: 'Courier', style: 'Courier'},62 {inlineType: 'typeface', label: 'Palatino', style: 'Palatino'},63 {inlineType: 'typeface', label: 'Garamond', style: 'Garamond'},64 {inlineType: 'typeface', label: 'Bookman', style: 'Bookman'},65 {inlineType: 'typeface', label: 'Avant Garde', style: 'Avant Garde'},66 {inlineType: 'typeface', label: 'Verdana', style: 'Verdana'},67 {inlineType: 'typeface', label: 'Tahoma', style: 'Tahoma'},68 {inlineType: 'typeface', label: 'Impact', style: 'Impact'},69 {inlineType: 'typeface', label: 'Avenir', style: 'Avenir'},70 {inlineType: 'typeface', label: 'Nunito', style: 'Nunito'},...

Full Screen

Full Screen

inline_type.js

Source:inline_type.js Github

copy

Full Screen

1'use strict';2var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();3var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };4function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }5function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }6function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }7var _abstract_type = require('./abstract_type');8var _abstract_type2 = _interopRequireDefault(_abstract_type);9/**10 * Inline Mapping Type11 *12 * Expects 'createFn' to be defined (and be a function),13 * and calls it with the resolved arguments.14 */15var InlineType = (function (_AbstractType) {16 _inherits(InlineType, _AbstractType);17 function InlineType() {18 _classCallCheck(this, InlineType);19 _get(Object.getPrototypeOf(InlineType.prototype), 'constructor', this).call(this, 'inline', ['createFn']);20 }21 _createClass(InlineType, [{22 key: '_resolveObjectCreator',23 value: function _resolveObjectCreator(mapping) {24 return mapping.get('createFn');25 }26 }, {27 key: '_doCreateObject',28 value: function _doCreateObject(fn, args, mapping) {29 return fn.apply(null, args);30 }31 }]);32 return InlineType;33})(_abstract_type2['default']);...

Full Screen

Full Screen

videoRules.js

Source:videoRules.js Github

copy

Full Screen

1// @flow2import React from "react";3import styled from "styled-components";4import { nodeAttrs } from "@canner/slate-icon-shared";5export const VideoContiner = styled.iframe`6 src: ${props => props.src};7 width: ${props => props.width};8 height: ${props => props.height};9 margin-left: ${props => props.indent};10 display: flex;11 justify-content: ${props => {12 if (props.align === "center") return "center";13 else if (props.align === "right") return "flex-end";14 return "flex-start";15 }};16`;17const defaultAttrs = {18 id: node => node.data.get("id"),19 ...nodeAttrs20};21export default function(inlineType = "video", stylesAttr = defaultAttrs) {22 return {23 deserialize(el) {24 if (inlineType && el.tagName && el.tagName.toLowerCase() === "iframe") {25 return {26 object: "inline",27 type: inlineType,28 isVoid: true29 };30 }31 },32 serialize(obj) {33 if (obj.object == "inline" && obj.type === inlineType) {34 const align = stylesAttr.textAlign(obj);35 const indent = stylesAttr.paddingLeft(obj);36 const width = stylesAttr.width(obj) || 560;37 const height = stylesAttr.height(obj) || 315;38 const id = stylesAttr.id(obj);39 let link;40 if (inlineType === "youtube") {41 link = `https://www.youtube.com/embed/${id}`;42 } else if (inlineType === "dailymotion") {43 link = `https://www.dailymotion.com/embed/video/${id}`;44 } else if (inlineType === "vimeo") {45 link = `https://player.vimeo.com/video/${id}`;46 } else if (inlineType === "youku") {47 link = `https://player.youku.com/embed/${id}`;48 }49 return (50 <VideoContiner51 align={align}52 width={width}53 height={height}54 indent={indent}55 src={link}56 />57 );58 }59 }60 };...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import * as tslib_1 from "tslib";2import * as React from 'react';3import '../Common/style.css';4import { Button } from 'antd';5import { RichUtils } from 'draft-js';6import { inlineTypes } from '../config';7var InlineTypesControl = /** @class */ (function (_super) {8 tslib_1.__extends(InlineTypesControl, _super);9 function InlineTypesControl() {10 var _this = _super !== null && _super.apply(this, arguments) || this;11 // 点击按钮12 _this.clickBtn = function (e, style) {13 // 阻止点击按钮后editor失去了焦点,而且按钮的事件必须是onMouseDown,onClick调用该方法editor还是会失去焦点14 e.preventDefault();15 var newEditState = RichUtils.toggleInlineStyle(_this.props.editorState, style);16 _this.props.onInlineTypeChange(newEditState);17 };18 return _this;19 }20 InlineTypesControl.prototype.render = function () {21 var _this = this;22 var currentStyle = this.props.editorState.getCurrentInlineStyle();23 return (React.createElement("div", { style: { display: 'inline-block', margin: '15px 0' } }, inlineTypes.map(function (inlineType) {24 return React.createElement(Button, { key: inlineType.style, onMouseDown: function (e) { return _this.clickBtn(e, inlineType.style); }, className: currentStyle.has(inlineType.style) ? 'activeButton' : '', style: { marginRight: 8 } }, inlineType.label);25 })));26 };27 return InlineTypesControl;28}(React.Component));...

Full Screen

Full Screen

createInlineButton.js

Source:createInlineButton.js Github

copy

Full Screen

1import { matchInline } from './'2import createFormatButton from './createFormatButton'3const isDisabled = (inlineType, parentTypes) => ({ value }) =>4 value.isBlurred ||5 (!isActive(inlineType)({ value }) &&6 (value.isEmpty ||7 (parentTypes &&8 !value.blocks.every(block => parentTypes.includes(block.type)))))9const isActive = inlineType => ({ value }) =>10 value.inlines.some(matchInline(inlineType))11const reducer = inlineType => props => event => {12 event.preventDefault()13 const { onChange, value } = props14 const active = isActive(inlineType)(props)15 if (active) {16 return onChange(value.change().unwrapInline(inlineType))17 } else if (value.isExpanded) {18 return onChange(19 value.change().wrapInline({20 type: inlineType21 })22 )23 }24}25const defaultOptions = (inlineType, parentTypes) => ({26 isDisabled: isDisabled(inlineType, parentTypes),27 isActive: isActive(inlineType),28 reducer: reducer(inlineType)29})30const InlineButton = options => Component =>31 createFormatButton({32 ...defaultOptions(options.type, options.parentTypes),33 ...options34 })(Component)...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { inlineType } = require('playwright/lib/api');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch({ headless: false });5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.click('input[aria-label="Search"]');8 await inlineType(page, 'Hello World');9 await page.click('input[value="Google Search"]');10 await page.screenshot({ path: 'example.png' });11 await browser.close();12})();13const { chromium } = require('playwright');14(async () => {15 const browser = await chromium.launch({ headless: false });16 const context = await browser.newContext();17 const page = await context.newPage();18 await page.click('input[aria-label="Search"]');19 await page.type('Hello World');20 await page.click('input[value="Google Search"]');21 await page.screenshot({ path: 'example.png' });22 await browser.close();23})();24const { chromium } = require('playwright');25(async () => {26 const browser = await chromium.launch({ headless: false });27 const context = await browser.newContext();28 const page = await context.newPage();29 await page.click('input[aria-label="Search"]');30 await page.keyboard.type('Hello World');31 await page.click('input[value="Google Search"]');32 await page.screenshot({ path: 'example.png' });33 await browser.close();34})();35const { chromium } = require('playwright');36(async () => {37 const browser = await chromium.launch({ headless: false });38 const context = await browser.newContext();39 const page = await context.newPage();40 await page.click('input[aria-label="Search"]');41 await page.keyboard.insertText('Hello World');42 await page.click('input[value="Google Search"]');43 await page.screenshot({ path: 'example.png' });44 await browser.close();45})();46const { chromium } = require('playwright');47(async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const {inlineType} = require('playwright/lib/internal/keyboard');2const {chromium} = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 await page.focus('input[type="text"]');7 await inlineType(page, 'Hello World');8 await browser.close();9})();10const {inlineType} = require('playwright/lib/internal/keyboard');11const {chromium} = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const page = await browser.newPage();15 await page.focus('input[type="text"]');16 await inlineType(page, 'Hello World');17 await browser.close();18})();19const {inlineType} = require('playwright/lib/internal/keyboard');20const {chromium} = require('playwright');21(async () => {22 const browser = await chromium.launch();23 const page = await browser.newPage();24 await page.focus('input[type="text"]');25 await inlineType(page, 'Hello World');26 await browser.close();27})();28const {inlineType} = require('playwright/lib/internal/keyboard');29const {chromium} = require('playwright');30(async () => {31 const browser = await chromium.launch();32 const page = await browser.newPage();33 await page.focus('input[type="text"]');34 await inlineType(page, 'Hello World');35 await browser.close();36})();37const {inlineType} = require('playwright/lib/internal/keyboard');38const {chromium} = require('playwright');39(async () => {40 const browser = await chromium.launch();41 const page = await browser.newPage();42 await page.focus('input[type="text"]');43 await inlineType(page, 'Hello World');44 await browser.close();45})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const input = await page.$('input[name="q"]');7 const type = await input._client.send('DOM.getBoxModel', {nodeId: input._nodeId});8 console.log(type);9 await browser.close();10})();11{ model: { content: [ [ 0, 0 ], [ 0, 30 ], [ 100, 30 ], [ 100, 0 ] ],12 height: 30 },13 nodeId: 2 }

Full Screen

Using AI Code Generation

copy

Full Screen

1const { inlineType } = require('playwright-core/lib/server/supplements/recorder/recorderSupplement');2const { chromium } = require('playwright-core');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await inlineType(page, 'text="Get Started"', 'Hello World!');8 await browser.close();9})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { inlineType } = require('@playwright/test/lib/test/page');2const { test, expect } = require('@playwright/test');3test('test', async ({ page }) => {4 await page.click('text=Get started');5 await page.click('text=Get started');6 await inlineType(page, 'input[placeholder="Search"]', 'Hello World');7 const value = await page.inputValue('input[placeholder="Search"]');8 expect(value).toBe('Hello World');9});10I have also tried to use inlineType() method with the following code snippet:11await inlineType(page, 'input[placeholder="Search"]', 'Hello World', { delay: 100 });12I have also tried to use inlineType() method with the following code snippet:13await inlineType(page, 'input[placeholder="Search"]', 'Hello World', { delay: 100 });14await inlineType(page, 'input[placeholder="Search"]', 'Hello World', { delay: 100 });15await inlineType(page, 'input[placeholder="Search"]', 'Hello World', { delay: 100 });16await inlineType(page, 'input[placeholder="Search"]', 'Hello World', { delay: 100 });17await inlineType(page, 'input[placeholder="Search"]', 'Hello World', { delay: 100 });18await inlineType(page, 'input[placeholder="Search"]', 'Hello World

Full Screen

Using AI Code Generation

copy

Full Screen

1const { inlineType } = require('playwright/lib/internal/keyboard.js');2const { chromium, webkit, firefox } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.click('input[name="q"]');8 await inlineType(page, 'Hello World9');10 await page.screenshot({ path: 'example.png' });11 await browser.close();12})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { inlineType } = require('playwright');2(async () => {3 const { page } = await browser.newContext();4 await inlineType(page, 'Playwright', 'input[title="Search"]');5})();6const { inlineType } = require('playwright');7(async () => {8 const { page } = await browser.newContext();9 await inlineType(page, 'Playwright', 'input[title="Search"]');10})();11const { inlineType } = require('playwright');12(async () => {13 const { page } = await browser.newContext();14 await inlineType(page, 'Playwright', 'input[title="Search"]');15})();16const { inlineType } = require('playwright');17(async () => {18 const { page } = await browser.newContext();19 await inlineType(page, 'Playwright', 'input[title="Search"]');20})();21const { inlineType } = require('playwright');22(async () => {23 const { page } = await browser.newContext();24 await inlineType(page, 'Playwright', 'input[title="Search"]');25})();26const { inlineType } = require('playwright');27(async () => {28 const { page } = await browser.newContext();29 await inlineType(page, 'Playwright', 'input[title="Search"]');30})();31const { inlineType } = require('playwright');32(async () => {33 const { page } = await browser.newContext();34 await inlineType(page, 'Playwright', 'input[title="Search

Full Screen

Using AI Code Generation

copy

Full Screen

1const { inlineType } = require('playwright/lib/internal/keyboard');2inlineType('Hello World');3const { inlineType } = require('playwright/lib/internal/keyboard');4inlineType('Hello World');5const { inlineType } = require('playwright/lib/internal/keyboard');6inlineType('Hello World');7const { inlineType } = require('playwright/lib/internal/keyboard');8inlineType('Hello World');9const { inlineType } = require('playwright/lib/internal/keyboard');10inlineType('Hello World');11const { inlineType } = require('playwright/lib/internal/keyboard');12inlineType('Hello World');13const { inlineType } = require('playwright/lib/internal/keyboard');14inlineType('Hello World');15const { inlineType } = require('playwright/lib/internal/keyboard');16inlineType('Hello World');17const { inlineType } = require('playwright/lib/internal/keyboard');18inlineType('Hello World');19const { inlineType } = require('playwright/lib/internal/keyboard');20inlineType('Hello World');21const { inlineType } = require('playwright/lib/internal/keyboard');22inlineType('Hello World');23const { inlineType } = require('playwright/lib/internal/keyboard');24inlineType('Hello World');25const { inlineType } = require('playwright/lib/internal/keyboard');26inlineType('Hello World');27const { inlineType } = require('playwright/lib/internal/keyboard');28inlineType('Hello World');29const { inlineType } = require('playwright/lib/internal/keyboard');30inlineType('Hello World');

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful