Closed teknikal-wizard closed 2 years ago
@isaacabraham
I get this:
../app/Build.fsproj(10,3): error MSB4019: The imported project "../app/.paket/Paket.Restore.targets" was not found.
Confirm that the expression in the Import declaration ".paket/Paket.Restore.targets" is correct,
and that the file exists on disk.
If you can just give me a snippet of the line that is failing and then a snippet of the html for the control you are trying to test that would probably work.
Displayed/Not displayed checks the display tag and the opacity. Your code may be visually disabling the control in a different way and you may have to write your own custom validator for that.
@Ryan-Palmer-CIT you'd be better off making a repository and committing to there rather than a zip TBH.
../app/Build.fsproj(10,3): error MSB4019: The imported project "../app/.paket/Paket.Restore.targets" was not found.
You might need to run dotnet tool restore
first.
The control is just disabled in a normal way, you can see in the sample. I might have time to come back to this later but all the info is there.
@Ryan-Palmer-CIT The issue is that in your html your button isnt a button its an <a>
tag. I edited it to be an <input>
and it worked.
If you want to keep it as an <a>
you need to create your own definition for disabled (and probably enabled)
I used this and it worked on your code using <a>
let isDisabled (element: OpenQA.Selenium.IWebElement) =
if element.TagName = "input" then
element.Enabled = false
else
let isDisabled' = element.GetAttribute("disabled")
if isDisabled' = null then false else true
let disabled item =
try
canopy.wait.wait canopy.configuration.compareTimeout (fun _ ->
match box item with
| :? OpenQA.Selenium.IWebElement as element -> isDisabled element
| :? string as cssSelector -> element cssSelector |> isDisabled
| _ -> raise (canopy.types.CanopyNotStringOrElementException(sprintf "Can't check disabled on %O because it is not a string or webelement" item)))
with
| :? canopy.types.CanopyElementNotFoundException as ex -> raise (canopy.types.CanopyDisabledFailedException(sprintf "%s%sdisabled check for %O failed." ex.Message System.Environment.NewLine item))
| :? OpenQA.Selenium.WebDriverTimeoutException -> raise (canopy.types.CanopyDisabledFailedException(sprintf "disabled check for %O failed." item))
Edit:
I updated the UI code to be a button instead of an <a>
and that also fixed the test and is probably the 'most correct' solution
Bulma.button.button [
color.isPrimary
prop.id "addButton"
Amazing! Thank you so much :)
Hi there,
I'm just updating some of our SAFE stack course modules, and I am finding some issues with canopy.
I have a button that is enabled when a text box has content, and disabled when it is empty.
I tried to write a simple test for this and it wasn't working.
I found that
enabled
/disabled
assertions were failing as the button is reported asnotDisplayed
when disabled, causing a timeout.onChanged
event so the button remains active, however adding text does trigger it)I have attached a sample showing these cases.
Use
dotnet run
in the root for the main app app.zip