Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit730c19a

Browse files
committed
Merge branch 'better-playwright-reporter' into emotional-damage-6
2 parentsa23213a +335593a commit730c19a

File tree

31 files changed

+760
-868
lines changed

31 files changed

+760
-868
lines changed

‎site/.eslintrc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ rules:
9191
-allowSingleExtends:true
9292
"brace-style":"off"
9393
"curly":["error", "all"]
94+
"eslint-comments/disable-enable-pair":
95+
-error
96+
-allowWholeFile:true
9497
"eslint-comments/require-description":"error"
9598
eqeqeq:error
9699
import/default:"off"

‎site/e2e/playwright.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const localURL = (port: number, path: string): string => {
1515
};
1616

1717
exportdefaultdefineConfig({
18+
preserveOutput:"failures-only",
1819
projects:[
1920
{
2021
name:"setup",

‎site/e2e/reporter.ts

Lines changed: 100 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,116 @@
1-
importfsfrom"fs";
1+
/* eslint-disable no-console -- Logging is sort of the whole point here */
2+
import*asfsfrom"fs";
23
importtype{
34
FullConfig,
45
Suite,
56
TestCase,
67
TestResult,
78
FullResult,
89
Reporter,
10+
TestError,
911
}from"@playwright/test/reporter";
1012
importaxiosfrom"axios";
13+
importtype{Writable}from"stream";
1114

1215
classCoderReporterimplementsReporter{
16+
config:FullConfig|null=null;
17+
testOutput=newMap<string,Array<[Writable,string]>>();
18+
passedCount=0;
19+
failedTests:TestCase[]=[];
20+
timedOutTests:TestCase[]=[];
21+
1322
onBegin(config:FullConfig,suite:Suite){
14-
// eslint-disable-next-line no-console -- Helpful for debugging
15-
console.log(`Starting the run with${suite.allTests().length} tests`);
23+
this.config=config;
24+
console.log(`==> Running${suite.allTests().length} tests`);
1625
}
1726

1827
onTestBegin(test:TestCase){
19-
// eslint-disable-next-line no-console -- Helpful for debugging
20-
console.log(`Starting test${test.title}`);
28+
this.testOutput.set(test.id,[]);
29+
console.log(`==>Starting test${test.title}`);
2130
}
2231

23-
onStdOut(chunk:string,test:TestCase,_:TestResult):void{
24-
// eslint-disable-next-line no-console -- Helpful for debugging
25-
console.log(
26-
`[stdout] [${test ?test.title :"unknown"}]:${chunk.replace(
27-
/\n$/g,
28-
"",
29-
)}`,
30-
);
32+
onStdOut(chunk:string,test?:TestCase,_?:TestResult):void{
33+
if(!test){
34+
constpreserve=this.config?.preserveOutput==="always";
35+
if(preserve){
36+
console.log(`[stdout]${chunk.replace(/\n$/g,"")}`);
37+
}
38+
return;
39+
}
40+
this.testOutput.get(test.id)!.push([process.stdout,chunk]);
3141
}
3242

33-
onStdErr(chunk:string,test:TestCase,_:TestResult):void{
34-
// eslint-disable-next-line no-console -- Helpful for debugging
35-
console.log(
36-
`[stderr] [${test ?test.title :"unknown"}]:${chunk.replace(
37-
/\n$/g,
38-
"",
39-
)}`,
40-
);
43+
onStdErr(chunk:string,test?:TestCase,_?:TestResult):void{
44+
if(!test){
45+
constpreserve=this.config?.preserveOutput==="always";
46+
if(preserve){
47+
console.error(`[stderr]${chunk.replace(/\n$/g,"")}`);
48+
}
49+
return;
50+
}
51+
this.testOutput.get(test.id)!.push([process.stderr,chunk]);
4152
}
4253

4354
asynconTestEnd(test:TestCase,result:TestResult){
44-
// eslint-disable-next-line no-console -- Helpful for debugging
45-
console.log(`Finished test${test.title}:${result.status}`);
55+
console.log(`==> Finished test${test.title}:${result.status}`);
56+
57+
if(result.status==="passed"){
58+
this.passedCount++;
59+
}
4660

47-
if(result.status!=="passed"){
48-
// eslint-disable-next-line no-console -- Helpful for debugging
49-
console.log("errors",result.errors,"attachments",result.attachments);
61+
if(result.status==="failed"){
62+
this.failedTests.push(test);
5063
}
64+
65+
if(result.status==="timedOut"){
66+
this.timedOutTests.push(test);
67+
}
68+
69+
constpreserve=this.config?.preserveOutput;
70+
constlogOutput=
71+
preserve==="always"||
72+
(result.status!=="passed"&&preserve!=="never");
73+
if(logOutput){
74+
console.log("==> Output");
75+
constoutput=this.testOutput.get(test.id)!;
76+
for(const[target,chunk]ofoutput){
77+
target.write(`${chunk.replace(/\n$/g,"")}\n`);
78+
}
79+
80+
if(result.errors.length>0){
81+
console.log("==> Errors");
82+
for(consterrorofresult.errors){
83+
reportError(error);
84+
}
85+
}
86+
87+
if(result.attachments.length>0){
88+
console.log("==> Attachments");
89+
for(constattachmentofresult.attachments){
90+
console.log(attachment);
91+
}
92+
}
93+
}
94+
this.testOutput.delete(test.id);
95+
5196
awaitexportDebugPprof(test.title);
5297
}
5398

5499
onEnd(result:FullResult){
55-
// eslint-disable-next-line no-console -- Helpful for debugging
56-
console.log(`Finished the run:${result.status}`);
100+
console.log(`==> Tests${result.status}`);
101+
console.log(`${this.passedCount} passed`);
102+
if(this.failedTests.length>0){
103+
console.log(`${this.failedTests.length} failed`);
104+
for(consttestofthis.failedTests){
105+
console.log(`${test.location.file}${test.title}`);
106+
}
107+
}
108+
if(this.timedOutTests.length>0){
109+
console.log(`${this.timedOutTests.length} timed out`);
110+
for(consttestofthis.timedOutTests){
111+
console.log(`${test.location.file}${test.title}`);
112+
}
113+
}
57114
}
58115
}
59116

@@ -72,7 +129,6 @@ const exportDebugPprof = async (testName: string) => {
72129
if(err){
73130
thrownewError(`Error writing to${outputFile}:${err.message}`);
74131
}else{
75-
// eslint-disable-next-line no-console -- Helpful for debugging
76132
console.log(`Data from${url} has been saved to${outputFile}`);
77133
}
78134
});
@@ -82,5 +138,20 @@ const exportDebugPprof = async (testName: string) => {
82138
});
83139
};
84140

141+
constreportError=(error:TestError)=>{
142+
if(error.location){
143+
console.log(`${error.location.file}:${error.location.line}:`);
144+
}
145+
if(error.snippet){
146+
console.log(error.snippet);
147+
}
148+
149+
if(error.message){
150+
console.log(error.message);
151+
}else{
152+
console.log(error);
153+
}
154+
};
155+
85156
// eslint-disable-next-line no-unused-vars -- Playwright config uses it
86157
exportdefaultCoderReporter;

‎site/src/components/Dashboard/Navbar/UserDropdown/BorderedMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import{css}from"@emotion/css";
22
import{useTheme}from"@emotion/react";
3-
importPopover,{PopoverProps}from"@mui/material/Popover";
3+
importPopover,{typePopoverProps}from"@mui/material/Popover";
44
importtype{FC,PropsWithChildren}from"react";
55

66
typeBorderedMenuVariant="user-dropdown";
@@ -18,7 +18,7 @@ export const BorderedMenu: FC<PropsWithChildren<BorderedMenuProps>> = ({
1818

1919
constpaper=css`
2020
width:260px;
21-
border-radius:${theme.shape.borderRadius};
21+
border-radius:${theme.shape.borderRadius}px;
2222
box-shadow:${theme.shadows[6]};
2323
`;
2424

‎site/src/components/DeploySettingsLayout/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const SidebarNavItem: FC<
4747
font-size:14px;
4848
text-decoration: none;
4949
padding:${theme.spacing(1.5,1.5,1.5,2)};
50-
border-radius:${theme.shape.borderRadius/2};
50+
border-radius:${theme.shape.borderRadius/2}px;
5151
transition: background-color0.15s ease-in-out;
5252
margin-bottom:1;
5353
position: relative;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp