Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated to playwright #1408

Merged
merged 44 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d7a575f
Added playwright
marekdedic Oct 21, 2023
f2b26c7
Updated gitignore
marekdedic Oct 21, 2023
20e5b90
Added a basic playwright test
marekdedic Oct 21, 2023
319c04a
Added eslint config for playwright
marekdedic Oct 21, 2023
1372fc6
Added NPM script for playwright
marekdedic Oct 21, 2023
4425e66
Added playwright tests to CI
marekdedic Oct 21, 2023
c5658b2
Added playwright browser installation to CI
marekdedic Oct 21, 2023
1d15dbb
Added playwright browser dependency installation to CI
marekdedic Oct 21, 2023
c91bb66
Using html reporter in CI
marekdedic Oct 21, 2023
6e53505
Caching playwright binaries
marekdedic Oct 21, 2023
031b2bd
Installing playwright deps even with cached browsers
marekdedic Oct 21, 2023
dca02f4
Using newer GH actions output command
marekdedic Oct 21, 2023
5a43585
Printing playwright version in CI
marekdedic Oct 21, 2023
ce517f2
Installing NPM dependencies before listing playwright version
marekdedic Oct 21, 2023
854eb53
Removed moved cypress test
marekdedic Oct 21, 2023
6aca0ce
Ported configuration test
marekdedic Oct 21, 2023
cb08a1c
Ported destination selection API error test
marekdedic Oct 21, 2023
b789430
Ported destination selection unhandled error test
marekdedic Oct 21, 2023
a7b2b4f
Ported destination selection unknown error test
marekdedic Oct 21, 2023
3aead99
Ported move API error test
marekdedic Oct 21, 2023
ee042c6
Ported move source-destination folder equality error test
marekdedic Oct 21, 2023
bf20b44
Modified playwright endpoint stubing to enable multiple different res…
marekdedic Oct 21, 2023
aded462
Ported move timeout repetition test
marekdedic Oct 21, 2023
dd89346
Ported move unhandled error test
marekdedic Oct 21, 2023
eb90d4f
Ported move unknown error test
marekdedic Oct 21, 2023
32baaf2
Ported navigation test
marekdedic Oct 21, 2023
99dabcc
Added the ability to delay endpoint call in tests
marekdedic Oct 22, 2023
feb1ea3
Separated calls logging per-test
marekdedic Oct 22, 2023
7d2e650
Ported non-empty error test
marekdedic Oct 22, 2023
48e6172
Ported source and destination folder navigation test
marekdedic Oct 22, 2023
e79bbf2
Ported source selection API error test
marekdedic Oct 22, 2023
1e5c0f6
Ported source selection unhandled error test
marekdedic Oct 22, 2023
cee5d91
Ported source selection unknown error test
marekdedic Oct 22, 2023
b68d3f8
Ported success with errors test
marekdedic Oct 22, 2023
bc77824
Moved frontend test directory
marekdedic Oct 22, 2023
0ced37a
Merged playwright test utils
marekdedic Oct 22, 2023
31d8767
Moved frontend test job to playwright
marekdedic Oct 22, 2023
cb4d92d
Removed cypress config
marekdedic Oct 22, 2023
45bed97
Removed cypress lint config
marekdedic Oct 22, 2023
72b3433
Removed obsolete dependencies
marekdedic Oct 22, 2023
5f69ba1
Collecting test coverage from playwright
marekdedic Oct 22, 2023
53a3fd9
Fixed CI outputting multiple playwright versions
marekdedic Oct 22, 2023
f7d0491
Fixed playwright version detection
marekdedic Oct 22, 2023
6ef0475
Added nyc wrapper to playwright
marekdedic Oct 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"parserOptions": {
"parser": "@typescript-eslint/parser",
"project": ["./tsconfig.json", "./cypress/tsconfig.json"],
"project": ["./tsconfig.json"],
"extraFileExtensions": [".svelte"]
},
"env": {
"browser": true,
"node": false
},
"plugins": ["deprecation", "cypress", "jest", "simple-import-sort", "@typescript-eslint"],
"plugins": ["deprecation", "jest", "simple-import-sort", "@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked",
Expand Down Expand Up @@ -196,14 +196,18 @@
},
{
"files": [
"__tests__/frontend/**/*.cy.ts",
"__tests__/test-utils/stubEndpoints.ts"
"__tests__/frontend/*.ts",
"__tests__/test-utils/stub-endpoints.ts"
],
"extends": ["plugin:cypress/recommended"],
"extends": ["plugin:playwright/recommended"],
"rules": {
"cypress/no-force": "error",
"cypress/assertion-before-screenshot": "error",
"cypress/no-pause": "error"
"playwright/no-nth-methods": "error",
"playwright/no-raw-locators": "error",
"playwright/prefer-strict-equal": "error",
"playwright/prefer-to-be": "error",
"playwright/prefer-to-contain": "error",
"playwright/prefer-to-have-count": "error",
"playwright/prefer-to-have-length": "error"
}
}
],
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,29 @@ jobs:
run: |
npm ci

