Reputation: 871
I am working on a project that is more like a proof of concept. A POC for me actually, as I am sure that it thas been done before.
I am trying to work with Cucumber.js, Appium Server / Client, Node and Javascript on Visual Studio Code.
A little bit of background. I am new to Javascript but not entirely new to BDD / Cucumber and automated testing wit Appium.
I have hit a roadblock just at beginning the project and I can't understand what is wrong or where to go from here. Searching the internet has not got me anywhere - probably not searching in the right places r with the right keywords.
Let me explain. I have created feature files within a workspace in Visual Studio code as follows
Feature: Change Font Size
Scenario: Set Font Size to Default
Given that I am on Font Size option
When I click the default option
Then The font size should be set to default
Scenario: Set Font Size to Small
Given that I am on Font Size option
When I click the small option
Then The font size should be set to small
I have generated glue code by using the following command
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Projects\VisualStudioCode\CucumberAppium> node_modules/.bin/cucumber-js
All good as this generates the glue code / step definitions that I add to my js file. My js file looks as follows. This has been picked up AS IS after running the cucumber-js command (mentioned above)
const {Given,When,Then} = require('cucumber');
Given('that I am on Font Size option', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
When('I click the default option', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
Then('The font size should be set to default', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
When('I click the small option', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
Then('The font size should be set to small', function () {
// Write code here that turns the phrase above into concrete actions
return 'pending';
});
I haven't added any code yet, but when I run this Run->Run without debugging then the very least I expect to happen is NOTHING - since there is no code.
But I am getting an error (mentioned below)
C:\Program Files (x86)\nodejs\node.exe features\steps.js\
internal/validators.js:118
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined
at validateString (internal/validators.js:118:11)
at Object.relative (path.js:437:5)
at getDefinitionLineAndUri (c:\Projects\VisualStudioCode\CucumberAppium\node_modules\cucumber\lib\support_code_library_builder\build_helpers.js:184:27)
at buildStepDefinitionConfig (c:\Projects\VisualStudioCode\CucumberAppium\node_modules\cucumber\lib\support_code_library_builder\build_helpers.js:124:7)
at SupportCodeLibraryBuilder.defineStep (c:\Projects\VisualStudioCode\CucumberAppium\node_modules\cucumber\lib\support_code_library_builder\index.js:51:79)
at Object.<anonymous> (c:\Projects\VisualStudioCode\CucumberAppium\features\steps.js:3:1)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_INVALID_ARG_TYPE',
[Symbol(originalCallSite)]: [
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {}
],
[Symbol(mutatedCallSite)]: [
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {},
CallSite {}, CallSite {}
]
}
I know that there may be something that I may have overlooked.
I would be very greatful if someone could point me in the right direction.
My package.json is as follows
{
"name": "cucumberappium",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"cucumber": "^6.0.5",
"selenium-webdriver": "^4.0.0-alpha.7"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": ""
}
Thanks!
Upvotes: 1
Views: 1094