(CucumberJS) How to get Example data from feature file to step definition - bdd

I have a problem to read data from my feature file to step definition as below. I'm using Cucumber and cypress-cucumber-preprocessor. Could everyone figure out what I missed?
I want to read data at the step "Then Verify Business Account deposit or monthly fees table values"
My Feature
`
Feature: Sleek Test Cases
Scenario Outline: Business Account deposit or monthly fees table values verification
Given I navigate to Sleek SG
When I click on "Incorporation" link
And I click on "Open a business account" link
Then Verify Business Account deposit or monthly fees table values
Examples:
|Annual / Setup Fees |Initial Deposit |Virtual Corporate cards |Minimum Balance |Accounting |Corporate Secretary |Business Insurance |Licensed by MAS*|
|S$0 |S$1,000 |Limited |S$10,000 |No |No |Yes |Yes |
|S$35 |S$1,000 |Limited |S$5,000 |No |No |Yes |Yes |
|S$0 |S$0 |Multiple |S$0 |From S$75/month |From S$240/year |Yes |Yes |
|S$144 (S$12/month) |S$0 |Multiple |S$0 |No |No |No |No |
|S$54 |S$0 |Limited |S$0 |No |No |No |Yes |
`
Step definition:
`
Given("I navigate to Sleek SG", (url="/") => {
cy.viewport(1200, 1000)
Cypress.Cookies.debug(true)
cy.visit(url);
});
When("I click on {string} link", (string1) => {
cy.contains(string1)
.realHover()
.wait(1000)
});
And("I click on {string} link", (string2) => {
cy.contains(string2)
.click()
});
Then(/^Verify Business Account deposit or monthly fees table values$/, (rowName, data) => {
cy.log(rowName) // I couldn't get any data here
cy.log(data)
});
`
I followed https://github.com/cucumber/cucumber-js/blob/main/features/data_tables.feature but it seems doesn't work with my case.

Related

InfluxDB subquery in WHERE clause

Having some issues wrapping my brain around this one. I have two tables in InfluxDB 1.8.x, here's the relevant data layout
table a
-------------------------------------------
|time |hostname|device_cache|
|6/14/2022 9:00:30PM|device1 |dm-4 |
|6/14/2022 9:00:30PM|device2 |dm-4 |
|6/14/2022 9:00:30PM|device3 |dm-8 |
-------------------------------------------
table b
-----------------------------------------------------
|time |hostname|diskiodevice|diskiola1|
|6/14/2022 9:00:30PM|device1 |dm-0 |8 |
|6/14/2022 9:00:30PM|device1 |dm-4 |7 |
|6/14/2022 9:00:30PM|device3 |dm-3 |9 |
|6/14/2022 9:00:30PM|device2 |dm-2 |8 |
|6/14/2022 9:00:30PM|device3 |dm-8 |15 |
|6/14/2022 9:00:30PM|device2 |dm-4 |9 |
|6/14/2022 9:00:30PM|device3 |dm-3 |1 |
-----------------------------------------------------
So, what I am trying to do is get all the diskiola1 values for the diskiodevices from table b that are defined as device_cache items from table a for a particular hostname entry. Here's what I've tried:
SELECT max("diskiola1")
FROM "table b"
WHERE hostname = 'device1'
AND
time > now() - 10m
AND
"cache_device" IN
( Select distinct("device_cache") as "cache_device" FROM "table a" WHERE hostname = 'device1')
GROUP BY time(20s)
My goal is to have this as a time series in a graph to show the values of diskiola1 for a given host over a period of time for only the device_cache items. This data is given to me to work with, I really can't modify it unfortunately.
Anyone see where I'm going wrong? The error I receive is
ERR: error parsing query: found IN, expected ;
Unfortunately InfluxQL doesn't support IN operator or for the foreseeable future (see details here). InfluxQL doesn't support JOIN operation either (see details here).
Seems your "table_a" is more like a mapping table while "table_b" is storing the time series data actually. Assuming hostname is a tag while device_cache is a field for "table a"; hostname is a tag while diskiodevice and diskiola1 are fields for "table b". You could try enabling Flux and try following sample codes:
aDistinctDeviceCache = from(bucket:"yourDatabaseName/yourRentionPolicyName")
|> range(start: 2018-05-22T23:30:00Z, stop: 2018-05-23T00:00:00Z) // start and stop can be changed
|> filter(fn:(r) => r._measurement == "table a" and r.hostname == "device1" and r._field == "device_cache")
|> distinct()
bDevice1 = from(bucket:"yourDatabaseName/yourRentionPolicyName")
|> range(start: -10m)
|> filter(fn:(r) => r._measurement == "table b" and r.hostname == "device1")
|> rename(columns: {diskiodevice: "device_cache"})
maxDiskiola1ForDevice1 =
join(tables:{aPlus:aDistinctDeviceCache, bPlus:bDevice1}, on:["hostname", "device_cache"])
|> window(every: 20s)
|> max("diskiola1")
|> yield()
This will first grab distinct values from "table_a" and then rename some field of "table_b" so that we can join the two tables together in the last step.
Here are some more tips to convert your InfluxQL to Flux and convert your subqueries.

Gremlin, combine two queries and join data

I have a problem making a query for the following case:
+--------------------hasManager-------------------+
| | |
| property:isPersonalMngr=true (bool) |
| v
[ Employee ]-- hasShift -->[ Shift ]-- hasManager -->[ Manager ]
| | |
| | property:isPersonalMngr=false (bool)
| |
| property:name (text)
|
property:baseShift (bool)
For a manager 'John', who is managing shifts and can also be a personal manager of an empoyee, I want return all the employees he's managing with the list of shifts for each employee. Each empoyee has a 'baseShift' (say: 'night' / 'day') and a scheduled shift ('wed123')
Eg:
[ 'Employee1', [ 'night', 'wed123', 'sat123' ]]
[ 'Employee2', [ 'day', 'mon123', 'tue123' ]]
For the shift employees I have this:
g.V('John').in('hasManager').in('hasShift').hasLabel('Employee')
For the personal managed I have this:
g.V('John').in('hasManager').hasLabel('Employee')
How do I combine these two AND add the name property of the shift in a list?
Thanks.
To test this, I created the following graph. Hope this fits your data model from above:
g.addV('Manager').property(id,'John').as('john').
addV('Manager').property(id,'Terry').as('terry').
addV('Manager').property(id,'Sally').as('sally').
addV('Employee').property(id,'Tom').as('tom').
addV('Employee').property(id,'Tim').as('tim').
addV('Employee').property(id,'Lisa').as('lisa').
addV('Employee').property(id,'Sue').as('sue').
addV('Employee').property(id,'Chris').as('chris').
addV('Employee').property(id,'Bob').as('bob').
addV('Shift').property('name','mon123').as('mon123').
addV('Shift').property('name','tues123').as('tues123').
addV('Shift').property('name','sat123').as('sat123').
addV('Shift').property('name','wed123').as('wed123').
addE('hasManager').from('tom').to('john').property('isPersonalMngr',true).
addE('hasManager').from('tim').to('john').property('isPersonalMngr',true).
addE('hasManager').from('lisa').to('terry').property('isPersonalMngr',true).
addE('hasManager').from('sue').to('terry').property('isPersonalMngr',true).
addE('hasManager').from('chris').to('sally').property('isPersonalMngr',true).
addE('hasManager').from('bob').to('sally').property('isPersonalMngr',true).
addE('hasShift').from('tom').to('mon123').property('baseShift','day').
addE('hasShift').from('tim').to('tues123').property('baseShift','night').
addE('hasShift').from('lisa').to('wed123').property('baseShift','night').
addE('hasShift').from('sue').to('sat123').property('baseShift','night').
addE('hasShift').from('chris').to('wed123').property('baseShift','day').
addE('hasShift').from('bob').to('sat123').property('baseShift','day').
addE('hasShift').from('bob').to('mon123').property('baseShift','day').
addE('hasShift').from('tim').to('wed123').property('baseShift','day').
addE('hasManager').from('mon123').to('terry').property('isPersonalMngr',false).
addE('hasManager').from('tues123').to('sally').property('isPersonalMngr',false).
addE('hasManager').from('wed123').to('john').property('isPersonalMngr',false).
addE('hasManager').from('sat123').to('terry').property('isPersonalMngr',false)
From this, the follow query generates an output in the format that you're looking for:
gremlin> g.V('John').
union(
inE('hasManager').has('isPersonalMngr',true).outV(),
inE('hasManager').has('isPersonalMngr',false).outV().in('hasShift')).
dedup().
map(union(id(),out('hasShift').values('name').fold()).fold())
==>[Tom,[mon123]]
==>[Tim,[tues123,wed123]]
==>[Lisa,[wed123]]
==>[Chris,[wed123]]
A note on your data model - you could likely simplify things by having two different types of edges for hasManager and that would remove the need for a boolean property on those edges. Instead, you could have hasOrgManager and hasShiftManager edges and that would remove the need for the property checks when traversing those edges.

Add categories in MDS plot

