Skip to content

Conversation

@benday
Copy link
Contributor

@benday benday commented Jan 11, 2020

Summary of the changes (Less than 80 chars)

  • Modified angular template code for api-authorization to fix defects in specs
  • Imported RouterTestingModule to login, logout, and login-menu component specs
  • Modified login.componet.spec.ts to use spys to mock logic in AuthorizeService during testing

Addresses #18121

@ghost ghost added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jan 11, 2020
@dnfclas
Copy link

dnfclas commented Jan 11, 2020

CLA assistant check
All CLA requirements met.

@benday benday changed the base branch from master to 3.0 January 13, 2020 18:46
@mkArtakMSFT
Copy link
Contributor

Thanks for your PR, @benday. Please target master branch as this resulted in too many commits and file changes showing up, making the PR unreadable.

@mkArtakMSFT mkArtakMSFT added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Jan 22, 2020
@benday benday changed the base branch from 3.0 to master January 23, 2020 19:44
@benday
Copy link
Contributor Author

benday commented Feb 10, 2020

@mkArtakMSFT -- FYI, I changed the target branch from 3.0 to master. Hopefully this should keep the changes more readable.

@mkArtakMSFT mkArtakMSFT requested review from javiercn and ryanbrandenburg and removed request for javiercn February 11, 2020 06:18
@mkArtakMSFT mkArtakMSFT removed the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Feb 11, 2020
Copy link
Contributor

@ryanbrandenburg ryanbrandenburg left a comment

Choose a reason for hiding this comment

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

Unfortunately this doesn't seem to fix all the tests when merged with the master branch.

benday added 2 commits August 3, 2020 10:31
Update login-menu.component.spec.ts to remove trailing space
Copy link
Contributor Author

@benday benday left a comment

Choose a reason for hiding this comment

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

Removed trailing spaces per PR comments

@ryanbrandenburg
Copy link
Contributor

I'm still seeing failures such as:

Chrome 84.0.4147.105 (Windows 10) LoginMenuComponent should create FAILED
            <li class="nav-item">
                <a  class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/profile"]' title="Manage">Hello {{ userName | async }}</a>
            </li>
            <li class="nav-item">
                <a  class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/logout"]' [state]='{ local: true }' title="Logout">Logout</a>
                <a  class="nav-link text-dark" [routerLink]='["/authentication/logout"]' [ERROR ->][state]='{ local: true }' title="Logout">Logout</a>
            </li>
        </ul>
        Can't bind to 'routerLink' since it isn't a known property of 'a'. ("*ngIf="isAuthenticated | async">
            <li class="nav-item">
                <a  class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/profile"]' title="Manage">Hello {{ userName | async }}</a>
            </li>"): ng:///DynamicTestModule/LoginMenuComponent.html@2:39
        Can't bind to 'routerLink' since it isn't a known property of 'a'. ("
            </li>
            <li class="nav-item">
                <a  class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/logout"]' [state]='{ local: true }' title="Logout">Logout</a>
            </"): ng:///DynamicTestModule/LoginMenuComponent.html@5:39
        Can't bind to 'state' since it isn't a known property of 'a'. ("class="nav-item">
                <a  class="nav-link text-dark" [routerLink]='["/authentication/logout"]' [ERROR ->][state]='{ local: true }' title="Logout">Logout</a>
            </li>
        </ul>
        "): ng:///DynamicTestModule/LoginMenuComponent.html@5:81
        Can't bind to 'routerLink' since it isn't a known property of 'a'. ("*ngIf="!(isAuthenticated | async)">
          <li class="nav-item">
                <a class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/register"]'>Register</a>
            </li>
            <li class="nav-item">
        "): ng:///DynamicTestModule/LoginMenuComponent.html@10:38
        Can't bind to 'routerLink' since it isn't a known property of 'a'. ("
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/login"]'>Login</a>
            </li>
        </ul>
        "): ng:///DynamicTestModule/LoginMenuComponent.html@13:38
        error properties: Object({ ngSyntaxError: true, ngParseErrors: [ Can't bind to 'routerLink' since it isn't a known property of 'a'. ("*ngIf="isAuthenticated | async">
            </li>"): ng:///DynamicTestModule/LoginMenuComponent.html@2:39, Can't bind to 'routerLink' since it isn't a known property of 'a'. ("
            </"): ng:///DynamicTestModule/LoginMenuComponent.html@5:39, Can't bind to 'state' since it isn't a known property of 'a'. ("class="nav-item">
        "): ng:///DynamicTestModule/LoginMenuComponent.htm ... ...

when I attempt to run these tests. Are you not seeing those when you run it locally? If not let me know what steps your taking to test so I can follow them.

@benday
Copy link
Contributor Author

benday commented Aug 4, 2020

Yah. I'm seeing that, too. It was working and now it isn't.

BTW, the "dotnet new angular" template targets Angular 8. I've got this working with Angular 9. Would you like me to add my Angular 9 template updates to this PR along with the security unit test changes?

@ryanbrandenburg
Copy link
Contributor

BTW, the "dotnet new angular" template targets Angular 8. I've got this working with Angular 9. Would you like me to add my Angular 9 template updates to this PR along with the security unit test changes?

Moving to Angular 9 is a bigger thing (if not for the code, then from the book-keeping we do about dependencies on our end). I would prefer to keep the two separate.

@benday
Copy link
Contributor Author

benday commented Aug 4, 2020

gotcha. should I submit a PR for Angular 9 or would you like to push that to a later date entirely?

@ryanbrandenburg
Copy link
Contributor

The issue for upgrading to Angular 9 is here. Looks like we had previously delayed due to problems people were finding with upgrading. @danroth27 is driving some other work related to our SPA templates and could maybe opine if you asked on that issue.

@danroth27
Copy link
Member

@LadyNaggaga

@benday
Copy link
Contributor Author

benday commented Aug 21, 2020

I'm still seeing failures such as:

Chrome 84.0.4147.105 (Windows 10) LoginMenuComponent should create FAILED
            <li class="nav-item">
                <a  class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/profile"]' title="Manage">Hello {{ userName | async }}</a>
            </li>
            <li class="nav-item">
                <a  class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/logout"]' [state]='{ local: true }' title="Logout">Logout</a>
                <a  class="nav-link text-dark" [routerLink]='["/authentication/logout"]' [ERROR ->][state]='{ local: true }' title="Logout">Logout</a>
            </li>
        </ul>
        Can't bind to 'routerLink' since it isn't a known property of 'a'. ("*ngIf="isAuthenticated | async">
            <li class="nav-item">
                <a  class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/profile"]' title="Manage">Hello {{ userName | async }}</a>
            </li>"): ng:///DynamicTestModule/LoginMenuComponent.html@2:39
        Can't bind to 'routerLink' since it isn't a known property of 'a'. ("
            </li>
            <li class="nav-item">
                <a  class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/logout"]' [state]='{ local: true }' title="Logout">Logout</a>
            </"): ng:///DynamicTestModule/LoginMenuComponent.html@5:39
        Can't bind to 'state' since it isn't a known property of 'a'. ("class="nav-item">
                <a  class="nav-link text-dark" [routerLink]='["/authentication/logout"]' [ERROR ->][state]='{ local: true }' title="Logout">Logout</a>
            </li>
        </ul>
        "): ng:///DynamicTestModule/LoginMenuComponent.html@5:81
        Can't bind to 'routerLink' since it isn't a known property of 'a'. ("*ngIf="!(isAuthenticated | async)">
          <li class="nav-item">
                <a class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/register"]'>Register</a>
            </li>
            <li class="nav-item">
        "): ng:///DynamicTestModule/LoginMenuComponent.html@10:38
        Can't bind to 'routerLink' since it isn't a known property of 'a'. ("
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/login"]'>Login</a>
            </li>
        </ul>
        "): ng:///DynamicTestModule/LoginMenuComponent.html@13:38
        error properties: Object({ ngSyntaxError: true, ngParseErrors: [ Can't bind to 'routerLink' since it isn't a known property of 'a'. ("*ngIf="isAuthenticated | async">
            </li>"): ng:///DynamicTestModule/LoginMenuComponent.html@2:39, Can't bind to 'routerLink' since it isn't a known property of 'a'. ("
            </"): ng:///DynamicTestModule/LoginMenuComponent.html@5:39, Can't bind to 'state' since it isn't a known property of 'a'. ("class="nav-item">
        "): ng:///DynamicTestModule/LoginMenuComponent.htm ... ...

when I attempt to run these tests. Are you not seeing those when you run it locally? If not let me know what steps your taking to test so I can follow them.

Hi @ryanbrandenburg -- I'm just getting back to this and i can only repro those errors if I add "--framework netcoreapp3.1" to the dotnet new command. I'm stumped. Hopefully you can help. Here's my process:

  1. install a preview of .net core 5 cli
  2. build the entire tree using .\build.cmd -all -pack -arch x64
  3. install the freshly generated SPA template using dotnet new -I C:\code\github\benday\aspnetcore\artifacts\packages\Debug\Shipping\Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0.5.0.0-dev.nupkg
  4. Create an empty directory and cd to that dir
  5. Run one of the following dotnet new angular commands as follows

For example, this creates code that works fine:
dotnet new angular --auth individual

This creates code that gives all the exceptions you mentioned:
dotnet new angular --auth individual --framework netcoreapp3.1

I did a compare between the code that's generated off of those two commands and the "--framework netcoreapp3.1" doesn't have any of the changes that I've submitted. I suspect that specifying --framework loads an entirely different version of the Microsoft.DotNet.Web.Spa.ProjectTemplates nupkg. Any thoughts on how to get my changes in to the netcoreapp3.1 version?

Any help would be greatly appreciated.

Thanks,
-Ben

@javiercn javiercn added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Oct 9, 2020
@mkArtakMSFT
Copy link
Contributor

@HaoK can you please take this PR over from @ryanbrandenburg and work with @benday to get this merged? Thanks!
//cc @javiercn

@mkArtakMSFT mkArtakMSFT assigned HaoK and unassigned ryanbrandenburg Oct 23, 2020
@mkArtakMSFT mkArtakMSFT requested a review from HaoK October 23, 2020 20:47
@HaoK
Copy link
Member

HaoK commented Oct 26, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@HaoK HaoK linked an issue Nov 2, 2020 that may be closed by this pull request
@HaoK
Copy link
Member

HaoK commented Nov 3, 2020

@benday looks like all the CI checks are passing now, are you still seeing any failures or is this good to go from your perspective?

@benday
Copy link
Contributor Author

benday commented Nov 3, 2020

@HaoK -- Looks good to me. No changes from my end. I'd say it's good to go. Lemme know if you need anything.

@HaoK HaoK dismissed ryanbrandenburg’s stale review November 3, 2020 19:00

Dismissing review since checks are green now

@HaoK HaoK merged commit 2271952 into dotnet:master Nov 3, 2020
@HaoK
Copy link
Member

HaoK commented Nov 3, 2020

Thanks for the PR @benday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates community-contribution Indicates that the PR has been added by a community member enhancement This issue represents an ask for new feature or an enhancement to an existing one

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jasmine specs fail on new angular project using --auth Individual

7 participants