This repository has been archived by the owner on Jan 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #360 from true-runes/development
v14.0.0
- Loading branch information
Showing
20 changed files
with
969 additions
and
916 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,18 @@ on: | |
branches: | ||
- main | ||
- development | ||
pull_request: | ||
branches: | ||
- main | ||
- development | ||
|
||
jobs: | ||
cypress_gss2022_frontend: | ||
name: Cypress での E2E テスト | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: 環境を確認する | ||
run: | | ||
echo '[$ pwd]' | ||
|
@@ -29,7 +34,7 @@ jobs: | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0 /usr/lib/x86_64-linux-gnu/libffi.so.6 | ||
- name: Node.js をインストールする | ||
run: | | ||
curl -sSL "https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-x64.tar.xz" | tar --strip-components=2 -xJ -C /usr/local/bin/ node-v16.14.2-linux-x64/bin/node | ||
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 | ||
curl https://www.npmjs.com/install.sh | bash | ||
echo 'インストールされた Node.js のバージョンは、' | ||
node -v | ||
|
@@ -59,7 +64,7 @@ jobs: | |
id: yarn-cache | ||
run: echo "::set-output name=dir::.yarn/cache" | ||
- name: Yarn のキャッシュファイルを取得する | ||
uses: actions/[email protected].2 | ||
uses: actions/[email protected].3 | ||
with: | ||
path: ${{ steps.yarn-cache.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} | ||
|
@@ -68,16 +73,24 @@ jobs: | |
- name: Npm のパッケージをインストールする ($ yarn install) | ||
run: | | ||
yarn install | ||
- name: Cypress Info を実行する | ||
run: | | ||
npx cypress info | ||
- name: Cypress を実行する | ||
uses: cypress-io/github-action@v3.1.0 | ||
uses: cypress-io/github-action@v4.0.0 | ||
with: | ||
start: npx cypress | ||
build: npx next build | ||
start: npx next start --port 3100 | ||
wait-on: 'http://localhost:3100' | ||
wait-on-timeout: 30 # seconds | ||
working-directory: ./ | ||
config-file: cypress.json | ||
config-file: cypress.config.ts | ||
record: false | ||
browser: chrome | ||
# browser: firefox | ||
# browser: edge | ||
env: | ||
DEPLOYMENT_ENVIRONMENT: production | ||
- name: Cypress のスクリーンショットをアップロードする | ||
uses: actions/[email protected] | ||
if: always() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
projectId: 'abc987', | ||
downloadsFolder: 'cypress/downloads', | ||
fixturesFolder: 'cypress/fixtures', | ||
screenshotsFolder: 'cypress/screenshots', | ||
videosFolder: 'cypress/videos', | ||
viewportWidth: 1000, | ||
viewportHeight: 660, | ||
retries: { | ||
runMode: 1, | ||
openMode: 0, | ||
}, | ||
e2e: { | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config) | ||
}, | ||
baseUrl: 'http://localhost:3100', | ||
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', | ||
}, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
describe('ホームページ', () => { | ||
beforeEach(() => { | ||
// const startSosenkyoDateTime = new Date( | ||
// new Date('2022-06-24 21:00:00').toLocaleString('ja-JP') | ||
// ).getTime() | ||
// cy.clock(startSosenkyoDateTime) | ||
|
||
cy.visit('/') | ||
}) | ||
|
||
it('期待どおりの挙動をすること', () => { | ||
cy.url().should('equal', 'http://localhost:3100/') | ||
|
||
cy.get('title').should('have.text', 'ホーム - 幻水総選挙2022') | ||
|
||
// h1 タグ | ||
cy.get('h1').should('have.length', 8) | ||
cy.get('h1').each((item, index, list) => { | ||
if (index === 0) { | ||
cy.wrap(item).should('have.text', '幻水総選挙って何?') | ||
} | ||
|
||
if (index === 6) { | ||
cy.wrap(item).should('have.text', 'お願い') | ||
} | ||
}) | ||
cy.contains('h1', /お願い/).should('have.length', 1) | ||
|
||
// h2 タグ | ||
cy.get('h2').then((div) => { | ||
cy.wrap(div.eq(0)).should('have.attr', 'class', 'text-xl font-bold pb-4') | ||
}) | ||
}) | ||
}) | ||
|
||
describe('ホームページ(投票期間中)', () => { | ||
beforeEach(() => { | ||
const startSosenkyoDateTime = new Date( | ||
new Date('2022-06-24 21:00:00').toLocaleString('ja-JP') | ||
).getTime() | ||
cy.clock(startSosenkyoDateTime) | ||
|
||
cy.visit('/') | ||
}) | ||
|
||
it('期待どおりの挙動をすること', () => { | ||
cy.url().should('equal', 'http://localhost:3100/') | ||
|
||
cy.get('title').should('have.text', 'ホーム - 幻水総選挙2022') | ||
|
||
// h1 タグ | ||
cy.get('h1').should('have.length', 8) | ||
cy.get('h1').each((item, index, list) => { | ||
if (index === 0) { | ||
cy.wrap(item).should('have.text', '幻水総選挙って何?') | ||
} | ||
|
||
if (index === 6) { | ||
cy.wrap(item).should('have.text', 'お願い') | ||
} | ||
}) | ||
cy.contains('h1', /お願い/).should('have.length', 1) | ||
|
||
// h2 タグ | ||
cy.get('h2').then((div) => { | ||
cy.wrap(div.eq(0)).should('have.attr', 'class', 'text-xl font-bold pb-4') | ||
}) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.