From d54b21c81a915b4c95749c0fbca31adfce867586 Mon Sep 17 00:00:00 2001 From: Max Kless Date: Fri, 20 Dec 2024 16:11:56 +0100 Subject: [PATCH] fix types in generate-ui-v2-e2e --- .github/workflows/ci_checks.yml | 20 +++++++++---------- apps/generate-ui-v2-e2e/src/e2e/app.cy.ts | 8 ++++---- .../src/e2e/generator-context.cy.ts | 4 ++-- .../src/support/console-spy.ts | 4 +--- apps/generate-ui-v2-e2e/tsconfig.json | 10 +++------- 5 files changed, 20 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci_checks.yml b/.github/workflows/ci_checks.yml index e33535fc12..591879b528 100644 --- a/.github/workflows/ci_checks.yml +++ b/.github/workflows/ci_checks.yml @@ -28,6 +28,16 @@ jobs: - run: git branch --track master origin/master if: ${{ github.event_name == 'pull_request' }} + - name: Gradle Wrapper Validation + uses: gradle/actions/wrapper-validation@v3 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: ${{ env.JAVA_VERSION }} + cache: gradle + - name: Ensure Nx Cloud Agents are configured correctly run: yarn dlx nx-cloud validate --workflow-file=./.nx/workflows/agents.yaml @@ -49,16 +59,6 @@ jobs: - name: Install NPM dependencies run: yarn install --immutable - - name: Gradle Wrapper Validation - uses: gradle/actions/wrapper-validation@v3 - - - name: Setup Java - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: ${{ env.JAVA_VERSION }} - cache: gradle - # We intentionally put the gradle tasks first because their artifacts are needed for project graph construction # and we do not want to give the false impression that the artifact download time is part of nx commands. - name: Gradle artifacts and formatting diff --git a/apps/generate-ui-v2-e2e/src/e2e/app.cy.ts b/apps/generate-ui-v2-e2e/src/e2e/app.cy.ts index 358f0ade8d..8fb1105721 100644 --- a/apps/generate-ui-v2-e2e/src/e2e/app.cy.ts +++ b/apps/generate-ui-v2-e2e/src/e2e/app.cy.ts @@ -18,7 +18,7 @@ describe('generate-ui-v2', () => { }); it('should send message when generate button is clicked', () => { - spyOnConsoleLog().then((consoleLog) => { + spyOnConsoleLog().then((consoleLog: any) => { cy.get("[data-cy='generate-button']").click(); expectConsoleLogToHaveBeenCalledWith(consoleLog, 'run-generator'); }); @@ -37,7 +37,7 @@ describe('generate-ui-v2', () => { getFieldByName('array-field').type('test-value2{enter}'); getFieldByName('option2').type('test-option2'); - spyOnConsoleLog().then((consoleLog) => { + spyOnConsoleLog().then((consoleLog: any) => { cy.get('body').type('{ctrl}{enter}'); expectConsoleLogToHaveBeenCalledWith(consoleLog, 'run-generator'); expectConsoleLogToHaveBeenCalledWith( @@ -87,13 +87,13 @@ describe('generate-ui-v2', () => { cy.get('[id="search-bar"]').should('be.focused'); }); it('should be able to run generator with shortcut', () => { - spyOnConsoleLog().then((consoleLog) => { + spyOnConsoleLog().then((consoleLog: any) => { cy.get('body').type('{ctrl}{enter}'); expectConsoleLogToHaveBeenCalledWith(consoleLog, 'run-generator'); }); }); it('should be able to dry run generator with shortcut', () => { - spyOnConsoleLog().then((consoleLog) => { + spyOnConsoleLog().then((consoleLog: any) => { cy.get('body').type('{ctrl}{shift}{enter}'); expectConsoleLogToHaveBeenCalledWith(consoleLog, 'run-generator'); expectConsoleLogToHaveBeenCalledWith(consoleLog, '--dry-run'); diff --git a/apps/generate-ui-v2-e2e/src/e2e/generator-context.cy.ts b/apps/generate-ui-v2-e2e/src/e2e/generator-context.cy.ts index 526213c623..1fd73e2454 100644 --- a/apps/generate-ui-v2-e2e/src/e2e/generator-context.cy.ts +++ b/apps/generate-ui-v2-e2e/src/e2e/generator-context.cy.ts @@ -32,7 +32,7 @@ describe('generator context', () => { visitGenerateUi(schemaProj); getFieldByName('project').should('have.value', 'project3'); - spyOnConsoleLog().then((consoleLog) => { + spyOnConsoleLog().then((consoleLog: any) => { cy.get("[data-cy='generate-button']").click(); expectConsoleLogToHaveBeenCalledWith(consoleLog, 'run-generator'); expectConsoleLogToHaveBeenCalledWith(consoleLog, '--project=project3'); @@ -59,7 +59,7 @@ describe('generator context', () => { }; it('should use fixed form value and use them to construct the generate command', () => { visitGenerateUi(schemaFixed); - spyOnConsoleLog().then((consoleLog) => { + spyOnConsoleLog().then((consoleLog: any) => { cy.get("[data-cy='generate-button']").click(); expectConsoleLogToHaveBeenCalledWith(consoleLog, 'run-generator'); expectConsoleLogToHaveBeenCalledWith(consoleLog, '--sample=value'); diff --git a/apps/generate-ui-v2-e2e/src/support/console-spy.ts b/apps/generate-ui-v2-e2e/src/support/console-spy.ts index 096d170c37..725008f668 100644 --- a/apps/generate-ui-v2-e2e/src/support/console-spy.ts +++ b/apps/generate-ui-v2-e2e/src/support/console-spy.ts @@ -1,6 +1,4 @@ -export const spyOnConsoleLog = (): Cypress.Chainable< - Cypress.Agent -> => +export const spyOnConsoleLog = (): any => cy.window().then((win) => { return cy.spy(win.console, 'log').as('consoleLog'); }); diff --git a/apps/generate-ui-v2-e2e/tsconfig.json b/apps/generate-ui-v2-e2e/tsconfig.json index b122c483e7..7d3614cb76 100644 --- a/apps/generate-ui-v2-e2e/tsconfig.json +++ b/apps/generate-ui-v2-e2e/tsconfig.json @@ -2,14 +2,10 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "out-tsc/generate-ui-v2-e2e", - "types": ["cypress", "node", "cypress-real-events"] + "types": ["cypress", "node", "cypress-real-events"], + "lib": ["DOM"] }, - "include": [ - "src/**/*.ts", - "src/**/*.js", - "cypress.config.ts", - "src/support/test-schema.ts" - ], + "include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"], "references": [ { "path": "../../libs/shared/nx-version"