I am using this vue select https://vue-select.org/guide/values.html#getting-and-setting for the dropdown countries. Here is the code:
<v-select
v-model="project_data.country"
:options="project_data.countries"
:reduce="country => country.value"
label="label"
:state="errors.length > 0 ? false : null"
/>
This project_data.country value is : 5
This project_data.countries value is array of object. Something like :
[
{ value : 1, label : Dhaka },
{ value : 2, label : India },
and so on ......
]
Now on my local, I can see the label on the dropdown BUT when I complied the code using :
npm run prod
and compressed the whole project and upload to live server then I can see the ID instead of the label. Something like this:
Does anyone know why? I am spending tooooo many hours to figure it out :( :( :(
My goal is to get the single ID value from the dropdown ( I can ) and save it to the database and then again show the label ( I can't ) based on the single ID value.
A common issue with that select and its in the Docs, its that you need to make sure that the value for v-model:
If options has by example only these 2:
[
{ value : 1, label : Dhaka },
{ value : 2, label : India }
]
and project_data.country is 3 the select will show the value 3 since the Vue Select searched for it and didnt find it.
So make sure in prod you have 5 in the list of countries.
I have a sample json file as below
{
book : {bookId : '<bookId>' ,
bookName : '<bookName>'
},
staff : {
sfattid : '<sfattid>',
name : '<name>'
},
libraryMember : {
libMembId : '<libMembId>',
name : '<libraryMember>'
}
}
I have a csv file with below information
I want to set the values for each variable from csv file and set the REST request 3 times during run time .
Feature: scenario outline using a dynamic table
from a csv file
Scenario Outline: staffname name: <name>
# When json payload = {book : {bookId : '<bookId>' , bookName : '<bookName>',},staff : {sfattid : '<sfattid>', name : '<name>'},libraryMember : { libMembId : '<libMembId>' ,name : '<libraryMember>'}}
When json payload = read("request.json")
Given url 'http://localhost:8089/'
And path 'returnBook'
And request payload
When method post
Then status 200
Then match karate.jsonPath(response,"$.status") == '<status>'
Examples:
| read('bookreturn.csv') |
I have wrote below code which works perfectly but in below case the same json payload is present in feature file which I want to keep in a text file .Please suggest some code .
Feature: scenario outline using a dynamic table
from a csv file
Scenario Outline: staffname name: <name>
# When json payload = {book : {bookId : '<bookId>' , bookName : '<bookName>',},staff : {sfattid : '<sfattid>', name : '<name>'},libraryMember : { libMembId : '<libMembId>' ,name : '<libraryMember>'}}
When json payload = read("request.json")
Given url 'http://localhost:8089/'
And path 'returnBook'
And request payload
When method post
Then status 200
Then match karate.jsonPath(response,"$.status") == '<status>'
Examples:
| read('bookreturn.csv') |
Sorry, you can't optimize this any further because for <name> to work it has to be within the feature file itself. Personally I think you are un-necessarily trying to over-engineer your tests. There is nothing wrong with what you have already.
If you really insist - here is the alternative, refer: https://github.com/intuit/karate#data-driven-features
* def books = read('bookreturn.csv')
* def result = call read('called.feature') books
But you will need to use 2 feature files. Each book in the loop can be used in embedded expressions. So you can read from a JSON file, and any embedded expressions in the file will work.
Just stick to what you have, seriously !
I know how to send click events with nightwatch:
browser.click('#my-control');
But I have been unable to find a way to send key events. How is this done in nightwatch?
You can try the following way to press any key in nightwatch.js; I am pressing T and it is working superb!
client.keys("t", function(done) {
client.pause(5000);
client.expect.element('#carousel_container').to.have.css('display').which.equals('block');
});
We are using the above way because nightwatch.js Keys does not have any alphabet command in its array, I have consoled and I haven't found any alphabet to press it.
Keys:
{ NULL: '',
CANCEL: '',
HELP: '',
BACK_SPACE: '',
TAB: '',
CLEAR: '',
RETURN: '',
ENTER: '',
SHIFT: '',
CONTROL: '',
ALT: '',
PAUSE: '',
ESCAPE: '',
SPACE: '',
PAGEUP: '',
PAGEDOWN: '',
END: '',
HOME: '',
LEFT_ARROW: '',
UP_ARROW: '',
RIGHT_ARROW: '',
DOWN_ARROW: '',
ARROW_LEFT: '',
ARROW_UP: '',
ARROW_RIGHT: '',
ARROW_DOWN: '',
INSERT: '',
DELETE: '',
SEMICOLON: '',
EQUALS: '',
NUMPAD0: '',
NUMPAD1: '',
NUMPAD2: '',
NUMPAD3: '',
NUMPAD4: '',
NUMPAD5: '',
NUMPAD6: '',
NUMPAD7: '',
NUMPAD8: '',
NUMPAD9: '',
MULTIPLY: '',
ADD: '',
SEPARATOR: '',
SUBTRACT: '',
DECIMAL: '',
DIVIDE: '',
F1: '',
F2: '',
F3: '',
F4: '',
F5: '',
F6: '',
F7: '',
F8: '',
F9: '',
F10: '',
F11: '',
F12: '',
COMMAND: '',
META: ''
},
You can press any key in above array easily like "client.keys(client.Keys.ENTER);".
if you entend to send a simple key stroke, you can do it directly through the following
browser.keys('j')
this will simulate the pressing on the J key
but according to http://nightwatchjs.org/api#setValue
this should also do the job
demoTest = function (browser) {
browser.setValue('input[type=text]', ['this does the job', browser.Keys.ENTER]);
};
So if you need a press a simple character, send it as string, otherwise use one of the special character in the key.json in the nightwatch package
{
"NULL" : "\uE000",
"CANCEL" : "\uE001",
"HELP" : "\uE002",
"BACK_SPACE" : "\uE003",
"TAB" : "\uE004",
"CLEAR" : "\uE005",
"RETURN" : "\uE006",
"ENTER" : "\uE007",
"SHIFT" : "\uE008",
"CONTROL" : "\uE009",
"ALT" : "\uE00A",
"PAUSE" : "\uE00B",
"ESCAPE" : "\uE00C",
"SPACE" : "\uE00D",
"PAGEUP" : "\uE00E",
"PAGEDOWN" : "\uE00F",
"END" : "\uE010",
"HOME" : "\uE011",
"LEFT_ARROW" : "\uE012",
"UP_ARROW" : "\uE013",
"RIGHT_ARROW" : "\uE014",
"DOWN_ARROW" : "\uE015",
"ARROW_LEFT" : "\uE012",
"ARROW_UP" : "\uE013",
"ARROW_RIGHT" : "\uE014",
"ARROW_DOWN" : "\uE015",
"INSERT" : "\uE016",
"DELETE" : "\uE017",
"SEMICOLON" : "\uE018",
"EQUALS" : "\uE019",
"NUMPAD0" : "\uE01A",
"NUMPAD1" : "\uE01B",
"NUMPAD2" : "\uE01C",
"NUMPAD3" : "\uE01D",
"NUMPAD4" : "\uE01E",
"NUMPAD5" : "\uE01F",
"NUMPAD6" : "\uE020",
"NUMPAD7" : "\uE021",
"NUMPAD8" : "\uE022",
"NUMPAD9" : "\uE023",
"MULTIPLY" : "\uE024",
"ADD" : "\uE025",
"SEPARATOR" : "\uE026",
"SUBTRACT" : "\uE027",
"DECIMAL" : "\uE028",
"DIVIDE" : "\uE029",
"F1" : "\uE031",
"F2" : "\uE032",
"F3" : "\uE033",
"F4" : "\uE034",
"F5" : "\uE035",
"F6" : "\uE036",
"F7" : "\uE037",
"F8" : "\uE038",
"F9" : "\uE039",
"F10" : "\uE03A",
"F11" : "\uE03B",
"F12" : "\uE03C",
"COMMAND" : "\uE03D",
"META" : "\uE03D"
}
A simple way of doing this is to use .keys() method name and then to pass the key name you want to press.
For example: The below command will press the Down arrow key.
.keys(browser.Keys.ARROW_DOWN)
I think the keys method from Selenium protocol will be the one you need:
http://nightwatchjs.org/api#keys
You should pass the controller in sendKeys funtion.
Like This.
elements: {
textBoxSearch: {
selector: '.nav-search-input'
},
.sendKeys('#textBoxSearch',client.Keys.ENTER);
My object is like
WL.AppProperty = {
AIR_ICON_16x16_PATH : "AIR_ICON_16x16_PATH",
AIR_ICON_128x128_PATH : "AIR_ICON_128x128_PATH",
DOWNLOAD_APP_LINK : "DOWNLOAD_APP_LINK",
ENVIRONMENT : "ENVIRONMENT",
APP_DISPLAY_NAME : "APP_DISPLAY_NAME",
APP_LOGIN_TYPE : "APP_LOGIN_TYPE",
APP_VERSION : "APP_VERSION",
HEIGHT : "HEIGHT",
IID : "IID",
LATEST_VERSION : "LATEST_VERSION",
LOGIN_DISPLAY_TYPE : "LOGIN_DISPLAY_TYPE",
LOGIN_REALM : "LOGIN_REALM",
MAIN_FILE_PATH : "MAIN_FILE_PATH",
SHOW_IN_TASKBAR : "SHOW_IN_TASKBAR",
THUMBNAIL_IMAGE_URL : "THUMBNAIL_IMAGE_URL",
WELCOME_PAGE_URL : "WELCOME_PAGE_URL",
WIDTH : "WIDTH",
WORKLIGHT_ROOT_URL : "WORKLIGHT_ROOT_URL",
APP_SERVICES_URL : "APP_SERVICES_URL",
WLCLIENT_TIMEOUT_IN_MILLIS : "WLCLIENT_TIMEOUT_IN_MILLIS" };
// Short alias:
WL.AppProp = WL.AppProperty;
Getting error at below line :
var reachabilityUrl =
WL.Client.getAppProperty(WL.AppProp.APP_SERVICES_URL) + "reach";
There is no such thing as WL.AppProp
There is no such property APP_SERVICES_URL available.
For available properties and correct API usage see the documentation for getAppProperty.
I tried to define a map in velocity template using the following syntax. It did not work, does anyone know how to declare a map of constant values in velocity?
#set ($mymap = {"key" : "value" , "key2" : "value"})
EDIT: I am using 1.6.3 version of velocity
It worked for me. Maybe you have very old version of Velocity?
#set ($mymap = {"key" : "value" , "key2" : "value2"})
get: ${mymap.key}
or: ${mymap.get("key")}