Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UiTests target + sample tests #743

Merged
merged 9 commits into from
Oct 19, 2020
Merged

UiTests target + sample tests #743

merged 9 commits into from
Oct 19, 2020

Conversation

reflash
Copy link
Collaborator

@reflash reflash commented Oct 14, 2020

closes #153

fake build target runuitests
All the details for installation are mentioned in README now.
Unfortunately stopping of client/server is a bit quirky, but I think that can be solved as a separate task

README.md Outdated Show resolved Hide resolved
build.fsx Outdated Show resolved Hide resolved
build.fsx Show resolved Hide resolved
build.fsx Outdated Show resolved Hide resolved
build.fsx Outdated Show resolved Hide resolved
tests/Client.UiTests/Runner.fs Outdated Show resolved Hide resolved
tests/Client.UiTests/Runner.fs Outdated Show resolved Hide resolved
tests/Client.UiTests/Tests.fs Outdated Show resolved Hide resolved
@reflash reflash requested a review from psfinaki October 15, 2020 17:23
README.md Outdated Show resolved Hide resolved
build.fsx Show resolved Hide resolved
build.fsx Show resolved Hide resolved
build.fsx Show resolved Hide resolved
build.fsx Outdated Show resolved Hide resolved
build.fsx Outdated Show resolved Hide resolved
build.fsx Outdated Show resolved Hide resolved

open canopy.classic
open canopy.types
open Expecto
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious about Expecto, but honestly I think it would be confusing to have different testing frameworks in one project, so let's switch to xUnit for now :) Looks like definitely possible, e.g. here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this link is quite old, I've tried to match it with current api, but it seems I won't be able to run it the same way

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sooooo... this seems to work (instead of both Runner and Tests):

module Client.UiTests.Tests

open canopy.classic
open canopy.types
open System
open Xunit

type Fixture() =
    do
        //start Chrome // Use this if you want to see your tests in the browser
        start ChromeHeadless
        resize (1280, 960)

let serverUrl = Environment.GetEnvironmentVariable("SERVER_URL")

let startApp() =
    url serverUrl
    waitForElement("#elmish-app")

type Tests() = 
    interface IClassFixture<Fixture>        

    [<Fact>]
    member _.``Soundcheck - server is online``() =
        startApp()
        
    [<Fact>]
    member _.``Validate word is loaded``() =
        startApp()
        
        click (first ".link-block")
        
        let taskText = (element ".task-label").GetAttribute("innerText")
        
        Assert.NotNull taskText

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this Fixture make it run only once? I'll modify the code then or do you have a working config already?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixture code runs only once prior to running all tests.

tests/Client.UiTests/Tests.fs Show resolved Hide resolved
tests/Client.UiTests/Tests.fs Outdated Show resolved Hide resolved
@reflash reflash merged commit a5dd95a into master Oct 19, 2020
@psfinaki psfinaki deleted the improvement-153 branch November 3, 2020 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add UI testing
2 participants