How to use suiteResolver method in qawolf

Best JavaScript code snippet using qawolf

config.specs.js

Source:config.specs.js Github

copy

Full Screen

1const path = require('path')2const Promise = require('bluebird')3const Boom = require('boom')4const yaml = require('js-yaml')5const test = require('../../../index')6const mocks = require('../mocks')7const fixtures = require('../fixtures')8const config = require('../../../lib/config')9const utils = require('../../../lib/utils')10const states = require('../../../lib/states')11test.describe('config', () => {12 let sandbox13 let mocksSandbox14 test.beforeEach(() => {15 sandbox = test.sinon.createSandbox()16 mocksSandbox = new mocks.Sandbox([17 'paths',18 'logs',19 'waiton',20 'fs'21 ])22 sandbox.stub(utils, 'extendProcessEnvVars').callsFake((vars) => {23 return vars24 })25 sandbox.stub(yaml, 'safeLoad')26 })27 test.afterEach(() => {28 sandbox.restore()29 mocksSandbox.restore()30 })31 const returnsConfig = function (conf) {32 states.clean()33 mocksSandbox.fs.stubs.readFile.returns(null, {})34 yaml.safeLoad.returns(conf)35 }36 const fileReadTests = function (method) {37 const fooDefaultConfigPath = '/fooDefaultConfig'38 const fooCustomConfigPath = '/fooCustomConfig'39 test.describe('when reading data from config file', () => {40 test.beforeEach(() => {41 states.clean()42 mocksSandbox.paths.stubs.defaultConfig.returns(fooDefaultConfigPath)43 mocksSandbox.paths.stubs.customConfig.returns(fooCustomConfigPath)44 })45 test.it('should calculate configuration only once, no matter how many times is called', () => {46 return config[method]()47 .then(config[method])48 .then(() => {49 return test.expect(mocksSandbox.fs.stubs.readFile).to.have.been.calledTwice()50 })51 })52 test.it('should calculate configuration again if states are reset', () => {53 return config[method]()54 .then(config[method])55 .then(states.clean)56 .then(config[method])57 .then(() => {58 return test.expect(mocksSandbox.fs.stubs.readFile.callCount).to.equal(4)59 })60 })61 test.it('should calculate configuration based on custom package configuration and on default Narval configuration', () => {62 const fooFilesContent = 'fooContent'63 mocksSandbox.fs.stubs.readFile.returns(null, fooFilesContent)64 return config[method]()65 .then(() => {66 return Promise.all([67 test.expect(mocksSandbox.fs.stubs.readFile).to.have.been.calledWith(fooDefaultConfigPath),68 test.expect(mocksSandbox.fs.stubs.readFile).to.have.been.calledWith(fooCustomConfigPath),69 test.expect(yaml.safeLoad.callCount).to.equal(2),70 test.expect(yaml.safeLoad).to.have.been.calledWith(fooFilesContent)71 ])72 })73 })74 test.it('should ignore errors reading files, log a warn, and consider their content as empty', () => {75 mocksSandbox.fs.stubs.readFile.returns(new Error())76 return config[method]()77 .then((configuration) => {78 return Promise.all([79 test.expect(mocksSandbox.logs.stubs.configNotFound.getCall(0).args[0].filePath).to.not.be.undefined()80 ])81 })82 })83 })84 }85 test.describe('standard method', () => {86 fileReadTests('standard')87 test.it('should add the "directories" property if it is not defined', () => {88 return config.standard()89 .then((standard) => {90 return test.expect(standard.directories).to.deep.equal([])91 })92 })93 test.it('should convert the "directories" property to an array if it is an string', () => {94 returnsConfig({95 standard: {96 directories: 'foo foo2 foo3'97 }98 })99 return config.standard()100 .then((standard) => {101 return test.expect(standard.directories).to.deep.equal([102 'foo',103 'foo2',104 'foo3'105 ])106 })107 })108 })109 test.describe('suitesByType method', () => {110 fileReadTests('suitesByType')111 test.it('should return default config if there is no custom config', () => {112 returnsConfig(null)113 yaml.safeLoad.onCall(0).returns(fixtures.config.customConfig)114 yaml.safeLoad.onCall(1).returns(null)115 return config.suitesByType()116 .then((suitesByType) => {117 return test.expect(suitesByType).to.deep.equal(fixtures.config.customResult.suitesByType)118 })119 })120 test.it('should return suites from custom config if it is provided', () => {121 returnsConfig(null)122 yaml.safeLoad.onCall(0).returns(fixtures.config.customConfig)123 yaml.safeLoad.onCall(1).returns(fixtures.config.defaultSuites)124 return config.suitesByType()125 .then((suitesByType) => {126 return Promise.all([127 test.expect(suitesByType).to.deep.equal(fixtures.config.customResult.suitesByType)128 ])129 })130 })131 })132 test.describe('dockerImages method', () => {133 fileReadTests('dockerImages')134 test.it('should return an empty array if no custom config is provided', () => {135 returnsConfig(null)136 yaml.safeLoad.onCall(0).returns(fixtures.config.customConfig)137 return config.dockerImages()138 .then((dockerImages) => {139 return Promise.all([140 test.expect(dockerImages).to.deep.equal([])141 ])142 })143 })144 test.it('should return dockerImages config', () => {145 const fooConfig = {146 'docker-images': {147 foo: 'fooImage'148 }149 }150 returnsConfig(fooConfig)151 return config.dockerImages()152 .then((dockerImages) => {153 return Promise.all([154 test.expect(dockerImages).to.deep.equal(fooConfig['docker-images'])155 ])156 })157 })158 })159 test.describe('dockerContainers method', () => {160 fileReadTests('dockerContainers')161 test.it('should return an empty array if no custom config is provided', () => {162 returnsConfig(null)163 yaml.safeLoad.onCall(0).returns(fixtures.config.customConfig)164 return config.dockerContainers()165 .then((dockerContainers) => {166 return Promise.all([167 test.expect(dockerContainers).to.deep.equal([])168 ])169 })170 })171 test.it('should return dockerContainers config', () => {172 const fooConfig = {173 'docker-containers': {174 foo: 'fooContainer'175 }176 }177 returnsConfig(fooConfig)178 return config.dockerContainers()179 .then((dockerContainers) => {180 return Promise.all([181 test.expect(dockerContainers).to.deep.equal(fooConfig['docker-containers'])182 ])183 })184 })185 })186 test.describe('allDockerCustomEnvVars method', () => {187 test.it('should return an array with all custom docker environment vars defined in all suites', () => {188 returnsConfig(fixtures.config.fullConfig)189 return config.allDockerCustomEnvVars()190 .then((allDockerCustomEnvVars) => {191 return test.expect(allDockerCustomEnvVars).to.deep.equal([192 'fooTestVar',193 'fooService2Var',194 'fooBeforeVar',195 'fooService1Var'196 ])197 })198 })199 test.it('should not throw an error if no test, before or services are defined', () => {200 returnsConfig({201 suites: {202 fooType: [{203 name: 'fooDockerSuite'204 }]205 }206 })207 return config.allDockerCustomEnvVars()208 .then((allDockerCustomEnvVars) => {209 return test.expect(allDockerCustomEnvVars).to.deep.equal([210 ])211 })212 })213 })214 test.describe('allComposeEnvVars method', () => {215 test.it('should return an object containing all needed environment vars for docker compose, with an empty string as value', () => {216 returnsConfig(fixtures.config.fullConfig)217 return config.allComposeEnvVars()218 .then((allComposeEnvVars) => {219 return Promise.all([220 test.expect(allComposeEnvVars).to.deep.equal({221 'coverage_options': '',222 'fooContainer1_command': '',223 'fooContainer1_command_params': '',224 'fooContainer1_coverage_enabled': '',225 'fooContainer1_wait_on': '',226 'fooContainer1_exit_after': '',227 'fooContainer1_narval_suite_type': '',228 'fooContainer1_narval_suite': '',229 'fooContainer1_narval_service': '',230 'fooContainer1_narval_is_docker': '',231 'fooContainer1_fooTestVar': '',232 'fooContainer1_fooService2Var': '',233 'fooContainer1_fooBeforeVar': '',234 'fooContainer1_fooService1Var': '',235 'fooContainer2_command': '',236 'fooContainer2_command_params': '',237 'fooContainer2_coverage_enabled': '',238 'fooContainer2_wait_on': '',239 'fooContainer2_exit_after': '',240 'fooContainer2_narval_suite_type': '',241 'fooContainer2_narval_suite': '',242 'fooContainer2_narval_service': '',243 'fooContainer2_narval_is_docker': '',244 'fooContainer2_fooTestVar': '',245 'fooContainer2_fooService2Var': '',246 'fooContainer2_fooBeforeVar': '',247 'fooContainer2_fooService1Var': '',248 'fooContainer3_command': '',249 'fooContainer3_command_params': '',250 'fooContainer3_coverage_enabled': '',251 'fooContainer3_wait_on': '',252 'fooContainer3_exit_after': '',253 'fooContainer3_narval_suite_type': '',254 'fooContainer3_narval_suite': '',255 'fooContainer3_narval_service': '',256 'fooContainer3_narval_is_docker': '',257 'fooContainer3_fooTestVar': '',258 'fooContainer3_fooService2Var': '',259 'fooContainer3_fooBeforeVar': '',260 'fooContainer3_fooService1Var': ''261 })262 ])263 })264 })265 test.it('should extend all docker compose needed vars with proccess environment vars', () => {266 returnsConfig(fixtures.config.fullConfig)267 return config.allComposeEnvVars()268 .then(() => {269 return test.expect(utils.extendProcessEnvVars).to.have.been.called()270 })271 })272 })273 test.describe('SuiteResolver constructor', () => {274 let suiteResolver275 let fooOptions = {}276 let initResolver277 let baseData278 test.beforeEach(() => {279 baseData = JSON.parse(JSON.stringify(fixtures.config.dockerSuite))280 initResolver = function (options = fooOptions, suiteTypeName = 'fooType', suitesByType = fixtures.config.dockerConfig.suitesByType) {281 suiteResolver = new config.SuiteResolver(baseData, suiteTypeName, options, suitesByType)282 }283 initResolver()284 })285 test.describe('typeName method', () => {286 test.it('should return the suite type name', () => {287 test.expect(suiteResolver.typeName()).to.equal('fooType')288 })289 })290 test.describe('name method', () => {291 test.it('should return the name of the suite', () => {292 test.expect(suiteResolver.name()).to.equal('fooDockerSuite')293 })294 })295 test.describe('describe method', () => {296 test.it('should return the description of the suite', () => {297 test.expect(suiteResolver.describe()).to.equal('Foo description')298 })299 test.it('should return an empty string if the suite has no describe field', () => {300 delete baseData.describe301 initResolver()302 test.expect(suiteResolver.describe()).to.equal('')303 })304 })305 test.describe('hasToRun method', () => {306 test.it('should return true if no suite option is received', () => {307 test.expect(suiteResolver.hasToRun()).to.equal(true)308 })309 test.it('should return false if suite option is received and does not match with the suite name', () => {310 initResolver({311 suite: 'fake-suite'312 })313 test.expect(suiteResolver.hasToRun()).to.equal(false)314 })315 })316 test.describe('isDocker method', () => {317 test.it('should return false if local option is received', () => {318 initResolver({319 local: true320 })321 test.expect(suiteResolver.isDocker()).to.equal(false)322 })323 test.it('should return true if the test has configured a docker container', () => {324 test.expect(suiteResolver.isDocker()).to.equal(true)325 })326 test.it('should return true if any service has configured a docker container', () => {327 delete baseData.test.docker328 initResolver()329 test.expect(suiteResolver.isDocker()).to.equal(true)330 })331 test.it('should return false if no service, nor test, has configured a docker container', () => {332 baseData = fixtures.config.localSuite333 initResolver()334 test.expect(suiteResolver.isDocker()).to.equal(false)335 })336 })337 test.describe('istanbulArguments method', () => {338 test.it('should return the coverage configuration, parsed to istanbul arguments', () => {339 baseData.coverage = {340 config: {341 dir: '.coverage/custom',342 verbose: true,343 print: 'detail',344 report: 'text'345 }346 }347 initResolver()348 test.expect(suiteResolver.istanbulArguments()).to.equal('--include-all-sources --root=. --colors --print=detail --dir=.coverage/custom --verbose --report=text')349 })350 test.it('should add a print=none option to istanbul arguments if logLevel is upper to info', () => {351 baseData.coverage = {352 config: {353 dir: '.coverage/custom',354 verbose: true,355 report: 'text'356 }357 }358 initResolver({359 logLevel: 4360 })361 test.expect(suiteResolver.istanbulArguments()).to.equal('--include-all-sources --root=. --colors --print=none --dir=.coverage/custom --verbose --report=text')362 })363 test.it('should not add a print=none option to istanbul arguments if config has defined an explicit print', () => {364 baseData.coverage = {365 config: {366 dir: '.coverage/custom',367 verbose: true,368 print: 'detail',369 report: 'text'370 }371 }372 initResolver({373 logLevel: 4374 })375 test.expect(suiteResolver.istanbulArguments()).to.equal('--include-all-sources --root=. --colors --print=detail --dir=.coverage/custom --verbose --report=text')376 })377 })378 test.describe('mochaArguments method', () => {379 test.it('should return the test configuration, parsed to mocha arguments', () => {380 baseData = fixtures.config.localSuite381 baseData.test.config = {382 recursive: false,383 reporter: 'list',384 grep: 'grepped'385 }386 initResolver()387 test.expect(suiteResolver.mochaArguments()).to.equal('--colors --reporter list --grep grepped foo/path/specs')388 })389 test.it('should add a silent reporter to mocha arguments if logLevel is upper to info', () => {390 baseData = fixtures.config.localSuite391 baseData.test.config = {392 recursive: false,393 grep: 'grepped'394 }395 initResolver({396 logLevel: 4397 })398 test.expect(suiteResolver.mochaArguments()).to.equal('--colors --reporter mocha-silent-reporter --grep grepped foo/path/specs')399 })400 test.it('should not add a silent reporter to mocha arguments if config has defined an explicit reporter', () => {401 baseData = fixtures.config.localSuite402 baseData.test.config = {403 recursive: false,404 reporter: 'list',405 grep: 'grepped'406 }407 initResolver({408 logLevel: 4409 })410 test.expect(suiteResolver.mochaArguments()).to.equal('--colors --reporter list --grep grepped foo/path/specs')411 })412 })413 test.describe('singleServiceToRun method', () => {414 test.it('should return a new serviceResolver of the service to run defined in options', () => {415 baseData = fixtures.config.localSuite416 initResolver({417 local: 'fooService'418 })419 test.expect(suiteResolver.singleServiceToRun().name()).to.equal('fooService')420 })421 test.it('should return false if there is no service to run defined in options', () => {422 test.expect(suiteResolver.singleServiceToRun()).to.equal(false)423 })424 test.it('should return false if the service to run defined in options is the test', () => {425 initResolver({426 local: 'test'427 })428 test.expect(suiteResolver.singleServiceToRun()).to.equal(false)429 })430 test.it('should throw an error if the desired service to run locally does not exiss in config', () => {431 initResolver({432 local: 'fake suite'433 })434 try {435 suiteResolver.singleServiceToRun()436 } catch (err) {437 test.expect(Boom.isBoom(err)).to.be.true()438 }439 })440 })441 test.describe('runSingleTest method', () => {442 test.it('should return true if it is defined in options to run only test locally', () => {443 initResolver({444 local: 'test'445 })446 test.expect(suiteResolver.runSingleTest()).to.equal(true)447 })448 test.it('should return false if it is not defined in options', () => {449 test.expect(suiteResolver.runSingleTest()).to.equal(false)450 })451 })452 test.describe('testWaitOn method', () => {453 const fooWaitConfig = {454 foo: 'foo'455 }456 test.it('should return undefined if there is no waitOn configuration', () => {457 baseData.test.docker = {}458 initResolver()459 test.expect(suiteResolver.testWaitOn()).to.be.undefined()460 })461 test.it('should return resources when an string is provided as configuration, splitting them by blank spaces', () => {462 baseData.test.docker = {463 'wait-on': 'fooResource:1 fooResource2/foo'464 }465 initResolver()466 test.expect(suiteResolver.testWaitOn()).to.deep.equal({467 resources: [468 'fooResource:1',469 'fooResource2/foo'470 ]471 })472 })473 test.it('should convert resources to an array when an string is provided', () => {474 baseData.test.docker = {475 'wait-on': {476 resources: 'fooResource:1 fooResource2/foo'477 }478 }479 initResolver()480 test.expect(suiteResolver.testWaitOn()).to.deep.equal({481 resources: [482 'fooResource:1',483 'fooResource2/foo'484 ]485 })486 })487 test.it('should convert custom wait-on expression for waiting services to be finished to a path to the correspondant exit-code log file', () => {488 baseData.test.docker = {489 'wait-on': 'exit:fooService'490 }491 initResolver()492 test.expect(suiteResolver.testWaitOn()).to.deep.equal({493 resources: [path.join('.narval', 'logs', 'fooType', 'fooDockerSuite', 'fooService', 'exit-code.log')]494 })495 })496 test.it('should convert custom wait-on expression for waiting services to be finished to a path to the correspondant exit-code log file, even when many resources are defined', () => {497 baseData.test.docker = {498 'wait-on': {499 resources: [500 'fooResource:1',501 'exit:fooService'502 ]503 }504 }505 initResolver()506 test.expect(suiteResolver.testWaitOn()).to.deep.equal({507 resources: ['fooResource:1', path.join('.narval', 'logs', 'fooType', 'fooDockerSuite', 'fooService', 'exit-code.log')]508 })509 })510 test.it('should convert custom wait-on expression for waiting services to be finished to a path to the correspondant exit-code log file, even when many resources are defined as string', () => {511 baseData.test.docker = {512 'wait-on': 'fooResource:1 exit:fooService'513 }514 initResolver()515 test.expect(suiteResolver.testWaitOn()).to.deep.equal({516 resources: ['fooResource:1', path.join('.narval', 'logs', 'fooType', 'fooDockerSuite', 'fooService', 'exit-code.log')]517 })518 })519 test.it('should return the test waitOn docker configuration if is docker', () => {520 baseData.test.docker = {521 'wait-on': fooWaitConfig522 }523 initResolver()524 test.expect(suiteResolver.testWaitOn()).to.equal(fooWaitConfig)525 })526 test.it('should return the test waitOn docker configuration if is local', () => {527 baseData.test.local = {528 'wait-on': fooWaitConfig529 }530 initResolver({531 local: true532 })533 test.expect(suiteResolver.testWaitOn()).to.equal(fooWaitConfig)534 })535 })536 test.describe('testIsCoveraged method', () => {537 test.it('should return true by default', () => {538 delete baseData.coverage539 test.expect(suiteResolver.testIsCoveraged()).to.equal(true)540 })541 test.it('should return true if it is explicitly configured', () => {542 baseData.coverage.from = 'test'543 test.expect(suiteResolver.testIsCoveraged()).to.equal(true)544 })545 test.it('should return false if it is configured to get coverage from another service', () => {546 baseData.coverage.from = 'foo-service'547 test.expect(suiteResolver.testIsCoveraged()).to.equal(false)548 })549 test.it('should return false if coverage is disabled', () => {550 baseData.coverage.enabled = false551 test.expect(suiteResolver.testIsCoveraged()).to.equal(false)552 })553 })554 test.describe('testEnvVars method', () => {555 test.it('should return all environment vars configured for the test', () => {556 baseData.test.docker.env = {557 fooVar: 'fooValue'558 }559 test.expect(suiteResolver.testEnvVars()).to.deep.equal({560 narval_is_docker: true,561 narval_service: 'test',562 narval_suite: 'fooDockerSuite',563 narval_suite_type: 'fooType',564 fooVar: 'fooValue'565 })566 })567 })568 test.describe('testDockerContainer method', () => {569 test.it('should return the name of the docker container configured for the test', () => {570 test.expect(suiteResolver.testDockerContainer()).to.equal('fooContainer3')571 })572 test.it('should return undefined if no docker container is configured', () => {573 delete baseData.test.docker574 test.expect(suiteResolver.testDockerContainer()).to.be.undefined()575 })576 })577 test.describe('beforeCommand method', () => {578 const fooBeforeCommand = 'foo before command'579 test.it('should return the docker before command configuration if it is docker', () => {580 baseData.before = {581 docker: {582 command: fooBeforeCommand583 }584 }585 initResolver()586 test.expect(suiteResolver.beforeCommand()).to.equal(fooBeforeCommand)587 })588 test.it('should return the docker before command configuration if it is local', () => {589 baseData.before = {590 local: {591 command: fooBeforeCommand592 }593 }594 initResolver({595 local: true596 })597 test.expect(suiteResolver.beforeCommand()).to.equal(fooBeforeCommand)598 })599 })600 test.describe('beforeEnvVars method', () => {601 test.it('should return all environment vars configured for the before command', () => {602 baseData.before = {603 docker: {604 command: 'foo',605 env: {606 fooVar: 'foo before var'607 }608 }609 }610 initResolver()611 test.expect(suiteResolver.beforeEnvVars()).to.deep.equal({612 'fooVar': 'foo before var',613 'narval_is_docker': true,614 'narval_service': 'before',615 'narval_suite': 'fooDockerSuite',616 'narval_suite_type': 'fooType'617 })618 })619 })620 test.describe('services method', () => {621 test.it('should return an array containing new Services resolvers for each configured service', () => {622 const services = suiteResolver.services()623 test.expect(services[0].name()).to.equal('fooService1')624 test.expect(services[1].name()).to.equal('fooService2')625 })626 test.describe('for each returned service', () => {627 let service628 test.beforeEach(() => {629 service = suiteResolver.services()[0]630 })631 test.describe('waitOn method', () => {632 test.it('should return the wait-on config of the service', () => {633 baseData.services[0].docker['wait-on'] = {634 resources: ['foo']635 }636 service = suiteResolver.services()[0]637 test.expect(service.waitOn()).to.deep.equal({638 resources: ['foo']639 })640 })641 test.it('should return undefined if there is no waitOn configuration', () => {642 baseData.services[0].docker = {}643 initResolver()644 test.expect(service.waitOn()).to.be.undefined()645 })646 test.it('should return resources when an string is provided as configuration, splitting them by blank spaces', () => {647 baseData.services[0].docker = {648 'wait-on': 'fooResource:1 fooResource2/foo'649 }650 initResolver()651 test.expect(service.waitOn()).to.deep.equal({652 resources: [653 'fooResource:1',654 'fooResource2/foo'655 ]656 })657 })658 test.it('should convert custom wait-on expression for waiting services to be finished to a path to the correspondant exit-code log file', () => {659 baseData.services[0].docker = {660 'wait-on': 'exit:fooService'661 }662 initResolver()663 test.expect(service.waitOn()).to.deep.equal({664 resources: [path.join('.narval', 'logs', 'fooType', 'fooDockerSuite', 'fooService', 'exit-code.log')]665 })666 })667 test.it('should convert custom wait-on expression for waiting services to be finished to a path to the correspondant exit-code log file, even when many resources are defined', () => {668 baseData.services[0].docker = {669 'wait-on': {670 resources: [671 'fooResource:1',672 'exit:fooService'673 ]674 }675 }676 initResolver()677 test.expect(service.waitOn()).to.deep.equal({678 resources: ['fooResource:1', path.join('.narval', 'logs', 'fooType', 'fooDockerSuite', 'fooService', 'exit-code.log')]679 })680 })681 test.it('should convert custom wait-on expression for waiting services to be finished to a path to the correspondant exit-code log file, even when many resources are defined as string', () => {682 baseData.services[0].docker = {683 'wait-on': 'fooResource:1 exit:fooService'684 }685 initResolver()686 test.expect(service.waitOn()).to.deep.equal({687 resources: ['fooResource:1', path.join('.narval', 'logs', 'fooType', 'fooDockerSuite', 'fooService', 'exit-code.log')]688 })689 })690 })691 test.describe('command method', () => {692 test.it('should return undefined if the service has not command configured', () => {693 delete baseData.services[0].docker.command694 service = suiteResolver.services()[0]695 test.expect(service.command()).to.be.undefined()696 })697 test.it('should return the command of the service', () => {698 test.expect(service.command()).to.equal('foo-docker-command2.js --fooParam1 --fooParam2')699 })700 test.it('should return the local command of the service if it is defined in options', () => {701 baseData = fixtures.config.localSuite702 initResolver({703 local: true704 })705 service = suiteResolver.services()[0]706 test.expect(service.command()).to.equal('foo-local-command')707 })708 })709 test.describe('isCoveraged method', () => {710 test.it('should return true if the service is coveraged in config', () => {711 test.expect(service.isCoveraged()).to.be.true()712 })713 test.it('should return false if the service is not coveraged in config', () => {714 delete baseData.coverage715 initResolver()716 service = suiteResolver.services()[0]717 test.expect(service.isCoveraged()).to.be.undefined()718 })719 })720 test.describe('envVars method', () => {721 test.it('should return the environment variables defined for the service', () => {722 test.expect(service.envVars()).to.deep.equal({723 'fooVar': 'foo value',724 'narval_is_docker': true,725 'narval_service': 'fooService1',726 'narval_suite': 'fooDockerSuite',727 'narval_suite_type': 'fooType'728 })729 })730 })731 test.describe('abortOnError method', () => {732 test.it('should return true if the service is coveraged in config', () => {733 test.expect(service.abortOnError()).to.be.true()734 })735 test.it('should return false if the service is not coveraged in config', () => {736 delete baseData.coverage737 initResolver()738 service = suiteResolver.services()[0]739 test.expect(service.abortOnError()).to.be.false()740 })741 test.it('should return true if the abort-on-error behavior is explicitly defined in config', () => {742 baseData.services[0]['abort-on-error'] = true743 initResolver()744 service = suiteResolver.services()[0]745 test.expect(service.abortOnError()).to.be.true()746 })747 })748 test.describe('dockerContainer method', () => {749 test.it('should return the docker container of the service', () => {750 test.expect(service.dockerContainer()).to.equal('fooContainer1')751 })752 test.it('should return undefined if the service has not docker container configured', () => {753 delete baseData.services[0].docker.container754 initResolver()755 service = suiteResolver.services()[0]756 test.expect(service.dockerContainer()).to.be.undefined()757 })758 })759 test.describe('exitAfter method', () => {760 test.it('should return the exit_after property of the service', () => {761 test.expect(service.exitAfter()).to.equal(10000)762 })763 test.it('should return an empty string if the service has not exit_after configured', () => {764 delete baseData.services[0].docker.exit_after765 initResolver()766 service = suiteResolver.services()[0]767 test.expect(service.exitAfter()).to.equal('')768 })769 })770 })771 })772 test.describe('runDownVolumes method', () => {773 test.it('should return undefined by default', () => {774 test.expect(suiteResolver.runDownVolumes()).to.be.undefined()775 })776 test.it('should return true if it is explicitly configured', () => {777 baseData.before = {778 docker: {779 'down-volumes': true780 }781 }782 initResolver()783 test.expect(suiteResolver.runDownVolumes()).to.equal(true)784 })785 })786 test.describe('buildDocker method', () => {787 test.it('should return true if it is defined in options', () => {788 initResolver({789 build: true790 })791 test.expect(suiteResolver.buildDocker()).to.be.true()792 })793 test.it('should return false if it is not defined in options', () => {794 initResolver()795 test.expect(suiteResolver.buildDocker()).to.be.false()796 })797 })798 test.describe('coverageFromService method', () => {799 test.it('should return undefined by default', () => {800 delete baseData.coverage801 initResolver()802 test.expect(suiteResolver.coverageFromService()).to.be.undefined()803 })804 test.it('should return false if it is explicitly configured to get coverage from test', () => {805 baseData.coverage.from = 'test'806 initResolver()807 test.expect(suiteResolver.coverageFromService()).to.equal(false)808 })809 test.it('should return true if it is configured to get coverage from another service', () => {810 baseData.coverage.from = 'foo-service'811 initResolver()812 test.expect(suiteResolver.coverageFromService()).to.equal(true)813 })814 })815 test.describe('dockerEnvVars method', () => {816 test.beforeEach(() => {817 mocksSandbox.waiton.stubs.configToArguments.returns('foo wait')818 })819 test.it('should throw an error if docker container for test is not found', () => {820 delete baseData.test.docker821 initResolver()822 try {823 suiteResolver.dockerEnvVars()824 } catch (err) {825 test.expect(Boom.isBoom(err)).to.be.true()826 }827 })828 test.it('should return all docker environment variables for the suite', () => {829 baseData.coverage.config = {830 dir: '.coverage/custom',831 verbose: true,832 print: 'detail',833 report: 'text'834 }835 initResolver()836 const envVars = suiteResolver.dockerEnvVars()837 test.expect(utils.extendProcessEnvVars).to.have.been.called()838 test.expect(envVars).to.deep.equal({839 'coverage_options': '--include-all-sources --root=. --colors --print=detail --dir=.coverage/custom --verbose --report=text',840 'fooContainer3_command': 'narval-default-test-command',841 'fooContainer3_command_params': '--recursive --colors --reporter spec foo2/specs',842 'fooContainer3_coverage_enabled': false,843 'fooContainer3_exit_after': '',844 'fooContainer3_narval_suite_type': 'fooType',845 'fooContainer3_wait_on': 'foo wait',846 'fooContainer3_narval_suite': 'fooDockerSuite',847 'fooContainer3_narval_service': 'test',848 'fooContainer3_narval_is_docker': true,849 'fooContainer1_command': 'foo-docker-command2.js',850 'fooContainer1_command_params': '-- --fooParam1 --fooParam2',851 'fooContainer1_coverage_enabled': true,852 'fooContainer1_exit_after': 10000,853 'fooContainer1_narval_suite_type': 'fooType',854 'fooContainer1_wait_on': 'foo wait',855 'fooContainer1_narval_suite': 'fooDockerSuite',856 'fooContainer1_narval_service': 'fooService1',857 'fooContainer1_narval_is_docker': true,858 'fooContainer1_fooVar': 'foo value',859 'fooContainer2_command': 'foo-docker-command',860 'fooContainer2_command_params': '',861 'fooContainer2_coverage_enabled': false,862 'fooContainer2_exit_after': '',863 'fooContainer2_narval_suite_type': 'fooType',864 'fooContainer2_wait_on': 'foo wait',865 'fooContainer2_narval_suite': 'fooDockerSuite',866 'fooContainer2_narval_service': 'fooService2',867 'fooContainer2_narval_is_docker': true868 })869 })870 test.it('should add extra dashes to command parameters for tests docker container if test coverage is enabled', () => {871 delete baseData.coverage872 initResolver()873 const envVars = suiteResolver.dockerEnvVars()874 test.expect(utils.extendProcessEnvVars).to.have.been.called()875 test.expect(envVars).to.deep.equal({876 'coverage_options': '--include-all-sources --root=. --colors --print=summary --dir=.coverage/fooType/fooDockerSuite',877 'fooContainer3_command': 'narval-default-test-command',878 'fooContainer3_command_params': '-- --recursive --colors --reporter spec foo2/specs',879 'fooContainer3_coverage_enabled': true,880 'fooContainer3_wait_on': 'foo wait',881 'fooContainer3_exit_after': '',882 'fooContainer3_narval_suite_type': 'fooType',883 'fooContainer3_narval_suite': 'fooDockerSuite',884 'fooContainer3_narval_service': 'test',885 'fooContainer3_narval_is_docker': true,886 'fooContainer1_command': 'foo-docker-command2.js',887 'fooContainer1_command_params': '--fooParam1 --fooParam2',888 'fooContainer1_coverage_enabled': undefined,889 'fooContainer1_wait_on': 'foo wait',890 'fooContainer1_exit_after': 10000,891 'fooContainer1_narval_suite_type': 'fooType',892 'fooContainer1_narval_suite': 'fooDockerSuite',893 'fooContainer1_narval_service': 'fooService1',894 'fooContainer1_narval_is_docker': true,895 'fooContainer1_fooVar': 'foo value',896 'fooContainer2_command': 'foo-docker-command',897 'fooContainer2_command_params': '',898 'fooContainer2_coverage_enabled': undefined,899 'fooContainer2_wait_on': 'foo wait',900 'fooContainer2_exit_after': '',901 'fooContainer2_narval_suite_type': 'fooType',902 'fooContainer2_narval_suite': 'fooDockerSuite',903 'fooContainer2_narval_service': 'fooService2',904 'fooContainer2_narval_is_docker': true905 })906 })907 })908 })...

Full Screen

Full Screen

suites.specs.js

Source:suites.specs.js Github

copy

Full Screen

1const Promise = require('bluebird')2const Boom = require('boom')3const test = require('../../../index')4const mocks = require('../mocks')5const fixtures = require('../fixtures')6const suites = require('../../../lib/suites')7test.describe('suites', () => {8 test.describe('run method', () => {9 const sandbox = test.sinon.createSandbox()10 let mocksSandbox11 test.beforeEach(() => {12 mocksSandbox = new mocks.Sandbox([13 'suitelocal',14 'suitedocker',15 'docker',16 'tracer',17 'options',18 'config',19 'logs'20 ])21 mocksSandbox.config.stubs.suitesByType.resolves(fixtures.config.manySuitesAndTypes.suitesByType)22 mocksSandbox.config.stubs.suiteResolver.hasToRun.returns(true)23 mocksSandbox.options.stubs.get.resolves(fixtures.options.suite)24 })25 test.afterEach(() => {26 sandbox.restore()27 mocksSandbox.restore()28 })29 test.it('should return a promise', () => {30 return suites.run()31 .then(() => {32 return test.expect(true).to.be.true()33 })34 })35 test.describe('when options do not specify to run all suites, an specific suite, or a suite type', () => {36 test.it('should print a warning log and resolve promise', () => {37 mocksSandbox.options.stubs.get.resolves(fixtures.options.standard)38 return suites.run()39 .then(() => {40 return Promise.all([41 test.expect(mocksSandbox.logs.stubs.skipAllSuites).to.have.been.called(),42 test.expect(mocksSandbox.suitedocker.stubs.Runner).to.not.have.been.called(),43 test.expect(mocksSandbox.suitelocal.stubs.Runner).to.not.have.been.called()44 ])45 })46 })47 })48 test.it('should print a log when starts the execution of a suite type', () => {49 return suites.run()50 .then(() => {51 return test.expect(mocksSandbox.logs.stubs.runningSuiteType).to.have.been.calledWith({52 type: 'fooType'53 })54 })55 })56 test.it('should call to clean docker volumes after suites execution is OK', () => {57 mocksSandbox.options.stubs.get.resolves(fixtures.options.suite)58 return suites.run()59 .then(() => {60 return test.expect(mocksSandbox.docker.stubs.downVolumes).to.have.been.called()61 })62 })63 test.it('should call to clean docker volumes even when suites execution fails', () => {64 mocksSandbox.options.stubs.get.resolves(fixtures.options.suite)65 mocksSandbox.suitelocal.stubs.run.rejects(new Error())66 return suites.run()67 .catch(() => {68 return test.expect(mocksSandbox.docker.stubs.downVolumes).to.have.been.called()69 })70 })71 test.it('should run suite using docker if configuration specifies it', () => {72 mocksSandbox.config.stubs.suiteResolver.isDocker.returns(true)73 return suites.run()74 .then(() => {75 return Promise.all([76 test.expect(mocksSandbox.suitedocker.stubs.Runner).to.have.been.called(),77 test.expect(mocksSandbox.suitelocal.stubs.Runner).to.not.have.been.called()78 ])79 })80 })81 test.it('should call to create docker files if one suite has to be executed using docker', () => {82 mocksSandbox.config.stubs.suiteResolver.isDocker.returns(true)83 return suites.run()84 .then(() => {85 return test.expect(mocksSandbox.docker.stubs.createFiles).to.have.been.called()86 })87 })88 test.it('should run suite without using docker if configuration specifies it', () => {89 mocksSandbox.config.stubs.suiteResolver.isDocker.returns(false)90 return suites.run()91 .then(() => {92 return Promise.all([93 test.expect(mocksSandbox.suitedocker.stubs.Runner).to.not.have.been.called(),94 test.expect(mocksSandbox.suitelocal.stubs.Runner).to.have.been.called()95 ])96 })97 })98 test.it('should print a log before starting suite execution', () => {99 return suites.run()100 .then(() => {101 return test.expect(mocksSandbox.logs.stubs.suiteLogger.startRun).to.have.been.called()102 })103 })104 test.it('should print a log when suite execution finish ok', () => {105 return suites.run()106 .then(() => {107 return test.expect(mocksSandbox.logs.stubs.suiteLogger.finishOk).to.have.been.called()108 })109 })110 test.it('should no execute suite and print a log if configuration specifies it', () => {111 mocksSandbox.config.stubs.suiteResolver.hasToRun.returns(false)112 return suites.run()113 .then(() => {114 return Promise.all([115 test.expect(mocksSandbox.suitedocker.stubs.Runner).to.not.have.been.called(),116 test.expect(mocksSandbox.suitelocal.stubs.Runner).to.not.have.been.called(),117 test.expect(mocksSandbox.logs.stubs.suiteLogger.finishOk).to.not.have.been.called(),118 test.expect(mocksSandbox.logs.stubs.suiteLogger.startRun).to.not.have.been.called(),119 test.expect(mocksSandbox.logs.stubs.suiteLogger.skip).to.have.been.called()120 ])121 })122 })123 test.it('should trace the error from an errored suite execution if it is not controlled by developer', () => {124 mocksSandbox.config.stubs.suiteResolver.isDocker.returns(false)125 mocksSandbox.suitelocal.stubs.run.rejects(new Error())126 return suites.run()127 .then(() => {128 return Promise.reject(new Error())129 })130 .catch(() => {131 return test.expect(mocksSandbox.tracer.stubs.error.callCount).to.equal(1)132 })133 })134 test.it('should reject the promise with a controlled error if suite execution fails', () => {135 mocksSandbox.config.stubs.suiteResolver.isDocker.returns(false)136 mocksSandbox.suitelocal.stubs.run.rejects(Boom.notImplemented('foo message'))137 return suites.run()138 .then(() => {139 return Promise.reject(new Error())140 })141 .catch((error) => {142 return Promise.all([143 test.expect(mocksSandbox.logs.stubs.suiteLogger.finishError).to.have.been.called(),144 test.expect(Boom.isBoom(error)).to.be.true()145 ])146 })147 })148 test.describe('when an specific suite type to be executed is defined in options', () => {149 test.it('should skip all other suites types executions, and run all suites in that type', () => {150 mocksSandbox.options.stubs.get.resolves(fixtures.options.suiteType)151 return suites.run()152 .then(() => {153 return Promise.all([154 test.expect(mocksSandbox.logs.stubs.runningSuiteType).to.have.been.calledWith({ type: 'fooType' }),155 test.expect(mocksSandbox.logs.stubs.skipSuiteType).to.have.been.calledWith({ type: 'fakeType' }),156 test.expect(mocksSandbox.suitelocal.stubs.Runner.callCount).to.equal(2)157 ])158 })159 })160 test.it('should not execute any suite type if provided one does not exists in config', () => {161 mocksSandbox.options.stubs.get.resolves({162 type: 'unrealType'163 })164 return suites.run()165 .then(() => {166 return Promise.all([167 test.expect(mocksSandbox.logs.stubs.skipSuiteType.callCount).to.equal(2),168 test.expect(mocksSandbox.suitelocal.stubs.Runner).to.not.have.been.called()169 ])170 })171 })172 test.it('should execute all suites in that specific type', () => {173 mocksSandbox.config.stubs.suiteResolver.isDocker.returns(true)174 mocksSandbox.options.stubs.get.resolves({175 type: 'fakeType'176 })177 return suites.run()178 .then(() => {179 return Promise.all([180 test.expect(mocksSandbox.docker.stubs.createFiles).to.have.been.calledTwice(),181 test.expect(mocksSandbox.suitedocker.stubs.Runner).to.have.been.calledTwice()182 ])183 })184 })185 })186 })...

Full Screen

Full Screen

RecentlyChanged.ts

Source:RecentlyChanged.ts Github

copy

Full Screen

1import SabreHotel from "../../../models/SabreHotel";2import SabreSuite from "../../../models/SabreSuite";3import TerminalFlow from "../TerminalFlow";4import FlowDirection from "../FlowDirection";5import HotelAndSuiteResolver, { HotelAndSuiteResolverResult } from "../HotelAndSuiteResolver";6import SelectHotel from "./SelectHotel";7import SelectSuite from "./SelectSuite";8export default class RecentlyChanged extends HotelAndSuiteResolver { 9 10 private HotelResolver?: SelectHotel;11 private SuiteResolver?: SelectSuite;12 private HotelResolved?: SabreHotel;13 private SuiteResolved?: SabreSuite;14 public Resolve(): Promise<TerminalFlow<HotelAndSuiteResolverResult>> {15 this.HotelResolver = new SelectHotel();16 return this.resolveHotel();17 }18 public OnBackSignal(): Promise<TerminalFlow<HotelAndSuiteResolverResult>> {19 return this.resolveSuite();20 }21 private resolveHotel(): Promise<TerminalFlow<HotelAndSuiteResolverResult>> {22 return this.HotelResolver!.Resolve()23 .then((flow) => {24 switch (flow.direction) {25 case FlowDirection.NEXT: {26 this.HotelResolved = flow.data!;27 this.SuiteResolver = new SelectSuite(this.HotelResolved);28 return this.resolveSuite()29 };30 case FlowDirection.PREVIOUS: {31 return Promise.resolve(new TerminalFlow<HotelAndSuiteResolverResult>(FlowDirection.PREVIOUS));32 };33 }34 return Promise.reject("Unhandled flow");35 })36 }37 private resolveSuite(): Promise<TerminalFlow<HotelAndSuiteResolverResult>> {38 return this.SuiteResolver!.Resolve()39 .then((flow) => {40 switch (flow.direction) {41 case FlowDirection.NEXT: {42 this.SuiteResolved = flow.data!;43 return Promise.resolve(new TerminalFlow(FlowDirection.NEXT, {hotel: this.HotelResolved!, suite: this.SuiteResolved!}));44 };45 case FlowDirection.PREVIOUS: {46 return this.resolveHotel()47 };48 }49 return Promise.reject("Unhandled flow");50 })51 }...

Full Screen

Full Screen

EmptyImages.ts

Source:EmptyImages.ts Github

copy

Full Screen

1import SabreHotel from "../../../models/SabreHotel";2import SabreSuite from "../../../models/SabreSuite";3import TerminalFlow from "../TerminalFlow";4import FlowDirection from "../FlowDirection";5import HotelAndSuiteResolver, { HotelAndSuiteResolverResult } from "../HotelAndSuiteResolver";6import SelectHotel from "./SelectHotel";7import SelectSuite from "./SelectSuite";8export default class EmptyImages extends HotelAndSuiteResolver { 9 10 private HotelResolver?: SelectHotel;11 private SuiteResolver?: SelectSuite;12 private HotelResolved?: SabreHotel;13 private SuiteResolved?: SabreSuite;14 public Resolve(): Promise<TerminalFlow<HotelAndSuiteResolverResult>> {15 this.HotelResolver = new SelectHotel();16 return this.resolveHotel();17 }18 public OnBackSignal(): Promise<TerminalFlow<HotelAndSuiteResolverResult>> {19 return this.resolveSuite();20 }21 private resolveHotel(): Promise<TerminalFlow<HotelAndSuiteResolverResult>> {22 return this.HotelResolver!.Resolve()23 .then((flow) => {24 switch (flow.direction) {25 case FlowDirection.NEXT: {26 this.HotelResolved = flow.data!;27 this.SuiteResolver = new SelectSuite(this.HotelResolved);28 return this.resolveSuite()29 };30 case FlowDirection.PREVIOUS: {31 return Promise.resolve(new TerminalFlow<HotelAndSuiteResolverResult>(FlowDirection.PREVIOUS));32 };33 }34 return Promise.reject("Unhandled flow");35 })36 }37 private resolveSuite(): Promise<TerminalFlow<HotelAndSuiteResolverResult>> {38 return this.SuiteResolver!.Resolve()39 .then((flow) => {40 switch (flow.direction) {41 case FlowDirection.NEXT: {42 this.SuiteResolved = flow.data!;43 return Promise.resolve(new TerminalFlow(FlowDirection.NEXT, {hotel: this.HotelResolved!, suite: this.SuiteResolved!}));44 };45 case FlowDirection.PREVIOUS: {46 return this.resolveHotel()47 };48 }49 return Promise.reject("Unhandled flow");50 })51 }...

Full Screen

Full Screen

config.mocks.js

Source:config.mocks.js Github

copy

Full Screen

1const test = require('../../../index')2const config = require('../../../lib/config')3const Mock = function () {4 const sandbox = test.sinon.createSandbox()5 const serviceResolverStubs = {6 waitOn: sandbox.stub(),7 command: sandbox.stub(),8 isCoveraged: sandbox.stub(),9 envVars: sandbox.stub(),10 abortOnError: sandbox.stub(),11 name: sandbox.stub(),12 dockerContainer: sandbox.stub(),13 exitAfter: sandbox.stub()14 }15 const suiteResolverStubs = {16 typeName: sandbox.stub(),17 name: sandbox.stub(),18 describe: sandbox.stub(),19 hasToRun: sandbox.stub(),20 isDocker: sandbox.stub(),21 istanbulArguments: sandbox.stub().returns(''),22 mochaArguments: sandbox.stub().returns(''),23 singleServiceToRun: sandbox.stub().returns(serviceResolverStubs),24 runSingleTest: sandbox.stub(),25 testWaitOn: sandbox.stub(),26 testIsCoveraged: sandbox.stub(),27 testEnvVars: sandbox.stub(),28 testDockerContainer: sandbox.stub(),29 beforeCommand: sandbox.stub(),30 beforeEnvVars: sandbox.stub(),31 services: sandbox.stub().returns([serviceResolverStubs]),32 runDownVolumes: sandbox.stub(),33 buildDocker: sandbox.stub(),34 dockerEnvVars: sandbox.stub(),35 coverageFromService: sandbox.stub()36 }37 let stubs = {38 standard: sandbox.stub(config, 'standard').usingPromise().resolves(true),39 suitesByType: sandbox.stub(config, 'suitesByType').usingPromise().resolves([]),40 dockerImages: sandbox.stub(config, 'dockerImages').usingPromise().resolves([]),41 dockerContainers: sandbox.stub(config, 'dockerContainers').usingPromise().resolves([]),42 allDockerCustomEnvVars: sandbox.stub(config, 'allDockerCustomEnvVars').usingPromise().resolves({}),43 allComposeEnvVars: sandbox.stub(config, 'allComposeEnvVars').usingPromise().resolves({}),44 SuiteResolver: sandbox.stub(config, 'SuiteResolver').returns(suiteResolverStubs),45 suiteResolver: suiteResolverStubs,46 serviceResolver: serviceResolverStubs47 }48 const restore = function () {49 sandbox.restore()50 }51 return {52 stubs: stubs,53 restore: restore54 }55}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { suiteResolver } = require("qawolf");2const { suite } = require("qawolf");3const { create } = require("qawolf");4const { launch } = require("qawolf");5const { register } = require("qawolf");6const { context } = require("qawolf");7const { click } = require("qawolf");8const { type } = require("qawolf");9const { closeBrowser } = require("qawolf");10const { waitFor } = require("qawolf");11const { press } = require("qawolf");12const { select } = require("qawolf");13const { check } = require("qawolf");14const { uncheck } = require("qawolf");15const { getText } = require("qawolf");16const { getAttribute } = require("qawolf");17const { getUrl } = require("qawolf");18const { getInnerText } = require("qawolf");19const { getHtml } = require("qawolf");20const { getValue } = require("qawolf");21const { getStyle } = require("qawolf");22const { getComputedStyle } = require("qawolf");

Full Screen

Using AI Code Generation

copy

Full Screen

1const { suiteResolver } = require("qawolf");2const { browserResolver } = require("qawolf");3const { create } = require("qawolf");4const { launch } = require("qawolf");5const { stop } = require("qawolf");6const { close } = require("qawolf");7const { create } = require("qawolf");8const { stop } = require("qawolf");9const { close } = require("qawolf");10const { launch } = require("qawolf");11const { create } = require("qawolf");12const { launch } = require("qawolf");13const { stop } = require("qawolf");14const { close } = require("qawolf");15const { browserResolver } = require("qawolf");16const { create } = require("qawolf");17const { launch } = require("qawolf");18const { stop } = require("qawolf");19const { close } = require("qawolf");20const { browserResolver } = require("qawolf");21const { create } = require("qawolf");22const { launch } = require("qawolf");23const { stop } = require("q

Full Screen

Using AI Code Generation

copy

Full Screen

1const { suiteResolver } = require('@qawolf/suite');2const { suite } = require('@qawolf/web');3const { suiteResolver } = require('@qawolf/suite');4const { suite } = require('@qawolf/web');5const { suiteResolver } = require('@qawolf/suite');6const { suite } = require('@qawolf/web');7const { suiteResolver } = require('@qawolf/suite');8const { suite } = require('@qawolf/web');9const { suiteResolver } = require('@qawolf/suite');10const { suite } = require('@qawolf/web');11const { suiteResolver } = require('@qawolf/suite');12const { suite } = require('@qawolf/web');13const { suiteResolver } = require('@qawolf/suite');14const { suite } = require('@qawolf/web');15const { suiteResolver } = require('@qawolf/suite');16const { suite } = require('@qawolf/web');17const { suiteResolver } = require('@qawolf/suite');18const { suite } = require('@qawolf/web');19const { suiteResolver } = require('@qawolf/suite');20const { suite } = require('@qawolf/web');21const { suiteResolver } = require('@qawolf/suite');22const { suite } = require('@qawolf/web');23const { suiteResolver } = require('@qawolf/suite');24const { suite } = require('@qawolf/web');25const { suiteResolver } = require('@qawolf/suite');26const { suite } = require('@qawolf/web');27const { suiteResolver }

Full Screen

Using AI Code Generation

copy

Full Screen

1const { suiteResolver } = require("qawolf");2const { resolve } = require("path");3module.exports = suiteResolver({4 testPath: resolve(__dirname, "test.spec.js"),5});6const { suite } = require("qawolf");7describe("test", () => {8 let browser;9 let page;10 beforeAll(async () => {11 browser = await suite({12 testPath: resolve(__dirname, "test.spec.js"),13 });14 });15 afterAll(async () => {16 await browser.close();17 });18 beforeEach(async () => {19 page = await browser.newPage();20 });21 afterEach(async () => {22 await page.close();23 });24 it("test", async () => {25 });26});27{28 "scripts": {29 }30}31const { create } = require("qawolf");32create({33});34const { createBrowser } = require("qawolf");35const browser = await createBrowser();36- `options` (object) - [puppeteer.launch](

Full Screen

Using AI Code Generation

copy

Full Screen

1const { suiteResolver } = require('qawolf');2const { suite } = require('./suite');3suiteResolver(suite).then(() => {4 console.log('Finished running suite');5});6const { createSuite } = require('qawolf');7const suite = createSuite();8module.exports = { suite };9const { suite } = require('./suite');10const { test } = require('qawolf');11test('Test', async () => {12 await suite.run();13});14const { suite } = require('./suite');15const { test } = require('qawolf');16test('Test', async () => {17 await suite.run();18});19const { suite } = require('./suite');20const { test } = require('qawolf');21test('Test', async () => {22 await suite.run();23});24const { suite } = require('./suite');25const { test } = require('qawolf');26test('Test', async () => {27 await suite.run();28});29const { suite } = require('./suite');30const { test } = require('qawolf');31test('Test', async () => {32 await suite.run();33});34const { suite } = require('./suite');35const { test } = require('qawolf');36test('Test', async () => {37 await suite.run();38});39const { suite } = require('./suite');40const { test } = require('qawolf');41test('Test', async () => {42 await suite.run();43});44const { suite } = require('./suite');45const { test } = require('qawolf');46test('Test', async () => {47 await suite.run();48});49const { suite } = require('./suite');50const { test } = require('qawolf');51test('Test', async () => {52 await suite.run();53});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { suiteResolver } = require("qawolf");2const suite = suiteResolver("Suite Name");3const { testResolver } = require("qawolf");4const test = testResolver("Test Name");5const { testResolver } = require("qawolf");6const test = testResolver("Test Name");7const { suiteResolver } = require("qawolf");8const suite = suiteResolver("Suite Name");9const { testResolver } = require("qawolf");10const test = testResolver("Test Name");11const { suiteResolver } = require("qawolf");12const suite = suiteResolver("Suite Name");13const { testResolver } = require("qawolf");14const test = testResolver("Test Name");15const { suiteResolver } = require("qawolf");16const suite = suiteResolver("Suite Name");17const { testResolver } = require("qawolf");18const test = testResolver("Test Name");

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run qawolf 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