Skip to content

Instantly share code, notes, and snippets.

@mpg-tomoya-komiyama
Created February 21, 2020 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpg-tomoya-komiyama/c8aa813f3ce65b55352e7726d4f39aa6 to your computer and use it in GitHub Desktop.
Save mpg-tomoya-komiyama/c8aa813f3ce65b55352e7726d4f39aa6 to your computer and use it in GitHub Desktop.
import { Selector } from 'testcafe'
function isWin() {
return process.platform.startsWith('win')
}
// IE11は画面内に要素が収まっていないと反応しないのでリサイズする
// macなどGUI環境だとwindow以上に大きくするとエラーになるのでwin環境に限定する
async function resizeWindow(t) {
if (isWin()) await t.resizeWindow(5000, 2000)
}
fixture`トップ画面から応募まで`.page`0.0.0.0:8080/`.beforeEach(async (t) => {
await resizeWindow(t)
})
test('PCトップ画面 -> 求人一覧画面', async (t) => {
await t
.click(Selector('button').withText('を表示する'))
.expect(getHref())
.contains('offers')
await t
.click(Selector('button').withText('詳細を見る'))
.expect(Selector('button').withText('応募する').exists)
.ok()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment