Adding testdouble to vendor bundle seems wrong - aurelia

In order for me to be able to run unit test that use testdouble I had to add it aurelia.json/vendor-bundle
I don't want test double in my released application I just needed for testing.
Is there a better way to configure this?

Looks like there is a env variable that you can set to avoid this happening, did not found any docs about it unfortunately.
My entry in aurelia.json looks like this now:
{
"name": "testdouble",
"path": "../node_modules/testdouble/dist/testdouble",
"env": "dev"
},

Related

Recommended dynamic runtime configuration technique on nuxtjs (other than dotenv)

I have been trying to use publicRuntimeConfig / privateRuntimeConfig
On nuxt 2.4.1, I have defined my runtime config as follows on nuxt.config.js
publicRuntimeConfig: {
DATA_API_HOST_URL: process.env.VUE_APP_DATA_API_HOST_URL,
},
privateRuntimeConfig: {
AUTH_APP_CLIENT_SECRET: process.env.VUE_APP_AUTH_APP_CLIENT_SECRET,
},
and calling it as follows on my login.vue
asyncData( ctx ) {
console.log(ctx.$config.DATA_API_HOST_URL)
//some activity
}
The keys are showing up on $config inside asyncData. I debugged on chrome dev tools. But value is not read from process.env.VUE_APP_DATA_API_HOST_URL. The value is showing up as undefined. However, process.env.VUE_APP_DATA_API_HOST_URL is showing the value OK. The whole point is to move away from process.env.
this.$config.DATA_API_HOST_URL also does not access the values.
'${DATA_API_HOST_URL}' is shown in examples but I believe it is only for explicit param declarations at asyncData like asyncData( { $config : {DATA_API_HOST_URL}).
When I pass values as it is using DATA_API_HOST_URL: process.env.VUE_APP_DATA_API_HOST_URL || 'https://test.api.com', it seems to copy the value fine using ctx.$config.DATA_API_HOST_URL!
Looking to me like copying process.env to *RuntimeConfig has a problem!
What is the recommended way of importing and using runtime configurations?
As per documentation in the Nuxt blog post you marked, the feature your are trying to use is released in 2.13 (you´re using 2.4 if i not misunderstood). That could be the reason behind the behaviour you're seeing.
I'd recommend update your project dependencies or trying another approach.
I think you should use Docker to set dynamic runtime config like link below:
https://dev.to/frontendfoxes/dockerise-your-nuxt-ssr-app-like-a-boss-a-true-vue-vixens-story-4mm6

How to use conditional statements with verifyElementPresent

I would like to use verifyElementPresent to skip a chunk of code in my Selenium test script. I used something like this successfully in the older Firefox extension, but I can't figure out how to make it work in the Chrome Kantu version.
I have tried both ${!statusOK}==true and ${!lastCommandOK}==true and I have found them to both be finicky. I can't get a consistent test case with either one and I'm not sure why. I used storeElementPresent in the FireFox browser extension and it worked consistently, but that command isn't available in Kantu.
The below link outlines the EXACT scenario I'm trying to use verifyElementPresent for, but it isn't working for me. Does anyone know of another way to do this?
https://a9t9.com/kantu/docs/selenium-ide/assertelementpresent-verifyelementpresent
{
"Command": "verifyElementPresent",
"Target": "//table[#id='phHeader']/tbody/tr/td[3]/div/div/div/span[2]",
"Value": ""
},
{
"Command": "gotoIf",
"Target": "${!statusOK} == true",
"Value": "logOut"
},
{
"Command": "gotoIf",
"Target": "${!statusOK} == false",
"Value": "logIn"
},
I expect that when the element is present, it will go to the "logOut" label of the code.
Please see image of my Kantu player to see exactly where it malfunctions: https://imgur.com/ckzp1Aa
Thank you!
I wanted to do the same thing as the described problem. I found a solution for Selenium IDE, but it doesn't use the verify element present command. As there is no other solution to this problem I will post a way i found to help.
Instead of verify element present command, you should use the following:
Command: store xpath count
Target: <locator of object to find>, example: xpath=\\a[id='logout']
Value: number
So the whole code for checking if a element is present looks like:
Command: store xpath count
Target: <locator of object to find>
Value: number
Command: if, Target: ${number} == 1
Command: click, Target: <locator>
... Any commands you want to execute
Command: end
Rest of code outside of if
Where <locator> can be xpath, css selector.
Example: xpath=\\a[id='logout']
Tested on latest version 3.17.0 on Firefox Selenium IDE.
The only solution I can find is to manually set !statusOK to true before each verify statement. It looks like it was getting stuck on a previous fail. This would explain why it seemed to behave so differently each run. I hope my struggle and eventual explanation is helpful to someone else! I'm still looking for tips on how to get these scripts to work better, so let me know if you have any good tricks!
https://a9t9.com/kantu/docs#!statusOK
!statusOK (read/write) - contains the status of the macro execution. Once an error happens !statusOK is set to FALSE. Use with !ErrorIgnore set to true so the macro execution continues after an error. Only then !statusOK will be useful. Otherwise the macro stops at an error anyway. !statusOK is similar to !LastCommandOK but it does not get reset by a successful command. Once !statusOK is set to "false" by an error, it remains "false", even if the next commands succeed. But you can use store | true | !StatusOK to manually reset it.

Trying to automatically populate our manual test plans into every build/iteration in TFS?

Is it possible to automatically clone and populate a new test plan (that is the same as the current one) for each new iteration and build in TFS? Our Test Plans are built, but we don't know how to have a new one to properly track what testing did or did not get done with each build and iteration.
You could use TFS REST API to create test plans by specifying the "name", "area", and "iteration":
POST https://{accountName}.visualstudio.com/{project}/_apis/test/plans?api-version=5.0-preview.2
{
"name": "ANewPlan",
"area": {
"name": "Fabrikam-Fiber-TFVC\\Quality assurance"
},
"iteration": "Fabrikam-Fiber-TFVC\\Release 1"
}

RavenDb UniqueConstraint doesn't work

I'm using RavenDb Server and Client 3.5.0 and I have tried to get UniqueConstraint work without success.
The simple case:
using Raven.Client.UniqueConstraints;
public class User {
public string Id { get; set; }
[UniqueConstraint]
public string Email { get; set; }
}
The documentation says:
Drop the Raven.Bundles.UniqueContraints assembly in the Plugins
directory.
I did it by NuGet: Install-Package RavenDB.Bundles.UniqueConstraints -Version 3.5.0
and then paste the binary Raven.Bundles.UniqueConstraints.dll to folder Plugins that I created myself in Raven's root directory.
After save an User document I get this in Metadata:
"Ensure-Unique-Constraints": [
{
"Name": "Email",
"CaseInsensitive": false
}
]
All seems to work, but I still saving documents with the same email.
UniqueConstraintCheckResult<User> checkResult = session.CheckForUniqueConstraints(user);
// returns whether its constraints are available
if (checkResult.ConstraintsAreFree())
{
session.Store(user);
session.SaveChanges();
}
I check this link RavenDB UniqueConstraint doesn't seem to work and this one https://groups.google.com/forum/#!searchin/ravendb/unique|sort:relevance/ravendb/KzO-eIf9vV0/NJyJ4DNniFUJ and many other that people have the same problem without solution. In some cases they said that are checking if the property already exist in database manualy as solution.
The documentation also says:
To activate unique constraints server-wide, simply add Unique
Constraints to Raven/ActiveBundles configuration in the global
configuration file, or setup a new database with the unique
constraints bundle turned on using API or the Studio
but with no clue how to do that. I did some search and find a possible how:
In Studio, select database, go to Settings -> Database settings, and I found this config:
{
"Id": "TestRaven",
"Settings": {
"Raven/DataDir": "~\\TestRaven"
},
"SecuredSettings": {},
"Disabled": false
}
and I tried add this config:
"Settings": {
"Raven/DataDir": "~\\TestRaven",
"Raven/ActiveBundles": "UniqueConstraints"
}
Then I get an error when trying save it. The message erros says something like "the database is already created and cant modify or add bundles" and make a sugestion to add this line "Raven-Temp-Allow-Bundles-Change": true and I was able to save de settings with UniqueConstraint bundle configuration.
So far I think I did all requirement that documentation describe. The last one is:
Any bundle which is not added to ActiveBundles list, will not be
active, even if the relevant assembly is in the Plugins directory.
The only place that I found a bundle list is creating a new database in Studio, but the list is not editable, just an information about what already has enabled.
The documentation says a lot of requirements but just dont tell us how to do it, super smart, and we have to try gess how. I could get to here so far, but gess what? It still not working!
My question is, UniqueConstraints realy work in RavenDb? Have someone get this working?
If yes, cloud please tell me how?
Thank you in advance!
[Edited]
I forgot to mention that I added the follow line:
store.Listeners.RegisterListener(new UniqueConstraintsStoreListener());
And also tried with version 3.5.1.
The issue is that the specified name of the bundle is incorrect so it won't be active on the server side. Please use "Unique Constraints" instead of "UniqueConstraints" in "Raven/ActiveBundles" settings option.

Passing variable to pause command in Selenium IDE

How can I pass variable to pause command and use this variable with pause command in other parts of test suite in Selenium IDE? I want to define time variable at the begining of test suite and use that time variable in other parts of test suite like following.
pause $variable
Init variable via "store" command. Attention: Value = variablename
Read variable via ${variablename}
Example:
This question is a bit old now but here goes anyway.
I find I have to store as variable
{
"id": "bbbb21d6-4fab-42df-bdd9-896e94bd4d59",
"comment": "",
"command": "executeScript",
"target": "return (${i} * 100)",
"targets": [],
"value": "pausems"
},
Then when to use in the pause command, don't use the ${VariableName} syntax, but instead reference the variable as follows; 'vars.VariableName'
{
"id": "b65554de-c1f2-494d-bad0-935247b6febc",
"comment": "",
"command": "pause",
"target": "vars.pausems",
"targets": [],
"value": ""
},
Your question centers more around method parameters, scope, and access within your program which are not Selenium specific. That being said, you should go look at some tutorials on Java, here.
With regards to creating a Pause class, you will want to look at the Robot class, here.
But, be warned, using Robot to accommodate delays in the web page loading is a hack at best and prone to failure. I suggest you investigate implicit waits and using Robot only as a buffer or a last resort.
Waits are explained here.