From 3056788d5aaa22f6547ab3790706f0332dca73d3 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Mon, 11 Oct 2021 12:49:51 +0100 Subject: [PATCH 1/3] test(automation): :white_check_mark: Fixed the user security automation tests --- .../user-preferences/user-preferences.page.ts | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/tests/cypress/integration/page-objects/user-preferences/user-preferences.page.ts b/tests/cypress/integration/page-objects/user-preferences/user-preferences.page.ts index 83f6a8bc5..bf0c501b6 100644 --- a/tests/cypress/integration/page-objects/user-preferences/user-preferences.page.ts +++ b/tests/cypress/integration/page-objects/user-preferences/user-preferences.page.ts @@ -18,17 +18,6 @@ class ProfileTab { } } -class MobileTab { - - get qrCode(): Cypress.Chainable { - return cy.get('#qrCode'); - } - - get noQrCode(): Cypress.Chainable { - return cy.get('#noQrCode'); - } -} - class SecurityTab { get currentPassword(): Cypress.Chainable { return cy.get('#currentPassword'); @@ -62,23 +51,17 @@ class UserPreferencesPage extends BasePage { } get profileTab(): Cypress.Chainable { - return cy.get('[role="tab"]').eq(0); + return cy.get('#mat-tab-label-0-0'); } get securityTab(): Cypress.Chainable { - return cy.get('[role="tab"]').eq(1); - } - - get preferencesTab(): Cypress.Chainable { - return cy.get('[role="tab"]').eq(2); - } - - get mobileTab(): Cypress.Chainable { - return cy.get('[role="tab"]').eq(3); + cy.waitUntil(() => { + return cy.get('#mat-tab-label-0-1').should('be.visible'); + }); + return cy.get('#mat-tab-label-0-1'); } profile = new ProfileTab(); - mobile = new MobileTab(); security = new SecurityTab(); constructor() { From 10f5e056c8257f8b8fe954bfbc70d3c3daa7a8e3 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Mon, 11 Oct 2021 12:50:25 +0100 Subject: [PATCH 2/3] fix(search): :bug: Fixed an issue where changing the filter wouldn't refresh the search results --- src/Ombi/ClientApp/src/app/app.module.ts | 2 -- .../search-results/search-results.component.ts | 11 +++++------ .../src/app/discover/services/filter-service.ts | 3 ++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/app.module.ts b/src/Ombi/ClientApp/src/app/app.module.ts index 1716b5c5e..ae4122eb7 100644 --- a/src/Ombi/ClientApp/src/app/app.module.ts +++ b/src/Ombi/ClientApp/src/app/app.module.ts @@ -19,7 +19,6 @@ import { CookieService } from "ng2-cookies"; import { CustomPageComponent } from "./custompage/custompage.component"; import { DataViewModule } from "primeng/dataview"; import { DialogModule } from "primeng/dialog"; -import { FilterService } from "./discover/services/filter-service"; import { JwtModule } from "@auth0/angular-jwt"; import { LandingPageComponent } from "./landingpage/landingpage.component"; import { LandingPageService } from "./services"; @@ -222,7 +221,6 @@ export function JwtTokenGetter() { MessageService, StorageService, RequestService, - FilterService, SignalRNotificationService, { provide: APP_BASE_HREF, diff --git a/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts b/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts index 02415a970..bef8bae03 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts @@ -55,18 +55,17 @@ export class DiscoverSearchResultsComponent implements OnInit { public async ngOnInit() { this.isAdmin = this.authService.isAdmin(); - - if (this.advancedDataService) { - return; - } - this.loadingFlag = true; - this.filterService.onFilterChange.subscribe(async x => { if (!isEqual(this.filter, x)) { this.filter = { ...x }; await this.search(); } }); + + if (this.advancedDataService) { + return; + } + this.loadingFlag = true; } public async init() { diff --git a/src/Ombi/ClientApp/src/app/discover/services/filter-service.ts b/src/Ombi/ClientApp/src/app/discover/services/filter-service.ts index bceeb05d6..1dece0e27 100644 --- a/src/Ombi/ClientApp/src/app/discover/services/filter-service.ts +++ b/src/Ombi/ClientApp/src/app/discover/services/filter-service.ts @@ -1,7 +1,8 @@ import { EventEmitter, Injectable, Output } from "@angular/core"; + import { SearchFilter } from "../../my-nav/SearchFilter"; -@Injectable() +@Injectable({providedIn: 'root'}) export class FilterService { @Output() public onFilterChange = new EventEmitter(); From 2fe41f3910e578d45cd36e88847cced382cb1785 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Mon, 11 Oct 2021 14:07:30 +0100 Subject: [PATCH 3/3] test(automation): :test_tube: Fixed flakey tests --- .../tests/discover/discover-cards-requests.spec.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/cypress/tests/discover/discover-cards-requests.spec.ts b/tests/cypress/tests/discover/discover-cards-requests.spec.ts index 81d86d7e7..d024225f3 100644 --- a/tests/cypress/tests/discover/discover-cards-requests.spec.ts +++ b/tests/cypress/tests/discover/discover-cards-requests.spec.ts @@ -1,5 +1,5 @@ -import { discoverPage as Page } from "@/integration/page-objects"; import { DiscoverType } from "@/integration/page-objects/shared/DiscoverCard"; +import { discoverPage as Page } from "@/integration/page-objects"; describe("Discover Cards Requests Tests", () => { beforeEach(() => { @@ -288,9 +288,15 @@ describe("Discover Cards Requests Tests", () => { var expectedId = body[3].id; var title = body[3].title; + cy.wait(3000); + const card = Page.popularCarousel.getCard(expectedId, false, DiscoverType.Popular); card.title.realHover(); + cy.waitUntil(() => { + return card.requestButton.should("be.visible"); + }); + card.verifyTitle(title); card.requestButton.should("be.visible"); card.requestButton.click(); @@ -335,9 +341,15 @@ describe("Discover Cards Requests Tests", () => { var expectedId = body[5].id; var title = body[5].title; + cy.wait(3000); + const card = Page.popularCarousel.getCard(expectedId, false, DiscoverType.Popular); card.title.realHover(); + cy.waitUntil(() => { + return card.requestButton.should("be.visible"); + }); + card.verifyTitle(title); card.requestButton.should("be.visible"); card.requestButton.click();