I) PROBLEM
Let’s say I have a matrix like this with distances (in kilometers) between the homes of different people.
| | Person 1 | Person 2 | Person 3 |
|----------|----------|----------|----------|
| Person 1 | | | |
| Person 2 | 24 | | |
| Person 3 | 17 | 153 | |
And I have a data table like this:
| Person | Party |
|----------|----------|
| Person 1 | Party A |
| Person 2 | Party B |
| Person 3 | Party C |
I want to do multidimensional scaling (dissimilarity by distance) to visualize i) how close each person lives to another; ii) which party each person votes for (different colors for each party)
II) CURRENT RESULT
My current plot of MDS (made with SPSS) is like this (I don’t use a code line, but a menu commands in SPSS).
:
III) EXPECTED RESULT
I want to add a different color for each person depending on which party this person votes for:
IV) QUESTION(S)
Can I do it in SPSS? How to add the data about votes in the matrix and how to show it in MDS plot?
EDIT
There is quite the same problem and solution for R.
R) Create double-labeled MDS plot
But I want to do it in SPSS.
I don't believe it's possible to create a plot like the one you show directly from either of the MDS procedures currently available in SPSS Statistics, PROXSCAL or ALSCAL. I think what you'd need to do would be to save the common space coordinates to a new dataset or file, then add the Party variable to that new dataset or file, define it as Nominal in the measurement level designation in the Data Editor, and then use the Grouped Scatter option under Scatter/Dot in the chart Gallery in the Chart Builder, defining groups by the Party variable.
The PROXSCAL procedure lets you save things from the dialogs in the Output sub-dialog. The ALSCAL procedure only supports saving out of common space coordinates and other things using command syntax, specifically using the OUTFILE subcommand (you can paste the command from the dialogs, then add this subcommand).

How to integrate a News-feed indicator for an MT4 StrategyTester backtesting?

