From 832dc4e2689fc402fcb3a399124dc9ae4ade3abe Mon Sep 17 00:00:00 2001 From: Pavel Rybalko Date: Thu, 11 Nov 2021 20:35:49 +0700 Subject: [PATCH] add 2e2 tests --- .github/workflows/yarn.yml | 9 +- .gitignore | 2 +- package.json | 15 +- playwright.config.ts | 13 + src/App.vue | 4 +- src/views/Combine.vue | 10 +- src/views/Share.vue | 28 +- tests/e2e/index.spec.ts | 57 +++ tests/e2e/util/ffmpeg.ts | 27 ++ yarn.lock | 892 +++++++++++++++++++++++++++++++++++-- 10 files changed, 1009 insertions(+), 48 deletions(-) create mode 100644 playwright.config.ts create mode 100644 tests/e2e/index.spec.ts create mode 100644 tests/e2e/util/ffmpeg.ts diff --git a/.github/workflows/yarn.yml b/.github/workflows/yarn.yml index 937a87b..0a6a71a 100644 --- a/.github/workflows/yarn.yml +++ b/.github/workflows/yarn.yml @@ -7,7 +7,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v2-beta + + - name: Read .nvmrc + run: echo NVMRC=`cat .nvmrc` >> $GITHUB_ENV + + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NVMRC }} - name: Get yarn cache directory path id: yarn-cache-dir-path diff --git a/.gitignore b/.gitignore index 53d885d..60c0cad 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,4 @@ yarn-error.log* *.sln *.sw* -.test-results +test-results diff --git a/package.json b/package.json index 3fea229..afd6d5b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "build": "vue-cli-service build", "deploy": "gh-pages -b gh-pages -d dist -a", "lint": "vue-cli-service lint", - "test:unit": "vue-cli-service test:unit" + "test:unit": "vue-cli-service test:unit", + "test:e2e": "playwright test" }, "dependencies": { "base64-js": "^1.3.0", @@ -27,11 +28,13 @@ "vue-router": "^3.0.1" }, "devDependencies": { + "@playwright/test": "^1.16.3", + "@types/fluent-ffmpeg": "^2.1.19", "@types/jest": "^26.0.24", "@typescript-eslint/parser": "^4.31.2", - "@vue/cli-plugin-eslint": "^4.5.13", - "@vue/cli-plugin-typescript": "^4.5.13", - "@vue/cli-plugin-unit-jest": "^4.5.13", + "@vue/cli-plugin-eslint": "^4.5.15", + "@vue/cli-plugin-typescript": "^4.5.15", + "@vue/cli-plugin-unit-jest": "^4.5.15", "@vue/cli-service": "^3.1.4", "@vue/test-utils": "^1.0.0-beta.20", "eslint": "^5.8.0", @@ -40,10 +43,12 @@ "eslint-plugin-security": "^1.4.0", "eslint-plugin-vue": "^6.2.2", "fast-text-encoding": "^1.0.0", + "fluent-ffmpeg": "^2.1.2", "gh-pages": "^2.0.1", "html-webpack-inline-source-plugin": "1.0.0-beta.2", "html-webpack-plugin": "4.0.0-beta.4", "jest-junit": "^6.0.1", + "playwright": "^1.16.3", "ts-jest": "^26.4.4", "vue-template-compiler": "^2.5.17", "vuetype": "^0.3.2" @@ -58,7 +63,7 @@ "last 2 versions" ], "jest-junit": { - "outputDirectory": ".test-results/jest", + "outputDirectory": "test-results/jest", "oputputName": "results.xml" } } diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 0000000..45c7bdd --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,13 @@ +import { PlaywrightTestConfig } from "@playwright/test"; +const config: PlaywrightTestConfig = { + webServer: { + command: "NODE_ENV=test npm run serve -- --port 8888", + port: 8888, + reuseExistingServer: false + }, + testDir: "tests/e2e", + use: { + browserName: "chromium" + } +}; +export default config; diff --git a/src/App.vue b/src/App.vue index 143b4ca..7b8faee 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,10 +15,10 @@
- + Create - + Restore
diff --git a/src/views/Combine.vue b/src/views/Combine.vue index aa506d3..d81d4d9 100644 --- a/src/views/Combine.vue +++ b/src/views/Combine.vue @@ -14,6 +14,7 @@

-