Skip to content

Commit

Permalink
feat(test): try out tests on login (#1630)
Browse files Browse the repository at this point in the history
* fix: non-empty env var

* feat(test): try out tests on login

* fix
  • Loading branch information
FranGuam authored Mar 8, 2024
1 parent 2454f67 commit d269bc3
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 71 deletions.
2 changes: 1 addition & 1 deletion codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const config = {
{
[process.env.REACT_APP_HASURA_DEV_HTTPLINK!]: {
headers: {
"x-hasura-admin-secret": process.env.HASURA_GRAPHQL_ADMIN_SECRET,
"x-hasura-admin-secret": process.env.HASURA_GRAPHQL_ADMIN_SECRET!,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default defineConfig({
/* Run your local dev server before starting the tests */
webServer: {
command: "yarn start",
url: "http://localhost:3000/?source=test",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
},
});
2 changes: 1 addition & 1 deletion src/api/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const subscribe = async () => {
try {
subscription = await serviceWorker.pushManager.subscribe({
userVisibleOnly: true,
applicationServerKey: process.env.REACT_APP_PUSH_PUBLICKEY,
applicationServerKey: process.env.REACT_APP_PUSH_PUBLICKEY!,
});
} catch (err) {
console.log("Failed to subscribe the user: ", err);
Expand Down
2 changes: 1 addition & 1 deletion src/api/utils/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const generateThankLetter = async (
) => {
const templateData = await new Promise<any>((resolve) =>
PizZipUtils.getBinaryContent(
`${process.env.REACT_APP_STATIC_URL}/public/files/thankletter-template.docx`,
`${process.env.REACT_APP_STATIC_URL!}/public/files/thankletter-template.docx`,
(err: any, content: any) => resolve(content),
),
);
Expand Down
4 changes: 2 additions & 2 deletions src/app/ContestSite/PlaybackPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ const PlaybackPage: React.FC<ContestProps> = ({ mode, user }) => {
}
});

let projectUrl = process.env.REACT_APP_STATIC_URL + "/public/WebGL/THUAI6/";
let projectUrl = process.env.REACT_APP_STATIC_URL! + "/public/WebGL/THUAI6/";
let projectName = "THUAI6_WebGL";
if (Contest_id === "jump") {
projectUrl = process.env.REACT_APP_STATIC_URL + "/public/WebGL/Jump/";
projectUrl = process.env.REACT_APP_STATIC_URL! + "/public/WebGL/Jump/";
projectName = "JumpJump-Build";
}

Expand Down
46 changes: 23 additions & 23 deletions src/app/HomeSite/ContestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,39 +43,39 @@ const ContestPage: React.FC<PageProps> = ({ mode, user }) => {
<Center direction="column">
<Image
alt="队式十六——深蓝 (Deep Blue)"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/ts16.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/ts16.jpg`}
/>
队式十六——深蓝 (Deep Blue)
<br />
</Center>
<Center direction="column">
<Image
alt="队式十七——Stellar Craft"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/ts17.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/ts17.jpg`}
/>
队式十七——Stellar Craft
<br />
</Center>
<Center direction="column">
<Image
alt="队式十八——CPClash"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/ts18.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/ts18.jpg`}
/>
队式十八——CPClash
<br />
</Center>
<Center direction="column">
<Image
alt="队式十九"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/ts19.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/ts19.jpg`}
/>
2018 年,队式十九作为 A1 组比赛合并到 THU-AI 中
<br />
</Center>
<Center direction="column">
<Image
alt="队式二十——THU-AI 枪林弹雨组"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/ts20.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/ts20.jpg`}
/>
队式二十——THU-AI 枪林弹雨组
<br />
Expand All @@ -98,23 +98,23 @@ const ContestPage: React.FC<PageProps> = ({ mode, user }) => {
<Center direction="column">
<Image
alt="第十八届电子设计大赛——天赐良机"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/edc18.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/edc18.jpg`}
/>
第十八届电子设计大赛——天赐良机
<br />
</Center>
<Center direction="column">
<Image
alt="第十九届电子设计大赛——绿茵荣耀"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/edc19.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/edc19.jpg`}
/>
第十九届电子设计大赛——绿茵荣耀
<br />
</Center>
<Center direction="column">
<Image
alt="第二十届电子设计大赛——智圆行方"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/edc20.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/edc20.jpg`}
/>
第二十届电子设计大赛——智圆行方
<br />
Expand All @@ -139,13 +139,13 @@ const ContestPage: React.FC<PageProps> = ({ mode, user }) => {
<Col>
<Image
alt="2017 年硬件设计大赛作品 1"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/hwdc2017-1.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/hwdc2017-1.jpg`}
/>
</Col>
<Col>
<Image
alt="2017 年硬件设计大赛作品 2"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/hwdc2017-2.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/hwdc2017-2.jpg`}
/>
</Col>
</Row>
Expand All @@ -158,13 +158,13 @@ const ContestPage: React.FC<PageProps> = ({ mode, user }) => {
<Col>
<Image
alt="2018 年硬件设计大赛作品 1"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/hwdc2018-1.gif`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/hwdc2018-1.gif`}
/>
</Col>
<Col>
<Image
alt="2018 年硬件设计大赛作品 2"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/hwdc2018-2.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/hwdc2018-2.jpg`}
/>
</Col>
</Row>
Expand All @@ -177,13 +177,13 @@ const ContestPage: React.FC<PageProps> = ({ mode, user }) => {
<Col>
<Image
alt="2019 年硬件设计大赛作品 1"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/hwdc2019-1.gif`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/hwdc2019-1.gif`}
/>
</Col>
<Col>
<Image
alt="2019 年硬件设计大赛作品 2"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/hwdc2019-2.gif`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/hwdc2019-2.gif`}
/>
</Col>
</Row>
Expand Down Expand Up @@ -230,19 +230,19 @@ const ContestPage: React.FC<PageProps> = ({ mode, user }) => {
<br />
<Image
alt="多功能计算器 CalcPro"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/swdc2018-1.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/swdc2018-1.png`}
/>
多功能计算器 CalcPro
<br />
<Image
alt="简易操作系统 BASIC-OS1"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/swdc2018-2.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/swdc2018-2.jpg`}
/>
简易操作系统 BASIC-OS1
<br />
<Image
alt="校园网管理软件 .NetCampus"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/swdc2018-3.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/swdc2018-3.jpg`}
/>
校园网管理软件 .NetCampus
<br />
Expand All @@ -255,19 +255,19 @@ const ContestPage: React.FC<PageProps> = ({ mode, user }) => {
<br />
<Image
alt="音乐节奏游戏 TuneStory"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/swdc2019-1.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/swdc2019-1.png`}
/>
音乐节奏游戏 TuneStory
<br />
<Image
alt="三角形滤镜 LowPoly"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/swdc2019-2.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/swdc2019-2.png`}
/>
三角形滤镜 LowPoly
<br />
<Image
alt="在线多功能绘图"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/swdc2019-3.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/swdc2019-3.png`}
/>
在线多功能绘图
<br />
Expand Down Expand Up @@ -413,19 +413,19 @@ const ContestPage: React.FC<PageProps> = ({ mode, user }) => {
<Center direction="column">
<Image
alt="第十五届决赛"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/fic15.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/fic15.jpg`}
/>
第十五届决赛
<br />
<Image
alt="第十六届决赛"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/fic16.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/fic16.jpg`}
/>
第十六届决赛
<br />
<Image
alt="第十七届决赛"
src={`${process.env.REACT_APP_STATIC_URL}/public/images/fic17.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/fic17.jpg`}
/>
第十七届决赛
<br />
Expand Down
30 changes: 15 additions & 15 deletions src/app/HomeSite/DivisionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const DivisionPage: React.FC<PageProps> = ({ mode, user }) => {
<StyledTypography>
<Typography.Title level={2}>软件部</Typography.Title>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-software-group-photo-2023.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-software-group-photo-2023.jpg`}
alt="软件部集体照"
width="900"
/>
Expand All @@ -70,13 +70,13 @@ const DivisionPage: React.FC<PageProps> = ({ mode, user }) => {
<Row justify="space-around" align="middle">
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-software-training-1.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-software-training-1.png`}
alt="软件部培训 1"
/>
</Col>
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-software-training-2.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-software-training-2.png`}
alt="软件部培训 2"
/>
</Col>
Expand All @@ -95,7 +95,7 @@ const DivisionPage: React.FC<PageProps> = ({ mode, user }) => {
<StyledTypography>
<Typography.Title level={2}>硬件部</Typography.Title>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-hardware-group-photo.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-hardware-group-photo.png`}
alt="division-introduction-hardware-group"
/>
<br />
Expand All @@ -112,13 +112,13 @@ const DivisionPage: React.FC<PageProps> = ({ mode, user }) => {
<Row justify="space-around" align="middle">
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-hardware-contest-1.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-hardware-contest-1.png`}
alt="硬件设计大赛 1"
/>
</Col>
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-hardware-contest-2.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-hardware-contest-2.png`}
alt="硬件设计大赛 2"
/>
</Col>
Expand All @@ -132,13 +132,13 @@ const DivisionPage: React.FC<PageProps> = ({ mode, user }) => {
<Row justify="space-around" align="middle">
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-edc-1.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-edc-1.png`}
alt="电子设计大赛 1"
/>
</Col>
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-edc-2.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-edc-2.png`}
alt="电子设计大赛 2"
/>
</Col>
Expand Down Expand Up @@ -170,13 +170,13 @@ const DivisionPage: React.FC<PageProps> = ({ mode, user }) => {
<Row justify="space-around" align="middle">
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-project-1.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-project-1.png`}
alt="项目部 1"
/>
</Col>
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-project-2.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-project-2.png`}
alt="项目部 2"
/>
</Col>
Expand Down Expand Up @@ -214,13 +214,13 @@ const DivisionPage: React.FC<PageProps> = ({ mode, user }) => {
<Row justify="space-around" align="middle">
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-knowledge-contest-1.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-knowledge-contest-1.jpg`}
alt="新生信息知识竞赛 1"
/>
</Col>
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-knowledge-contest-2.jpg`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-knowledge-contest-2.jpg`}
alt="新生信息知识竞赛 2"
/>
</Col>
Expand Down Expand Up @@ -266,7 +266,7 @@ const DivisionPage: React.FC<PageProps> = ({ mode, user }) => {
<Row justify="space-between" align="middle">
<Col span={6}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-conference-1.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-conference-1.png`}
alt="科创年会 1"
style={{ marginRight: 24 }}
/>
Expand Down Expand Up @@ -294,13 +294,13 @@ const DivisionPage: React.FC<PageProps> = ({ mode, user }) => {
<Row justify="space-around" align="middle">
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-conference-2.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-conference-2.png`}
alt="科创年会 2"
/>
</Col>
<Col span={10}>
<Image
src={`${process.env.REACT_APP_STATIC_URL}/public/images/division-introduction-conference-3.png`}
src={`${process.env.REACT_APP_STATIC_URL!}/public/images/division-introduction-conference-3.png`}
alt="科创年会 3"
/>
</Col>
Expand Down
8 changes: 4 additions & 4 deletions src/app/HomeSite/NewsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ const news = [
{
title: "清华大学电子工程系学生科协",
content: "宽口径、厚基础,我们软硬皆通。",
image: `${process.env.REACT_APP_STATIC_URL}/public/images/eesast-group-photo-2023.jpg`,
image: `${process.env.REACT_APP_STATIC_URL!}/public/images/eesast-group-photo-2023.jpg`,
},
{
title: "“商汤杯”第二十一届电子设计大赛",
content: "本次电子设计大赛主题为“火线救援”。",
image: `${process.env.REACT_APP_STATIC_URL}/public/images/edc-2019-logo-background.png`,
image: `${process.env.REACT_APP_STATIC_URL!}/public/images/edc-2019-logo-background.png`,
},
{
title: "新生信息知识竞赛",
content:
"新生们登上信息学院的大舞台,凭借自己的知识与才智,展开一场激烈的角逐。",
image: `${process.env.REACT_APP_STATIC_URL}/public/images/knowledge-contest-2019.jpg`,
image: `${process.env.REACT_APP_STATIC_URL!}/public/images/knowledge-contest-2019.jpg`,
},
{
title: "硬件设计大赛",
content: "课赛结合,快速入门,感受硬件的魅力",
image: `${process.env.REACT_APP_STATIC_URL}/public/images/hardware-design-contest-2019.jpg`,
image: `${process.env.REACT_APP_STATIC_URL!}/public/images/hardware-design-contest-2019.jpg`,
},
];

Expand Down
3 changes: 2 additions & 1 deletion src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ const App: React.FC = () => {

const TourGuide = () => {
const [open, setOpen] = useState<boolean>(
localStorage.getItem("tour") !== "true",
localStorage.getItem("tour") !== "true" &&
process.env.NODE_ENV !== "development",
);
return (
<Tour
Expand Down
Loading

0 comments on commit d269bc3

Please sign in to comment.