Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
194200ca
Commit
194200ca
authored
Dec 14, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
profile tests
parent
8d6f06f3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
118 additions
and
0 deletions
+118
-0
profile.ts
mocks/user/profile.ts
+6
-0
ColorModeToggler.tsx
ui/snippets/header/ColorModeToggler.tsx
+1
-0
ProfileMenuDesktop.pw.tsx
ui/snippets/profileMenu/ProfileMenuDesktop.pw.tsx
+56
-0
ProfileMenuMobile.pw.tsx
ui/snippets/profileMenu/ProfileMenuMobile.pw.tsx
+55
-0
ProfileMenuDesktop.pw.tsx_dark-color-mode_auth-dark-mode-1.png
...leMenuDesktop.pw.tsx_dark-color-mode_auth-dark-mode-1.png
+0
-0
ProfileMenuDesktop.pw.tsx_default_auth-dark-mode-1.png
...__/ProfileMenuDesktop.pw.tsx_default_auth-dark-mode-1.png
+0
-0
ProfileMenuMobile.pw.tsx_default_auth-base-view-1.png
...s__/ProfileMenuMobile.pw.tsx_default_auth-base-view-1.png
+0
-0
ProfileMenuMobile.pw.tsx_default_auth-base-view-2.png
...s__/ProfileMenuMobile.pw.tsx_default_auth-base-view-2.png
+0
-0
ProfileMenuMobile.pw.tsx_default_no-auth-1.png
...eenshots__/ProfileMenuMobile.pw.tsx_default_no-auth-1.png
+0
-0
No files found.
mocks/user/profile.ts
0 → 100644
View file @
194200ca
export
const
base
=
{
avatar
:
'
https://avatars.githubusercontent.com/u/22130104
'
,
email
:
'
tom@ohhhh.me
'
,
name
:
'
tom goriunov
'
,
nickname
:
'
tom2drum
'
,
};
ui/snippets/header/ColorModeToggler.tsx
View file @
194200ca
...
...
@@ -89,6 +89,7 @@ const ColorModeToggler = forwardRef<ColorModeTogglerProps, 'input'>((props, ref)
<
chakra
.
div
{
...
getCheckboxProps
()
}
__css=
{
trackStyles
}
aria
-
label=
"Toggle color mode"
>
<
Icon
boxSize=
{
4
}
...
...
ui/snippets/profileMenu/ProfileMenuDesktop.pw.tsx
0 → 100644
View file @
194200ca
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
*
as
profileMock
from
'
mocks/user/profile
'
;
import
authFixture
from
'
playwright/fixtures/auth
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
ProfileMenuDesktop
from
'
./ProfileMenuDesktop
'
;
test
(
'
no auth
'
,
async
({
mount
,
page
})
=>
{
const
hooksConfig
=
{
router
:
{
asPath
:
'
/
'
,
},
};
const
component
=
await
mount
(
<
TestApp
>
<
ProfileMenuDesktop
/>
</
TestApp
>,
{
hooksConfig
},
);
await
component
.
locator
(
'
.identicon
'
).
click
();
expect
(
page
.
url
()).
toBe
(
'
http://localhost:3100/auth/auth0?path=%2F
'
);
});
test
.
describe
(
'
auth
'
,
()
=>
{
const
extendedTest
=
test
.
extend
({
context
:
({
context
},
use
)
=>
{
authFixture
(
context
);
use
(
context
);
},
});
extendedTest
(
'
+@dark-mode
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
/node-api/account/profile
'
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
profileMock
.
base
),
}));
await
page
.
route
(
profileMock
.
base
.
avatar
,
(
route
)
=>
{
return
route
.
fulfill
({
status
:
200
,
path
:
'
./playwright/image_s.jpg
'
,
});
});
const
component
=
await
mount
(
<
TestApp
>
<
ProfileMenuDesktop
/>
</
TestApp
>,
);
await
component
.
getByAltText
(
/Profile picture/i
).
click
();
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
250
,
height
:
550
}
});
});
});
ui/snippets/profileMenu/ProfileMenuMobile.pw.tsx
0 → 100644
View file @
194200ca
import
{
test
,
expect
,
devices
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
*
as
profileMock
from
'
mocks/user/profile
'
;
import
authFixture
from
'
playwright/fixtures/auth
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
ProfileMenuMobile
from
'
./ProfileMenuMobile
'
;
test
.
use
({
viewport
:
devices
[
'
iPhone 13 Pro
'
].
viewport
});
test
(
'
no auth
'
,
async
({
mount
,
page
})
=>
{
const
component
=
await
mount
(
<
TestApp
>
<
ProfileMenuMobile
/>
</
TestApp
>,
);
await
component
.
locator
(
'
.identicon
'
).
click
();
await
expect
(
page
).
toHaveScreenshot
();
});
test
.
describe
(
'
auth
'
,
()
=>
{
const
extendedTest
=
test
.
extend
({
context
:
({
context
},
use
)
=>
{
authFixture
(
context
);
use
(
context
);
},
});
extendedTest
(
'
base view
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
/node-api/account/profile
'
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
profileMock
.
base
),
}));
await
page
.
route
(
profileMock
.
base
.
avatar
,
(
route
)
=>
{
return
route
.
fulfill
({
status
:
200
,
path
:
'
./playwright/image_s.jpg
'
,
});
});
const
component
=
await
mount
(
<
TestApp
>
<
ProfileMenuMobile
/>
</
TestApp
>,
);
await
component
.
getByAltText
(
/Profile picture/i
).
click
();
await
expect
(
page
).
toHaveScreenshot
();
await
page
.
locator
(
'
div[aria-label="Toggle color mode"]
'
).
click
();
await
expect
(
page
).
toHaveScreenshot
();
});
});
ui/snippets/profileMenu/__screenshots__/ProfileMenuDesktop.pw.tsx_dark-color-mode_auth-dark-mode-1.png
0 → 100644
View file @
194200ca
25.9 KB
ui/snippets/profileMenu/__screenshots__/ProfileMenuDesktop.pw.tsx_default_auth-dark-mode-1.png
0 → 100644
View file @
194200ca
26.4 KB
ui/snippets/profileMenu/__screenshots__/ProfileMenuMobile.pw.tsx_default_auth-base-view-1.png
0 → 100644
View file @
194200ca
25.7 KB
ui/snippets/profileMenu/__screenshots__/ProfileMenuMobile.pw.tsx_default_auth-base-view-2.png
0 → 100644
View file @
194200ca
26.2 KB
ui/snippets/profileMenu/__screenshots__/ProfileMenuMobile.pw.tsx_default_no-auth-1.png
0 → 100644
View file @
194200ca
7.6 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment