Exemplo n.º 1
0
        public static void Run(AbsoluteDirectoryPath root, FuseRunner fuseRunner)
        {
            var projectDir = root / "GeneratedTestData" / "SystemTest1";
            var project    = projectDir / new FileName("SystemTest1.unoproj");
            var mainView   = projectDir / new FileName("MainView.ux");
            var dataDir    = projectDir / "build" / "Local" / "Designer" / "fs_data";
            var timeout    = TimeSpan.FromMinutes(3);

            Console.WriteLine("Setting up project");
            IOHelpers.DeleteAndCopyDirectory(root / "Projects" / "SystemTest1", projectDir);

            try
            {
                Console.WriteLine("Starting preview");
                fuseRunner.Preview(project, Optional.None());
                IOHelpers.WaitForFileToExist(dataDir / new FileName("output1"), timeout);
                Console.WriteLine("Replacing text");
                IOHelpers.ReplaceTextInFile(mainView, "output1", "output2");
                IOHelpers.WaitForFileToExist(dataDir / new FileName("output2"), timeout);
            }
            catch (Exception e)
            {
                throw new TestFailure(e.Message);
            }
            finally
            {
                ScreenCapture.Shoot("PreviewTestBeforeKill.png");
                fuseRunner.KillOrThrow();
            }
        }
Exemplo n.º 2
0
        public static void Run(AbsoluteDirectoryPath root, FuseRunner fuseRunner)
        {
            var projectDir = root / "GeneratedTestData" / "AutomaticTestApp" / "App";
            var project    = projectDir / new FileName("App.unoproj");
            var timeout    = TimeSpan.FromMinutes(3);

            Console.WriteLine("Setting up project");
            IOHelpers.DeleteAndCopyDirectory(root / "Stuff" / "AutomatictestApp" / "App", projectDir);

            var testAppError = false;

            try
            {
                var wait = new ManualResetEvent(false);

                Console.WriteLine("Starting preview");
                fuseRunner.Preview(project, Optional.Some <Action <string> >(
                                       s =>
                {
                    if (s.Contains("TEST_APP_MSG:OK"))
                    {
                        wait.Set();
                    }
                    if (s.Contains("TEST_APP_MSG:ERROR"))
                    {
                        testAppError = true;
                        wait.Set();
                    }
                }));
                if (!wait.WaitOne(timeout))
                {
                    throw new TestFailure("Test timed out after " + timeout);
                }
                if (testAppError)
                {
                    throw new TestFailure("Test app failed");
                }
            }
            catch (Exception e)
            {
                throw new TestFailure(e.Message);
            }
            finally
            {
                ScreenCapture.Shoot("AutomaticTestApp-before-kill.png");
                fuseRunner.KillOrThrow();
            }
        }
Exemplo n.º 3
0
        public static void Run(AbsoluteDirectoryPath root, FuseRunner fuseRunner)
        {
            var shell   = new Shell();
            var testDir = root / "GeneratedTestData" / "FuseCreate";
            var appDir  = testDir / "appname";

            shell.DeleteIfExistsAndCreateDirectory(testDir);
            using (TestHelpers.ChangeWorkingDirectory(testDir))
            {
                fuseRunner.Run("create app appname", Optional.None())
                .WaitOrThrow(TimeSpan.FromSeconds(10))
                .AssertExitCode(0);
                IOHelpers.AssertExists(shell, appDir / new FileName("MainView.ux"));
                IOHelpers.AssertExists(shell, appDir / new FileName("appname.unoproj"));
            }
        }
Exemplo n.º 4
0
        public static void Run(AbsoluteDirectoryPath root, FuseRunner fuseRunner)
        {
            var shell      = new Shell();
            var projectDir = root / "GeneratedTestData" / "FuseBuild";
            var project    = projectDir / new FileName("SystemTest1.unoproj");

            Console.WriteLine("Setting up project");
            IOHelpers.DeleteAndCopyDirectory(root / "Projects" / "SystemTest1", projectDir);


            Console.WriteLine("Starting build");
            fuseRunner.Run("build " + project.NativePath, Optional.None())
            .WaitOrThrow(TimeSpan.FromMinutes(3))
            .AssertExitCode(0);
            IOHelpers.AssertExists(shell, projectDir / "build");
        }
Exemplo n.º 5
0
        public static void Run(AbsoluteDirectoryPath root, FuseRunner fuseRunner)
        {
            var shell      = new Shell();
            var projectDir = root / "GeneratedTestData" / "FuseImport";

            Console.WriteLine("Setting up project");
            IOHelpers.DeleteAndCopyDirectory(root / "Projects" / "SketchImportApp", projectDir);

            Console.WriteLine("Starting import");
            using (TestHelpers.ChangeWorkingDirectory(projectDir))
            {
                fuseRunner.Run("import Foo.sketch", Optional.None())
                .WaitOrThrow(TimeSpan.FromMinutes(1))
                .AssertExitCode(0);
                IOHelpers.AssertExists(shell, projectDir / "SketchSymbols" / new FileName("Sketch.Fuse.ux"));
            }
        }