- name: Get installed Playwright version
id: playwright-version
run: |
echo "version=$(node -e "console.log(require('./package-lock.json').packages['node_modules/@playwright/test'].version)")"
echo "version=$(node -e "console.log(require('./package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_OUTPUT

- name: Cache playwright binaries
id: playwright-cache
uses: actions/cache@v3
with:
path: "~/.cache/ms-playwright"
key: playwright-binaries-${{ runner.os }}-${{ env.cache-version }}-${{ steps.playwright-version.outputs.version }}

- name: "Install playwright binaries"
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: |
npx playwright install --with-deps

- name: "Install playwright binaries"
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: |
npx playwright install-deps

- name: "Run tests"
run: |
npm run test:frontend
Expand All @@ -120,3 +143,10 @@ jobs:
uses: codecov/[email protected]
with:
flags: frontend

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
91 changes: 75 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Created by https://www.gitignore.io/api/vim,node,vuejs
# Edit at https://www.gitignore.io/?templates=vim,node,vuejs
# Created by https://www.toptal.com/developers/gitignore/api/vim,node,svelte
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,node,svelte

### Node ###
# Logs
Expand All @@ -9,6 +9,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand All @@ -24,6 +25,7 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output
Expand All @@ -44,15 +46,27 @@ build/Release
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

Expand All @@ -62,22 +76,40 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
# dotenv environment variable files
.env
.env.test
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# next.js build output
# Next.js build output
.next
out

# nuxt.js build output
# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

Expand All @@ -87,16 +119,47 @@ typings/
# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### Svelte ###
# gitignore template for the SvelteKit, frontend web component framework
# website: https://kit.svelte.dev/

.svelte-kit/
package

### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
Expand All @@ -106,12 +169,8 @@ tags
# Persistent undo
[._]*.un~

### Vuejs ###
# Recommended template: Node.gitignore

dist/
npm-debug.log
yarn-error.log

# End of https://www.gitignore.io/api/vim,node,vuejs
# End of https://www.toptal.com/developers/gitignore/api/vim,node,svelte

/test-results/
/playwright-report/
/playwright/.cache/
37 changes: 0 additions & 37 deletions __tests__/frontend/basic.cy.ts

This file was deleted.

48 changes: 48 additions & 0 deletions __tests__/frontend/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { expect, test } from "playwright-test-coverage";

import { setup } from "../test-utils/stub-endpoints";

test("works with basic configuration", async ({ page }) => {
await page.goto("/");
const getCalls = await setup(page);

await page.evaluate(() => {
window._endpointStubs.listSharedDrives = [
{
status: "success",
value: { status: "success", response: [] },
},
{
status: "success",
value: { status: "success", response: [] },
},
];
window._endpointStubs.move = [
{
status: "success",
value: { status: "success", response: { errors: [] } },
},
];
});

await expect(
page.getByText("Shared drive mover", { exact: true }),
).toBeVisible();
await page.getByText("Continue").click();
await page.getByText("My Drive").click();
await page.getByText("Continue").click();
await page.getByText("My Drive").click();
await page.getByText("Continue").click();
await expect(
page.getByText(
'contents of the folder "My Drive" into the folder "My Drive"',
),
).toBeVisible();
await page.getByText("Move", { exact: true }).click();
await expect(page.getByText("Done!", { exact: true })).toBeVisible();
await expect(page.getByText("Successfully moved")).toBeVisible();

const moveCalls = getCalls("move");
expect(moveCalls).toHaveLength(1);
expect(moveCalls[0]).toStrictEqual(["root", "root", true, true, false]);
});
61 changes: 0 additions & 61 deletions __tests__/frontend/configuration.cy.ts

This file was deleted.

Loading