-
Notifications
You must be signed in to change notification settings - Fork 60
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
Revert "feat(system-e2e): Move system-e2e to NX, v4" #14783
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
{ | ||
"recommendations": [ | ||
"esbenp.prettier-vscode", | ||
"firsttris.vscode-jest-runner", | ||
"ms-playwright.playwright" | ||
] | ||
"recommendations": ["esbenp.prettier-vscode", "firsttris.vscode-jest-runner"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"presets": [ | ||
"@nrwl/js/babel", | ||
"next/babel", | ||
"../../libs/shared/babel/web", | ||
"@babel/preset-env", | ||
"@babel/preset-typescript" | ||
], | ||
"plugins": ["@babel/plugin-proposal-class-properties"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,10 @@ | ||
{ | ||
"extends": ["plugin:playwright/recommended", "../../.eslintrc"], | ||
"extends": "../../.eslintrc", | ||
"rules": {}, | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["e2e/**/*.{ts,js,tsx,jsx}"], | ||
"rules": {} | ||
} | ||
{ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "rules": {} }, | ||
{ "files": ["*.ts", "*.tsx"], "rules": {} }, | ||
{ "files": ["*.js", "*.jsx"], "rules": {} } | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test-results/ | ||
playwright-report/ | ||
tmp-sessions/ |
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// global.d.ts | ||
export {} | ||
|
||
declare global { | ||
namespace PlaywrightTest { | ||
interface Matchers<R> { | ||
toHaveCountGreaterThan(a: number): Promise<R> | ||
toBeApplication(applicationType?: string): Promise<R> | ||
} | ||
} | ||
} | ||
export default {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "system-e2e", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@aws-sdk/client-ses": "^3.145.0", | ||
"@formatjs/intl": "^1.8.1", | ||
"@playwright/test": "^1.29.2", | ||
"axios": "^0.21.4", | ||
"imap-simple": "^5.1.0", | ||
"mailparser": "^3.5.0", | ||
"nodemailer": "^6.7.2", | ||
"playwright-tesults-reporter": "^1.0.1", | ||
"react": "^18.2.0", | ||
"react-intl": "^6.3.0", | ||
"slack-notify": "^2.0.3" | ||
}, | ||
"volta": { | ||
"node": "16.17.0" | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { expect, Locator, Page } from '@playwright/test' | ||
import { sleep } from './support/utils' | ||
|
||
expect.extend({ | ||
async toHaveCountGreaterThan( | ||
received: Locator, | ||
value: number, | ||
options: { timeout: number; sleepTime: number } = { | ||
timeout: 10000, | ||
sleepTime: 100, | ||
}, | ||
) { | ||
const initialTime = Date.now() | ||
let count = -1 | ||
while (count <= value) { | ||
count = await received.count() | ||
if (Date.now() > initialTime + options.timeout) | ||
return { message: () => 'Timeout', pass: false } | ||
await sleep(options.sleepTime) | ||
} | ||
return { | ||
message: () => `Found ${count} elements`, | ||
pass: true, | ||
} | ||
}, | ||
Comment on lines
+5
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification RecommendationThe
Suggested Implementation Updateasync toHaveCountGreaterThan(
received: Locator,
value: number,
options: { timeout: number; sleepTime: number } = {
timeout: 10000,
sleepTime: 100,
},
) {
const initialTime = Date.now()
let count = -1
while (count <= value) {
try {
count = await received.count()
} catch (error) {
return { message: () => `Locator not found: ${error.message}`, pass: false }
}
if (Date.now() > initialTime + options.timeout)
return { message: () => 'Timeout', pass: false }
await sleep(options.sleepTime)
}
return {
message: () => `Found ${count} elements`,
pass: true,
}
} Suggested Test CasesAdd test cases in the relevant test files to cover scenarios where the locator might not be found.
test('should fail when locator is not found', async () => {
const nonExistentLocator = page.locator('.non-existent-class')
await expect(nonExistentLocator).toHaveCountGreaterThan(0)
}) Files to Update
Analysis chainEnsure the Step 1: Review the implementation in
|
||
async toBeApplication(received: string | Page, applicationType = '\\w+') { | ||
const url: string = typeof received == 'string' ? received : received.url() | ||
const protocol = 'https?://' | ||
const host = '[^/]+' | ||
const applicationId = '(/(\\w|-)*)?' | ||
const applicationRegExp = new RegExp( | ||
`^${protocol}${host}/umsoknir/${applicationType}${applicationId}$`, | ||
) | ||
const pass = applicationRegExp.test(url) | ||
const message = () => | ||
`Current page is ${pass ? '' : '*not* '}an application | ||
Pattern ${applicationRegExp} | ||
URL is ${url}` | ||
return { message, pass } | ||
}, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a comment to explain the purpose of setting the
DIR
variable.+ # Set the directory of the current script DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
Committable suggestion