Esempio n. 1
0
        public async Task SignUp_SessionCrated()
        {
            // Arrange
            await Task.Delay(TimeSpan.FromSeconds(5));

            using IdentityApp app = _testContext.CreateApp <IdentityApp>();
            await app.TestContext.StartMagnetAsync();

            string mobileNr = "+41798074288";
            string email    = $"{Guid.NewGuid().ToString("N").Substring(0, 6)}@magic-media.io";

            // Act
            SignUpPage page = app.Open <SignUpPage>($"{app.TestContext.HostUrl}SignUp");

            page.SignUp(email, mobileNr);

            ValidateMobilePage validatePage = app.WaitForPage <ValidateMobilePage>();

            SmsMessage sms = await app.TestContext.MagnetSession.WaitForSms(mobileNr);

            var code = ParseSecurityCode(sms.Body);

            validatePage.EnterCode(code);

            SignUpCompletedPage completed = app.WaitForPage <SignUpCompletedPage>();

            // Assert
            completed.SuccessAlert.Text.Should().Be("Registration completed");

            SignUpSession session = await GetSessionAsync(email);

            session.State.Should().Be("Completed");
        }
Esempio n. 2
0
        public async Task Login_Diagnostics_SubjectValidated()
        {
            // Arrange
            await Task.Delay(TimeSpan.FromSeconds(5));

            using IdentityApp app = _testContext.CreateApp <IdentityApp>();

            // Act
            LoginPage page = app.Open <LoginPage>($"{app.TestContext.HostUrl}Diagnostics");

            page.Login("alice", "alice");

            DiagnosticsPage diag = app.WaitForPage <DiagnosticsPage>();

            var subject = diag.SubjectClaimValue.Text;

            // Assert
            subject.Should().Be("818727");
            OpenQA.Selenium.Screenshot ss = app.Driver.TakeScreenshot();
            ss.SaveAsFile(@$ "c:\temp\magic-media.png");
        }