I need a news indicator that shows me news starts from 2016, and the impact(big, medium, small), the outcome (positive, negative news). Are they such indicators available?
I am aware of FFCal and FFC (https://www.mql5.com/en/code/15931), but seems that they only provide a limited period of times?
For backtesting you may need a specific thread on ForexFactory where its author updates the news events from 2007 with their impact, datetime, name and currencies. then you will need to write a tool that reads such csv file and acts if necessary. i havent seen it written
These are two VERY distinct things:(a) Fundamental Data ( a source per-se ) (b) BackTesting integration into MT4
ForexFactory provides tabular access to (a), with some depth of the history, altogether with somewhat human-oriented navigation in html-tables for web browsing.
This does NOT mean, the same is machine-ready for integration into MetaTrader 4 Terminal tools, alike the Strategy Tester. Even the FFCal ( AFAIK ) is just a text-presentation of a copy of ForexFactory actual day textual values, not integrated into the Expert Advisor logic and does NOT provide means for "accelerated" run under Strategy Tester simulated flow of time.
This said, the solution requirement (b) dictates the approach to (a), right due to the fact, that successful Strategy Tester integration wins the both (a) and (b).
A working solution: MT4 with a proxy FundamentalNewsPROCESSOR
Example output from external FundamentalNewsPROCESSOR:
...
2016-12-27 4:30am high GBP Current Account Good?Bad for GBP
2016-11-03 5:00am high GBP EU Membership Court Ruling Good?Bad for GBP
2016-06-23 All Day high GBP EU Membership Vote Leave Good?Bad for GBP
2010-03-30 3:30am high GBP Final GDP q/q better 0.4% 0.3% Good?Bad for GBP 0.3%
2010-07-12 3:30am high GBP Final GDP q/q 0.3% 0.3% Good?Bad for GBP 0.3%
2016-06-30 3:30am high GBP Final GDP q/q 0.4% 0.4% Good?Bad for GBP 0.4%
2007-02-09 4:30am high GBP Goods Trade Balance -7.1B -7.0B Good?Bad for GBP -6.9B better -7.2B
2007-03-13 4:30am high GBP Goods Trade Balance better -6.2B -7.0B Good?Bad for GBP -7.0B -7.1B
2007-04-12 3:30am high GBP Goods Trade Balance worse -6.8B -6.4B Good?Bad for GBP -6.4B worse -6.2B
...
(-------------------------|--------|----------|------|-------|--------|-------|-------|-------|-------------|---------------)
(aTitleNAME | EVENTid| TIME | CCY | IMPACT| OPINION| ACTUAL| FCAST | PREV, | PREV_OPINION| PREV_REV_FROM )
(-------------------------|--------|----------|------|-------|--------|-------|-------|-------|-------------|---------------)
('Prelim GDP q/q', '61643', '7:30am', 'USD', 'high', '', '1.1%', '1.1%', '1.2%', '', '' )
('Fed Chair Yellen Speaks', '64178', '9:00am', 'USD', 'high', '', '', '', '', '', '' )
('Jackson Hole Symposium', '63417', 'All Day', 'ALL', 'high', '', '', '', '', '', '' )
works both in real-time & accelerated real-time, under StrategyTester simulation and all items are fully code-usable.
Hanover (in forexfactory) has it, but is no longer updates it. It is from 2007 to 02June2017. This is the link: https://www.forexfactory.com/attachment.php/2339122?attachmentid=2339122&d=1496558933

How to build a table where each cell is built using the 2 dimensions

Desired output
Each User has child Plan which has child PlanDate objects. PlanDate has an attribute ddate which is just a date. Plan has an attribute mtype that can either be M, V, or C (haha MVC, subconscious techy much?). For a given week (let's just say the current week), I'd like to print out a table that looks like this:
----------------------------------------------------------------------------
| User | Mon | Tue | Wed | Thu | Fri | Other attributes of User
----------------------------------------------------------------------------
| Eric | M | | M | | M | ...
----------------------------------------------------------------------------
| Erin | V | V | V | V | V | ...
----------------------------------------------------------------------------
| Jace | | C | C | | | ...
----------------------------------------------------------------------------
| Kris | C | | | | | ...
----------------------------------------------------------------------------
| Tina | V | | V | | V | ...
----------------------------------------------------------------------------
| Lily | M | M | M | M | M | ...
----------------------------------------------------------------------------
The order of the Users on the rows doesn't really matter to me; I may add Ransack gem to make it ordered, but for now ignore. A given User may not have PlanDates with a ddate for every day in a given week, and certainly there's no relationship between the PlanDates across Users.
Proposed options
I feel like there are two options:
In the view, print the column headers with a data-attribute of the day in question, and print the row headers with a data-attribute of the user id in question (will have to first select all the users who do have a grandchild PlanDate with a ddate somewhere in the current week). Then in the intersection, use the two data-attributes to query ActiveRecord.
In the model, generate a data hash that can create the table, and then pass that hash to the view via the controller.
Option 1 makes more intuitive sense to me having been a lifelong Excel user, but it breaks MVC entirely, so I'm trying to go with Option 2, and the challenges below are related to Option 2. That said if you can make a case for Option 1 go for it! I feel like if you can convince me to do Option 1, I can implement it without the same problems...
Challenges with Option 2
I can build a hash with one dimension as a key, and a hash of the other dimension as an array. For example, if the days of the current week were used as the key:
{
Mon => [Eric, Erin, Kris, Tina, Lily],
Tue => [Erin, Jace, Lily]
Wed => [Eric, Erin, Jace, Kris, Lily],
Thu => [Erin, Lily],
Fri => [Eric, Erin, Tina, Lily]
}
But the problem is once I get there, I'm not sure how to deal with the fact that there are blanks in the data... If I were to convert the hash above into a table, I would only know how to make the Users appear as a list under each date; but then that wouldn't look like my desired output at all, because there wouldn't be gaps in the data. For example on Monday, there's no Jace, but there needs to be a blank space for Jace so that it's easy for the Viewer to look across and see, ah there's no Jace on Monday, but there is a Jace on Tuesday and Wednesday.
Oh actually I just needed a minute to think logically about this... I just need a nested hash, one with the first dimension, one with the second. So a method like this:
def plan_table
# 1 : get an array of the current week's dates
week = (Date.today.at_beginning_of_week..(Date.today.at_end_of_week-2.days)).map { |d| d }
# 2 : find all the users (plucking the id) that have a plan date in the current week
current_week_users = User.select { |u| u.plans.select { |p| p.plan_dates.select { |pd| week.include? pd.ddate.to_date }.count > 0 }.count > 0 }.map(&:id)
# 3: build the hash
#week_table = Hash.new
week.each do |day|
#week_table[day] = {}
current_week_users.each do |user_id|
# for each user in the has we built already, we have to check if that user has a pd that: 1) falls on this date, 2) has a non canceled plan, 3) has a user that matches this current user. The extra checks for user_id and plan_id are my ole' paranoia about objects being created without parents
potential_pd = PlanDate.select { |pd| pd.ddate.to_date == day && pd.plan_id != nil && pd.plan.status != "canceled" && pd.plan.user_id != nil && pd.plan.user.id == user_id }
if potential_pd == []
#week_table[day][user_id] = ""
else
#week_table[day][user_id] = potential_pd.first.plan.mtype
end
end
end
return #week_table
end

Resources