diff --git a/.tekton/compliance-frontend-pull-request.yaml b/.tekton/compliance-frontend-pull-request.yaml index eccf4fc6e..7e54de559 100644 --- a/.tekton/compliance-frontend-pull-request.yaml +++ b/.tekton/compliance-frontend-pull-request.yaml @@ -301,48 +301,55 @@ spec: workspaces: - name: basic-auth workspace: git-auth - # - name: run-unit-tests - # description: Validates frontend unit tests - # params: - # - name: SOURCE_ARTIFACT - # value: $(tasks.clone-repository-oci-ta.results.SOURCE_ARTIFACT) - # runAfter: - # - clone-repository-oci-ta - # workspaces: - # - name: basic-auth - # workspace: git-auth - # taskSpec: - # params: - # - description: The Trusted Artifact URI pointing to the artifact with the application source code. - # name: SOURCE_ARTIFACT - # type: string - # volumes: - # # New volume to store a copy of the source code accessible only to this Task. - # - name: workdir - # emptyDir: {} - # stepTemplate: - # volumeMounts: - # - mountPath: /var/workdir - # name: workdir - # readOnly: false - # sidecars: - # steps: - # - name: use-trusted-artifact - # image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:8391272c4e5011120e9e7fee2c1f339e9405366110bf239dadcbc21e953ce099 - # args: - # - use - # - $(params.SOURCE_ARTIFACT)=/var/workdir - # - image: registry.access.redhat.com/ubi8/nodejs-20 - # workingDir: /var/workdir - # name: unit-tests - # securityContext: - # runAsUser: 0 - # script: | - # #!/bin/bash - # set -ex + - name: run-unit-tests + description: Validates frontend unit tests + params: + - name: SOURCE_ARTIFACT + value: $(tasks.clone-repository-oci-ta.results.SOURCE_ARTIFACT) + runAfter: + - clone-repository-oci-ta + workspaces: + - name: basic-auth + workspace: git-auth + taskSpec: + params: + - description: The Trusted Artifact URI pointing to the artifact with the application source code. + name: SOURCE_ARTIFACT + type: string + volumes: + # New volume to store a copy of the source code accessible only to this Task. + - name: workdir + emptyDir: {} + stepTemplate: + volumeMounts: + - mountPath: /var/workdir + name: workdir + readOnly: false + sidecars: + steps: + - name: use-trusted-artifact + image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:52f1391e6f1c472fd10bb838f64fae2ed3320c636f536014978a5ddbdfc6b3af + args: + - use + - $(params.SOURCE_ARTIFACT)=/var/workdir + - image: registry.access.redhat.com/ubi8/nodejs-20 + workingDir: /var/workdir + name: unit-tests + computeResources: + requests: + memory: 4Gi + cpu: 500m + limits: + memory: 8Gi + cpu: 1000m + securityContext: + runAsUser: 0 + script: | + #!/bin/bash + set -ex - # npm install - # npm test + npm install + npm test - name: build-container params: - name: IMAGE diff --git a/.tekton/compliance-frontend-push.yaml b/.tekton/compliance-frontend-push.yaml index 6e1f0c98e..b366021a0 100644 --- a/.tekton/compliance-frontend-push.yaml +++ b/.tekton/compliance-frontend-push.yaml @@ -298,53 +298,53 @@ spec: workspaces: - name: basic-auth workspace: git-auth - # - name: run-unit-tests - # description: Validates frontend unit tests - # params: - # - name: SOURCE_ARTIFACT - # value: $(tasks.clone-repository-oci-ta.results.SOURCE_ARTIFACT) - # runAfter: - # - clone-repository-oci-ta - # computeResources: - # requests: - # memory: 1Gi - # requests: - # memory: 2Gi - # workspaces: - # - name: basic-auth - # workspace: git-auth - # taskSpec: - # params: - # - description: The Trusted Artifact URI pointing to the artifact with the application source code. - # name: SOURCE_ARTIFACT - # type: string - # volumes: - # # New volume to store a copy of the source code accessible only to this Task. - # - name: workdir - # emptyDir: {} - # stepTemplate: - # volumeMounts: - # - mountPath: /var/workdir - # name: workdir - # readOnly: false - # sidecars: - # steps: - # - name: use-trusted-artifact - # image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:8391272c4e5011120e9e7fee2c1f339e9405366110bf239dadcbc21e953ce099 - # args: - # - use - # - $(params.SOURCE_ARTIFACT)=/var/workdir - # - image: registry.access.redhat.com/ubi8/nodejs-20 - # workingDir: /var/workdir - # name: unit-tests - # securityContext: - # runAsUser: 0 - # script: | - # #!/bin/bash - # set -ex + - name: run-unit-tests + description: Validates frontend unit tests + params: + - name: SOURCE_ARTIFACT + value: $(tasks.clone-repository-oci-ta.results.SOURCE_ARTIFACT) + runAfter: + - clone-repository-oci-ta + computeResources: + requests: + memory: 1Gi + requests: + memory: 2Gi + workspaces: + - name: basic-auth + workspace: git-auth + taskSpec: + params: + - description: The Trusted Artifact URI pointing to the artifact with the application source code. + name: SOURCE_ARTIFACT + type: string + volumes: + # New volume to store a copy of the source code accessible only to this Task. + - name: workdir + emptyDir: {} + stepTemplate: + volumeMounts: + - mountPath: /var/workdir + name: workdir + readOnly: false + sidecars: + steps: + - name: use-trusted-artifact + image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:52f1391e6f1c472fd10bb838f64fae2ed3320c636f536014978a5ddbdfc6b3af + args: + - use + - $(params.SOURCE_ARTIFACT)=/var/workdir + - image: registry.access.redhat.com/ubi8/nodejs-20 + workingDir: /var/workdir + name: unit-tests + securityContext: + runAsUser: 0 + script: | + #!/bin/bash + set -ex - # npm install - # npm test + npm install + npm test - name: build-container params: - name: IMAGE diff --git a/src/SmartComponents/CreatePolicy/CreatePolicy.test.js b/src/SmartComponents/CreatePolicy/CreatePolicy.test.js index 654d8915f..7db9b9b0e 100644 --- a/src/SmartComponents/CreatePolicy/CreatePolicy.test.js +++ b/src/SmartComponents/CreatePolicy/CreatePolicy.test.js @@ -47,22 +47,30 @@ describe('CreatePolicy', () => { randomSystems, randomSystemsCounts, } = graphqlQueryMocks(['7']); - + console.log('Start rendering'); render( ); - + console.log('eshamard TEST 1'); expect(screen.getByRole('button', { name: 'Next' })).toBeDisabled(); + console.log('eshamard TEST 2'); await checkStep('Create SCAP policy', async () => { - await screen.findByText('Operating system'); + console.log('eshamard TEST 2.1') + await waitFor( + () => expect(screen.getByText('Operating system')).toBeInTheDocument(), + { timeout: 15000 } + ); + // await screen.findByText('Operating system', {}, { timeout: 15000 }); + console.log('eshamard TEST 2.2') await userEvent.click( screen.getByRole('option', { name: 'RHEL ' + osMajorVersionToSelect.osMajorVersion, }) ); + console.log('eshamard TEST 3'); expect(screen.getByText('Policy type')).toBeInTheDocument(); @@ -71,21 +79,26 @@ describe('CreatePolicy', () => { screen.getByRole('textbox', { name: 'text input' }), profileToSelect.name ); + console.log('TEST 4'); await userEvent.click( screen.getByRole('radio', { name: 'Select row 0' }) ); }); + console.log('TEST 5'); await nextStep('Details', async () => { expect(screen.getByText('Policy name')).toBeInTheDocument(); }); + console.log('TEST 6'); await nextStep('Systems', async () => { // Since we mock InventoryTable we need to dispatch a change manually dispatchFieldChange(store, 'systems', randomSystems); dispatchFieldChange(store, 'osMinorVersionCounts', randomSystemsCounts); }); + console.log('TEST 7'); + // TODO add proper rules data // await nextStep('Rules', async () => { // expect(screen.getByText(profileToSelect.name)).toBeInTheDocument();