From aabc46c6e44ad642d8e0176c39cfbaace288f2d1 Mon Sep 17 00:00:00 2001 From: HannahZhuSWE Date: Wed, 15 Mar 2023 12:23:24 -0700 Subject: [PATCH 1/2] remove files related to nightly integration project --- .github/workflows/playwright-onDemand.yml | 94 ---------------------- .github/workflows/playwright-scheduled.yml | 84 ------------------- .gitignore | 5 +- package.json | 17 +--- playwright.config.ts | 83 ------------------- tests/Test.README.md | 3 - tests/playwright.spec.ts | 8 -- 7 files changed, 2 insertions(+), 292 deletions(-) delete mode 100644 .github/workflows/playwright-onDemand.yml delete mode 100644 .github/workflows/playwright-scheduled.yml delete mode 100644 playwright.config.ts delete mode 100644 tests/Test.README.md delete mode 100644 tests/playwright.spec.ts diff --git a/.github/workflows/playwright-onDemand.yml b/.github/workflows/playwright-onDemand.yml deleted file mode 100644 index 8435d36..0000000 --- a/.github/workflows/playwright-onDemand.yml +++ /dev/null @@ -1,94 +0,0 @@ - -# This is a basic workflow to help you get started with Actions - -name: Playwright tests - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the "main" branch - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - schedule: - # nightly - - cron: '0 0 * * *' - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - test: - # Runs on an ubuntu runner - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [14.x, 16.x, 18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - - name: Install dependencies - run: npm ci - - name: Install SWA and Azure Function tool - run: npm install -g @azure/static-web-apps-cli azure-functions-core-tools - - name: Install Playwright - run: npx playwright install --with-deps - - name: Run playwright tests - run: npm run playwright_test - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - - name: Upload HTML report as Artifact - uses: actions/upload-artifact@v2 - env: - TAG_NAME: test-report-${{ steps.date.outputs.date }} - if: always() - with: - name: onDemand - path: pw-report/ - - storeReports: - name: Store reports - if: ${{ always() }} - needs: test - runs-on: ubuntu-latest - steps: - - name: Download all workflow run artifacts - uses: actions/download-artifact@v3 - id: download - - name: Publish to external repo - if: always() - uses: peaceiris/actions-gh-pages@v3.7.3 - with: - external_repository: mspnp/intern-js-pipeline - publish_branch: gh-pages - personal_token: ${{ secrets.PAT_TOKEN }} - publish_dir: ${{steps.download.outputs.download-path}} - destination_dir: test-reports/${{ github.repository }} - keep_files: true - user_name: "github-actions[bot]" - user_email: "github-actions[bot]@users.noreply.github.com" - - notify-dashboard: - name: Notify Dashboard - if: ${{ always() }} - needs: [test, storeReports] - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 - - # Runs a single command using the runners shell - - name: Notify docusaurus repo - env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - run: | - gh api repos/mspnp/intern-js-pipeline/dispatches \ - --raw-field event_type=rebuild-site diff --git a/.github/workflows/playwright-scheduled.yml b/.github/workflows/playwright-scheduled.yml deleted file mode 100644 index 9e77865..0000000 --- a/.github/workflows/playwright-scheduled.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Scheduled Playwright tests - -# Controls when the workflow will run -on: - # Triggers the workflow nightly - schedule: - # nightly - - cron: '0 0 * * *' - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - test: - # Runs on an ubuntu runner - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [14.x, 16.x, 18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - - name: Install dependencies - run: npm ci - - name: Install SWA and Azure Function tool - run: npm install -g @azure/static-web-apps-cli azure-functions-core-tools - - name: Install Playwright - run: npx playwright install --with-deps - - name: Run playwright tests - run: npm run playwright_test - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - - name: Upload HTML report as Artifact - uses: actions/upload-artifact@v2 - env: - TAG_NAME: test-report-${{ steps.date.outputs.date }} - if: always() - with: - name: ${{ steps.date.outputs.date }} - path: pw-report/ - - storeReports: - name: Store reports - if: ${{ always() }} - needs: test - runs-on: ubuntu-latest - steps: - - name: Download all workflow run artifacts - uses: actions/download-artifact@v3 - id: download - - name: Publish to external repo - if: always() - uses: peaceiris/actions-gh-pages@v3.7.3 - with: - external_repository: mspnp/intern-js-pipeline - publish_branch: gh-pages - personal_token: ${{ secrets.PAT_TOKEN }} - publish_dir: ${{steps.download.outputs.download-path}} - destination_dir: test-reports/${{ github.repository }} - keep_files: true - user_name: "github-actions[bot]" - user_email: "github-actions[bot]@users.noreply.github.com" - - notify-dashboard: - name: Notify Dashboard - if: ${{ always() }} - needs: [test, storeReports] - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 - - # Runs a single command using the runners shell - - name: Notify dashboard repo - env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - run: | - gh api repos/mspnp/intern-js-pipeline/dispatches \ - --raw-field event_type=rebuild-site diff --git a/.gitignore b/.gitignore index 75e854d..40b878d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1 @@ -node_modules/ -/test-results/ -/playwright-report/ -/playwright/.cache/ +node_modules/ \ No newline at end of file diff --git a/package.json b/package.json index 053f5b6..7c55db1 100644 --- a/package.json +++ b/package.json @@ -4,21 +4,6 @@ "description": "", "main": "index.js", "scripts": { - "start": "swa start src --api-location api", - "playwright_test": "playwright test" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/HannahZhuSWE/vanilla-api.git" - }, - "keywords": [], - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/HannahZhuSWE/vanilla-api/issues" - }, - "homepage": "https://github.com/HannahZhuSWE/vanilla-api#readme", - "devDependencies": { - "@playwright/test": "^1.23.2" + "start": "swa start src --api-location api" } } diff --git a/playwright.config.ts b/playwright.config.ts deleted file mode 100644 index d3c3896..0000000 --- a/playwright.config.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -/** - * Read environment variables from file. - * https://github.com/motdotla/dotenv - */ -// require('dotenv').config(); - -/** - * See https://playwright.dev/docs/test-configuration. - */ -const config: PlaywrightTestConfig = { - testDir: './tests', - /* Maximum time one test can run for. */ - timeout: 30 * 1000, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 5000 - }, - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: process.env.CI ? 2 : 0, - /* Opt out of parallel tests on CI. */ - workers: process.env.CI ? 1 : undefined, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: [ - ['html', { outputFolder: 'pw-report' }], - ['json', { outputFolder: 'pw-report', outputFile: 'report.json' }] - ], - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: 'http://localhost:4280', - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on', - }, - - /* Configure projects for major browsers */ - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - - { - name: 'firefox', - use: { - ...devices['Desktop Firefox'], - }, - }, - - { - name: 'webkit', - use: { - ...devices['Desktop Safari'], - }, - }, - - ], - - /* Folder for test artifacts such as screenshots, videos, traces, etc. */ - // outputDir: 'test-results/', - - /* Run your local dev server before starting the tests */ - webServer: { - command: 'npm run start', - port: 4280, - } -}; - -export default config; diff --git a/tests/Test.README.md b/tests/Test.README.md deleted file mode 100644 index 65f1284..0000000 --- a/tests/Test.README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Testing - -To run playwright tests run `npm run playwright_test`. In order to run the playwright tests the start script `swa start src --api-location api` was added. \ No newline at end of file diff --git a/tests/playwright.spec.ts b/tests/playwright.spec.ts deleted file mode 100644 index 1cb7a8d..0000000 --- a/tests/playwright.spec.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('basic test', async ({ page }) => { - await page.goto('/'); - await page.waitForSelector('h1') - await expect(page.locator('h1')).toContainText('Vanilla JavaScript App'); - await expect(page.locator('b')).toContainText('Hello from the API') -}) \ No newline at end of file From b4f0d1d3cd8374cf240b6a4fd70c9fc1fb0c75ad Mon Sep 17 00:00:00 2001 From: HannahZhuSWE Date: Fri, 17 Mar 2023 17:34:27 -0700 Subject: [PATCH 2/2] removed package.json, package-lock.json, and .gitignore in root folder since they weren't there before the nightly integration tests --- .gitignore | 1 - package-lock.json | 74 ----------------------------------------------- package.json | 9 ------ 3 files changed, 84 deletions(-) delete mode 100644 .gitignore delete mode 100644 package-lock.json delete mode 100644 package.json diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 40b878d..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ \ No newline at end of file diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 4600096..0000000 --- a/package-lock.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "vanilla-api", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "vanilla-api", - "version": "1.0.0", - "license": "ISC", - "devDependencies": { - "@playwright/test": "^1.23.2" - } - }, - "node_modules/@playwright/test": { - "version": "1.23.2", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.23.2.tgz", - "integrity": "sha512-umaEAIwQGfbezixg3raSOraqbQGSqZP988sOaMdpA2wj3Dr6ykOscrMukyK3U6edxhpS0N8kguAFZoHwCEfTig==", - "dev": true, - "dependencies": { - "@types/node": "*", - "playwright-core": "1.23.2" - }, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/@types/node": { - "version": "18.0.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.3.tgz", - "integrity": "sha512-HzNRZtp4eepNitP+BD6k2L6DROIDG4Q0fm4x+dwfsr6LGmROENnok75VGw40628xf+iR24WeMFcHuuBDUAzzsQ==", - "dev": true - }, - "node_modules/playwright-core": { - "version": "1.23.2", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.23.2.tgz", - "integrity": "sha512-UGbutIr0nBALDHWW/HcXfyK6ZdmefC99Moo4qyTr89VNIkYZuDrW8Sw554FyFUamcFSdKOgDPk6ECSkofGIZjQ==", - "dev": true, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=14" - } - } - }, - "dependencies": { - "@playwright/test": { - "version": "1.23.2", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.23.2.tgz", - "integrity": "sha512-umaEAIwQGfbezixg3raSOraqbQGSqZP988sOaMdpA2wj3Dr6ykOscrMukyK3U6edxhpS0N8kguAFZoHwCEfTig==", - "dev": true, - "requires": { - "@types/node": "*", - "playwright-core": "1.23.2" - } - }, - "@types/node": { - "version": "18.0.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.3.tgz", - "integrity": "sha512-HzNRZtp4eepNitP+BD6k2L6DROIDG4Q0fm4x+dwfsr6LGmROENnok75VGw40628xf+iR24WeMFcHuuBDUAzzsQ==", - "dev": true - }, - "playwright-core": { - "version": "1.23.2", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.23.2.tgz", - "integrity": "sha512-UGbutIr0nBALDHWW/HcXfyK6ZdmefC99Moo4qyTr89VNIkYZuDrW8Sw554FyFUamcFSdKOgDPk6ECSkofGIZjQ==", - "dev": true - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 7c55db1..0000000 --- a/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "vanilla-api", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "start": "swa start src --api-location api" - } -}