Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actionsで落ちるテストの待ち時間を長くした #240

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cypress/integration/modal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ describe('Modal', () => {
context('when the user clicks "move to next stage" button', () => {
it('moves to stage 2', () => {
cy.visit('/stages/1')
cy.wait(750)
cy.wait(2000)
clearStage()
cy.wait(750)
cy.wait(2000)
cy.findByTestId('move-to-next-stage-button').click()
cy.wait(750)
cy.wait(2000)
cy.url().should('eq', Cypress.config().baseUrl + '/stages/2')
})
})
Expand All @@ -65,11 +65,11 @@ describe('Modal', () => {
it('moves to review 1', () => {
cy.setLocalStorage('gorogoropanda.com/clearedStage', 'u51');
cy.visit('/stages/10')
cy.wait(750)
cy.wait(2000)
clearStage()
cy.wait(750)
cy.wait(2000)
cy.findByTestId('move-to-next-stage-button').click()
cy.wait(750)
cy.wait(2000)
cy.url().should('eq', Cypress.config().baseUrl + '/reviews/1')
})
})
Expand All @@ -80,11 +80,11 @@ describe('Modal', () => {
it('moves to the finale page', () => {
cy.setLocalStorage('gorogoropanda.com/clearedStage', 'ttw');
cy.visit('/reviews/1')
cy.wait(2000)
cy.wait(6000)
clearReview()
cy.wait(2000)
cy.wait(6000)
cy.findByTestId('move-to-next-stage-button').click()
cy.wait(2000)
cy.wait(6000)
cy.url().should('eq', Cypress.config().baseUrl + '/thank-you-for-playing')
})
})
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/stage_select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ describe('Stage select', () => {
context('when the user clicks stage 1 panel', () => {
it('moves to stage 1', () => {
cy.visit('/')
cy.wait(2000)
cy.wait(8000)
cy.findByTestId('stage-panel-1').click()
cy.wait(2000)
cy.wait(8000)
cy.url().should('eq', Cypress.config().baseUrl + '/stages/1')
})
})
Expand Down
10 changes: 5 additions & 5 deletions cypress/integration/url_access.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe('URL access', () => {
context('when the user accesses stage 1 URL', () => {
it('moves to stage 1', () => {
cy.visit('/stages/1')
cy.wait(750)
cy.wait(10000)
cy.url().should('eq', Cypress.config().baseUrl + '/stages/1')
})
})
Expand All @@ -11,7 +11,7 @@ describe('URL access', () => {
context('if stage 1 is not cleared yet', () => {
it('gets redirected home', () => {
cy.visit('/stages/2')
cy.wait(750)
cy.wait(10000)
cy.url().should('eq', Cypress.config().baseUrl + '/')
})
})
Expand All @@ -30,7 +30,7 @@ describe('URL access', () => {
context('if no stages are cleared yet', () => {
it('gets redirected home', () => {
cy.visit('/reviews/1')
cy.wait(750)
cy.wait(25000)
cy.url().should('eq', Cypress.config().baseUrl + '/')
})
})
Expand All @@ -39,7 +39,7 @@ describe('URL access', () => {
it('gets redirected home', () => {
cy.setLocalStorage('gorogoropanda.com/clearedStage', 'u51');
cy.visit('/reviews/1')
cy.wait(750)
cy.wait(25000)
cy.url().should('eq', Cypress.config().baseUrl + '/')
})
})
Expand All @@ -48,7 +48,7 @@ describe('URL access', () => {
it('moves to review 1', () => {
cy.setLocalStorage('gorogoropanda.com/clearedStage', 'ttw');
cy.visit('/reviews/1')
cy.wait(750)
cy.wait(5000)
cy.url().should('eq', Cypress.config().baseUrl + '/reviews/1')
})
})
Expand Down
16 changes: 16 additions & 0 deletions cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@ import './commands'
// @see https://github.com/testing-library/cypress-testing-library#config-testidattribute
import { configure } from '@testing-library/cypress'
configure({ testIdAttribute: 'data-testid' })

Cypress.on('window:before:load', function (window) {
const original = window.EventTarget.prototype.addEventListener

window.EventTarget.prototype.addEventListener = function () {
if (arguments && arguments[0] === 'beforeunload') {
return
}
return original.apply(this, arguments)
}

Object.defineProperty(window, 'onbeforeunload', {
get: function () { },
set: function () { }
})
})
Loading