Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit c85735f

Browse files
authored
Merge pull request #429 from true-runes/development
v15.3.0
2 parents 0c2c174 + 14d8566 commit c85735f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+341
-264
lines changed

.github/workflows/cypress.yml

+10-42
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,34 @@ on:
66
jobs:
77
cypress_gss2022_frontend:
88
name: Cypress での E2E テスト
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-22.04
10+
strategy:
11+
matrix:
12+
node-version: ["18.x"]
1013
steps:
1114
- name: Checkout
1215
uses: actions/[email protected]
13-
- name: 環境を確認する
14-
run: |
15-
echo '[$ pwd]'
16-
pwd
17-
echo '[$ ls -la]'
18-
ls -la
16+
- name: Node.js のセットアップ
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: yarn
1921
- name: 日本語フォントのインストールを行う
2022
run: |
2123
sudo apt install -y fonts-migmix
2224
- name: Cypress 用のパッケージをインストールする
2325
run: |
2426
sudo apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
25-
- name: libffi7 対策
26-
run: |
27-
sudo ln -s /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0 /usr/lib/x86_64-linux-gnu/libffi.so.6
28-
- name: Node.js をインストールする
29-
run: |
30-
curl -sSL "https://nodejs.org/dist/v18.2.0/node-v18.2.0-linux-x64.tar.xz" | tar --strip-components=2 -xJ -C /usr/local/bin/ node-v18.2.0-linux-x64/bin/node
31-
curl https://www.npmjs.com/install.sh | bash
32-
echo 'インストールされた Node.js のバージョンは、'
33-
node -v
34-
echo 'インストールされた npm のバージョンは、'
35-
npm -v
36-
- name: npm 自身をアップグレードする
37-
run: |
38-
echo 'アップグレード前の npm のバージョンは、'
39-
npm --version
40-
npm install -g npm
41-
echo 'アップグレード後の npm のバージョンは、'
42-
npm --version
4327
- name: npm-run-all をグローバルにインストールする
4428
run: |
4529
npm install -g npm-run-all
4630
- name: アーティファクト用のディレクトリを作成する
4731
run: |
4832
mkdir cypress/videos
4933
mkdir cypress/screenshots
50-
- name: Yarn のインストールを行う
51-
run: |
52-
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
53-
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
54-
sudo apt update -y
55-
sudo apt install -y yarn
56-
- name: Yarn のキャッシュのパスを取得する
57-
id: yarn-cache
58-
run: echo "::set-output name=dir::.yarn/cache"
59-
- name: Yarn のキャッシュファイルを取得する
60-
uses: actions/[email protected]
61-
with:
62-
path: ${{ steps.yarn-cache.outputs.dir }}
63-
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
64-
restore-keys: |
65-
${{ runner.os }}-yarn-
6634
- name: Npm のパッケージをインストールする ($ yarn install)
6735
run: |
68-
yarn install
36+
yarn install --frozen-lockfile
6937
- name: Cypress Info を実行する
7038
run: |
7139
npx cypress info

.github/workflows/node.js.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/setup-node@v3
1717
with:
1818
node-version: ${{ matrix.node-version }}
19-
cache: 'yarn'
19+
cache: yarn
2020
# Enable tmate debugging of manually-triggered workflows if the input option was provided
2121
- name: Setup tmate session
2222
uses: mxschmitt/action-tmate@v3

components/HumbergerMenu/Navigation.tsx

-26
This file was deleted.

components/EventSummary.tsx renamed to components/common/EventSummary.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { NextPage } from 'next'
2-
import { useLocale } from '../hooks/useLocale'
2+
import { useLocale } from '@/hooks/useLocale'
33

44
const EventSummary: NextPage = () => {
55
const { locale } = useLocale()

components/IllustratedBy.tsx renamed to components/common/IllustratedBy.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NextPage } from 'next'
2-
import TwitterIcon from '../components/Svg/TwitterIcon'
3-
import ExternalLink from '../components/Svg/ExternalLink'
4-
import { useLocale } from '../hooks/useLocale'
2+
import TwitterIcon from '@/components/svg/TwitterIcon'
3+
import ExternalLink from '@/components/svg/ExternalLink'
4+
import { useLocale } from '@/hooks/useLocale'
55

66
const IllustratedBy: NextPage = () => {
77
const { locale } = useLocale()

components/NavBar.tsx renamed to components/common/NavBar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NextPage } from 'next'
22
import Link from 'next/link'
33

4-
import { useLocale } from '../hooks/useLocale'
4+
import { useLocale } from '@/hooks/useLocale'
55

66
const NavBar: NextPage = () => {
77
const { t, locale } = useLocale()

components/SiteFooter.tsx renamed to components/common/SiteFooter.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NextPage } from 'next'
2-
import TwitterIcon from '../components/Svg/TwitterIcon'
3-
import ExternalLink from '../components/Svg/ExternalLink'
4-
import { useLocale } from '../hooks/useLocale'
2+
import TwitterIcon from '@/components/svg/TwitterIcon'
3+
import ExternalLink from '@/components/svg/ExternalLink'
4+
import { useLocale } from '@/hooks/useLocale'
55

66
const SiteFooter: NextPage = () => {
77
const { t } = useLocale()

components/Kikaku.tsx renamed to components/events-in-event/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { NextPage } from 'next'
22
import Link from 'next/link'
3-
import { useLocale } from '../hooks/useLocale'
3+
import { useLocale } from '@/hooks/useLocale'
44

5-
const Kikaku: NextPage = () => {
5+
const EventsInEventIndex: NextPage = () => {
66
const { locale } = useLocale()
77

88
return (
@@ -94,4 +94,4 @@ const Kikaku: NextPage = () => {
9494
)
9595
}
9696

97-
export default Kikaku
97+
export default EventsInEventIndex
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { NextPage } from 'next'
2+
3+
export const NumberOfWords: NextPage = () => {
4+
return (
5+
<>
6+
<h2 className="text-xl font-bold pb-4">文字数</h2>
7+
<div className="text-base text-center pb-4">
8+
<p className="pb-2">140字前後 ~ 上限なし</p>
9+
</div>
10+
</>
11+
)
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import type { NextPage } from 'next'
2+
import Link from 'next/link'
3+
4+
export const Themes: NextPage = () => {
5+
return (
6+
<>
7+
<h2 className="text-xl font-bold pb-4">お題</h2>
8+
<div className="text-base text-left pb-4">
9+
<div className="pb-4">
10+
① と ② は事前に募集したお題の中から選ばせていただきました。
11+
<br />
12+
事前募集で頂いたお題は{' '}
13+
<Link
14+
href="/events-in-event/novels-on-themes-application-results"
15+
passHref
16+
>
17+
<span className="link link-hover underline underline-offset-4 text-blue-500 hover:text-blue-900">
18+
こちら
19+
</span>
20+
</Link>
21+
</div>
22+
23+
<ul className="list-none pl-0 pr-2">
24+
<li className="pb-0">
25+
<span className="font-bold text-red-500">① 「記念」</span>
26+
</li>
27+
<li className="pb-0">
28+
<span className="font-bold text-red-500">② 「そういえば」</span>
29+
</li>
30+
<li className="pb-0">
31+
<span className="font-bold text-red-500">③ フリー(内容自由)</span>
32+
</li>
33+
</ul>
34+
</div>
35+
</>
36+
)
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { NextPage } from 'next'
2+
import { useLocale } from '@/hooks/useLocale'
3+
4+
export const WhatIsNovelsOnThemes: NextPage = () => {
5+
const { locale } = useLocale()
6+
7+
return (
8+
<>
9+
<h2 className="text-xl font-bold pb-4">
10+
{locale === 'ja' ? 'お題小説とは?' : 'What is themed short stories?'}
11+
</h2>
12+
<div className="text-base text-left pb-4">
13+
キャラとお題(テーマ)を選んで小説を書いていただき、ハッシュタグを付けてツイートする企画です。
14+
<br />
15+
イラストだけでなく文字書きの方も参加できる企画があれば…と思い、昨年より開始いたしました。
16+
</div>
17+
</>
18+
)
19+
}

components/HumbergerMenu/HumbergerNavigation.tsx renamed to components/humberger-menu/HumbergerNavigation.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { push as Menu } from 'react-burger-menu'
22
import Link from 'next/link'
3-
import PreviousWebsites from './PreviousWebsites'
4-
import { useLocale } from '../../hooks/useLocale'
3+
import PreviousWebsites from '@/components/humberger-menu/PreviousWebsites'
4+
import { useLocale } from '@/hooks/useLocale'
55

66
const Navigation = () => {
77
const { t, locale } = useLocale()

components/HumbergerMenu/PreviousWebsites.tsx renamed to components/humberger-menu/PreviousWebsites.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import PreviousWebsiteLink from './PreviousWebsiteLink'
2-
import { useLocale } from '../../hooks/useLocale'
1+
import PreviousWebsiteLink from '@/components/humberger-menu/PreviousWebsiteLink'
2+
import { useLocale } from '@/hooks/useLocale'
33

44
const PreviousWebsites = () => {
55
const { t, locale } = useLocale()
File renamed without changes.
File renamed without changes.

components/Dendouiri.tsx renamed to components/votes/Dendouiri.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { NextPage } from 'next'
2-
import { useLocale } from '../hooks/useLocale'
2+
import { useLocale } from '@/hooks/useLocale'
33

44
const Dendouiri: NextPage = () => {
55
const { locale } = useLocale()

components/Departments.tsx renamed to components/votes/Departments.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { NextPage } from 'next'
2-
import { useLocale } from '../hooks/useLocale'
2+
import { useLocale } from '@/hooks/useLocale'
33

44
const Departments: NextPage = () => {
55
const { locale } = useLocale()

components/HowToVote.tsx renamed to components/votes/HowToVote.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { NextPage } from 'next'
2-
import { useLocale } from '../hooks/useLocale'
2+
import { useLocale } from '@/hooks/useLocale'
33

44
const HowToVote: NextPage = () => {
55
const { locale } = useLocale()

components/Onegai.tsx renamed to components/votes/Onegai.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { NextPage } from 'next'
2-
import { useLocale } from '../hooks/useLocale'
2+
import { useLocale } from '@/hooks/useLocale'
33

44
const Onegai: NextPage = () => {
55
const { locale } = useLocale()

components/VoteExamples.tsx renamed to components/votes/VoteExamples.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { NextPage } from 'next'
22
import Image from 'next/image'
3-
import { useLocale } from '../hooks/useLocale'
3+
import { useLocale } from '@/hooks/useLocale'
44

55
const VoteExamples: NextPage = () => {
66
const { locale } = useLocale()
@@ -19,7 +19,7 @@ const VoteExamples: NextPage = () => {
1919
オールキャラ部門 投票例①
2020
</h2>
2121
<Image
22-
src="/vote_example_all_chara_01.png"
22+
src="/images/vote_example_all_chara_01.png"
2323
alt="オールキャラ部門 投票例 01"
2424
width={1166}
2525
height={336}
@@ -31,7 +31,7 @@ const VoteExamples: NextPage = () => {
3131
オールキャラ部門 投票例②
3232
</h2>
3333
<Image
34-
src="/vote_example_all_chara_02.png"
34+
src="/images/vote_example_all_chara_02.png"
3535
alt="オールキャラ部門 投票例 02"
3636
width={1176}
3737
height={480}

components/WhatIsGensosenkyo.tsx renamed to components/votes/WhatIsGensosenkyo.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { NextPage } from 'next'
2-
import { useLocale } from '../hooks/useLocale'
2+
import { useLocale } from '@/hooks/useLocale'
33

44
const WhatIsGensosenkyo: NextPage = () => {
55
const { locale } = useLocale()

cypress/e2e/events-in-event.spec.ts

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
describe('総選挙内企画のページ', () => {
2+
beforeEach(() => {
3+
cy.visit('/events-in-event')
4+
})
5+
6+
it('ページタイトルが期待どおりであること', () => {
7+
cy.url().should('equal', 'http://localhost:3100/events-in-event')
8+
9+
cy.get('title').should('have.text', '総選挙内企画 - 幻水総選挙2022')
10+
})
11+
12+
it('h1 タグ が期待どおりであること', () => {
13+
cy.url().should('equal', 'http://localhost:3100/events-in-event')
14+
15+
cy.get('h1').should('have.length', 1)
16+
cy.get('h1').eq(0).should('have.text', '総選挙内企画')
17+
})
18+
19+
it('li タグ が期待どおりであること', () => {
20+
cy.url().should('equal', 'http://localhost:3100/events-in-event')
21+
22+
// 単一コンポーネント内の li タグ
23+
cy.get('.hero li').should('have.length', 7)
24+
25+
cy.get('.hero li').then(($hero_and_li_elements) => {
26+
const texts = $hero_and_li_elements.map((_index, item) => {
27+
// 各要素に対して jQuery の text() を実行している
28+
return Cypress.$(item).text()
29+
})
30+
31+
// jQuery のラップを外して単純な Array にする
32+
const gotTexts = texts.get()
33+
34+
const expectedTexts = [
35+
'選挙運動',
36+
'開票イラスト幻水総選挙本',
37+
'幻水総選挙本',
38+
'お題小説',
39+
'推し台詞教えて!',
40+
'オープニングイラスト・クロージングイラスト',
41+
'ボーナス票',
42+
]
43+
44+
// Cypress のオブジェクトではないので expect を用いて比較している
45+
// そして配列なので deep.equal する
46+
expect(gotTexts).to.deep.equal(expectedTexts)
47+
})
48+
})
49+
})
50+
51+
describe('総選挙内企画のページ(英語版)', () => {
52+
beforeEach(() => {
53+
cy.visit('/en/events-in-event')
54+
})
55+
56+
it('ページタイトルが期待どおりであること', () => {
57+
cy.url().should('equal', 'http://localhost:3100/en/events-in-event')
58+
59+
cy.get('title').should('have.text', 'Projects - Gensosenkyo 2022')
60+
})
61+
62+
it('h1 タグ が期待どおりであること', () => {
63+
cy.url().should('equal', 'http://localhost:3100/en/events-in-event')
64+
65+
cy.get('h1').should('have.length', 1)
66+
cy.get('h1').eq(0).should('have.text', 'Projects')
67+
})
68+
})

0 commit comments

Comments
 (0)