Skip to content

Commit

Permalink
Remove manual naming from screencaps,
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Brody committed Sep 16, 2024
1 parent 3906528 commit adf425d
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 70 deletions.
42 changes: 21 additions & 21 deletions react/test/article_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ fixture('longer article test')

test('california-article-test', async (t) => {
// screenshot path: images/first_test.png
await screencap(t, 'article/california')
await screencap(t)
})

test('neighboring-state-test', async (t) => {
await t.wait(1000)
await screencap(t, 'article/california-with-neighbors')
await screencap(t)
await t
.click(Selector('path').withAttribute('class', /tag-Arizona,_USA/))
await t.expect(getLocation())
Expand All @@ -33,7 +33,7 @@ fixture('shorter article test')
})

test('san-marino-article-test', async (t) => {
await screencap(t, 'article/san-marino')
await screencap(t)
})

test('editable-number', async (t) => {
Expand Down Expand Up @@ -86,7 +86,7 @@ test('lr-buttons', async (t) => {

test('san-marino-2010-health', async (t) => {
await check_textboxes(t, ['2010 Census', 'Health'])
await screencap(t, 'article/san-marino-2010-health')
await screencap(t)
})

test('uncheck-box-mobile', async (t) => {
Expand All @@ -98,10 +98,10 @@ test('uncheck-box-mobile', async (t) => {
await t.wait(1000)
await check_textboxes(t, ['Race'])

await screencap(t, 'article/remove_race_initial_mobile')
await screencap(t)
// refresh
await t.eval(() => { location.reload() })
await screencap(t, 'article/remove_race_refresh_mobile')
await screencap(t)
})

test('uncheck-box-desktop', async (t) => {
Expand All @@ -111,10 +111,10 @@ test('uncheck-box-desktop', async (t) => {
await t.wait(1000)
await check_textboxes(t, ['Race'])

await screencap(t, 'article/remove_race_initial_desktop')
await screencap(t)
// refresh
await t.eval(() => { location.reload() })
await screencap(t, 'article/remove_race_refresh_desktop')
await screencap(t)
})

test('simple', async (t) => {
Expand All @@ -124,11 +124,11 @@ test('simple', async (t) => {
await t.wait(1000)
await check_textboxes(t, ['Simple Ordinals'])

await screencap(t, 'article/simple-ordinals')
await screencap(t)
})

test('download-article', async (t) => {
await download_image(t, 'article/download-article')
await download_image(t)
})

test('create-comparison-from-article', async (t) => {
Expand All @@ -151,7 +151,7 @@ fixture('article universe selector test')
test('article-universe-selector-test', async (t) => {
await t
.click(Selector('img').withAttribute('class', 'universe-selector'))
await screencap(t, 'article-dropped-down-universe-selector')
await screencap(t)
await t
.click(
Selector('img')
Expand All @@ -171,15 +171,15 @@ fixture('article universe selector test international')
test('article-universe-selector-test', async (t) => {
await t
.click(Selector('img').withAttribute('class', 'universe-selector'))
await screencap(t, 'article-dropped-down-universe-selector-international')
await screencap(t)
await t
.click(
Selector('img')
.withAttribute('class', 'universe-selector-option')
.withAttribute('alt', 'India'))
await t.expect(getLocation())
.eql(`${TARGET}/article.html?longname=Delhi+%5BNew+Delhi%5D+Urban+Center%2C+India&universe=India`)
await screencap(t, 'article/delhi-india')
await screencap(t)
})

fixture('article universe navigation test')
Expand Down Expand Up @@ -216,7 +216,7 @@ test('article-universe-statistic-page', async (t) => {
.click(Selector('a').withText(/^Area$/))
await t.expect(getLocation())
.eql(`${TARGET}/statistic.html?statname=Area&article_type=City&start=821&amount=20&universe=California%2C+USA`)
await screencap(t, 'statistics/universe-statistic-page')
await screencap(t)
})

test('article-universe-related-button', async (t) => {
Expand Down Expand Up @@ -246,7 +246,7 @@ test('article-universe-compare', async (t) => {
.eql(
`${TARGET}/comparison.html?longnames=%5B%22San+Marino+city%2C+California%2C+USA%22%2C%22San+Francisco+city%2C+California%2C+USA%22%5D&universe=California%2C+USA`,
)
await screencap(t, 'comparison/universe-compare')
await screencap(t)
})

test('article-universe-compare-different', async (t) => {
Expand All @@ -259,7 +259,7 @@ test('article-universe-compare-different', async (t) => {
.eql(
`${TARGET}/comparison.html?longnames=%5B%22San+Marino+city%2C+California%2C+USA%22%2C%22Chicago+city%2C+Illinois%2C+USA%22%5D`,
)
await screencap(t, 'comparison/universe-compare-different')
await screencap(t)
})

fixture('article universe state test')
Expand All @@ -281,7 +281,7 @@ test('article-universe-state-world', async (t) => {
await t.expect(getLocation())
.eql(`${TARGET}/article.html?longname=California%2C+USA&universe=world`)
// screenshot
await screencap(t, 'article/california-world')
await screencap(t)
})

fixture('article universe state from subnational test')
Expand All @@ -292,13 +292,13 @@ fixture('article universe state from subnational test')
})

test('article-universe-state-from-subnational', async (t) => {
await screencap(t, 'article/kerala-india')
await screencap(t)
// click the > button
await t
.click(Selector('a').withText('>'))
await t.expect(getLocation())
.eql(`${TARGET}/article.html?longname=California%2C+USA&universe=world`)
await screencap(t, 'article/california-world-from-kerala')
await screencap(t)
})

fixture('all stats test')
Expand All @@ -312,7 +312,7 @@ test('california-all-stats', async (t) => {
await t.resizeWindow(1400, 800)
await t.eval(() => { location.reload() })
await check_all_category_boxes(t)
await screencap(t, 'article/california-all-stats')
await screencap(t)
})

// selected because the gz changed in statistic classes
Expand All @@ -327,5 +327,5 @@ test('charlotte-all-stats', async (t) => {
await t.resizeWindow(1400, 800)
await t.eval(() => { location.reload() })
await check_all_category_boxes(t)
await screencap(t, 'article/charlotte-all-stats')
await screencap(t)
})
14 changes: 7 additions & 7 deletions react/test/comparison_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ fixture('comparison test heterogenous')
test('comparison-3-desktop-heterogenous', async (t) => {
await t.resizeWindow(1400, 800)
await t.eval(() => { location.reload() })
await screencap(t, 'comparison/heterogenous-comparison-desktop')
await screencap(t)
})

test('comparison-3-mobile-heterogenous', async (t) => {
await t.resizeWindow(400, 800)
await t.eval(() => { location.reload() })
await screencap(t, 'comparison/heterogenous-comparison-mobile')
await screencap(t)
})

fixture('comparison test homogenous (2)')
Expand All @@ -35,7 +35,7 @@ fixture('comparison test homogenous (2)')
test('comparison-2-mobile', async (t) => {
await t.resizeWindow(400, 800)
await t.eval(() => { location.reload() })
await screencap(t, 'comparison/basic-comparison-2-mobile')
await screencap(t)
})

fixture('comparison test homogenous (3)')
Expand All @@ -47,19 +47,19 @@ fixture('comparison test homogenous (3)')
test('comparison-3-desktop', async (t) => {
await t.resizeWindow(1400, 800)
await t.eval(() => { location.reload() })
await screencap(t, 'comparison/basic-comparison-desktop')
await screencap(t)
})

test('comparison-3-mobile', async (t) => {
await t.resizeWindow(400, 800)
await t.eval(() => { location.reload() })
await screencap(t, 'comparison/basic-comparison-mobile')
await screencap(t)
})

test('comparison-3-download', async (t) => {
await t.resizeWindow(1400, 800)
await t.eval(() => { location.reload() })
await download_image(t, 'comparison/download-comparison')
await download_image(t)
})

test('comparison-3-add', async (t) => {
Expand Down Expand Up @@ -123,5 +123,5 @@ fixture('plotted-across-180')
test('comparison-3-plotted-across-180', async (t) => {
await t.resizeWindow(1400, 800)
await t.eval(() => { location.reload() })
await screencap(t, 'comparison/plotted-across-180')
await screencap(t)
})
14 changes: 7 additions & 7 deletions react/test/histogram_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test('histogram-basic-article', async (t) => {
await t.eval(() => { location.reload() })
await t.click(Selector('.expand-toggle'))
await download_or_check_histogram(t, 'histogram-basic-article')
await screencap(t, 'histogram/histogram-basic-article')
await screencap(t)
})

test('histogram-basic-article-multi', async (t) => {
Expand All @@ -56,8 +56,8 @@ test('histogram-basic-article-multi', async (t) => {
for (let i = 0; i < count; i++) {
await t.click(Selector('.expand-toggle').nth(i))
}
await screencap(t, 'histogram/histogram-basic-article-multi')
await download_image(t, 'histogram/histogram-basic-article-multi-screenshot')
await screencap(t)
await download_image(t)
await download_histogram(t, 'histogram/histogram-basic-article-multi-histogram-0', 0)
await download_histogram(t, 'histogram/histogram-basic-article-multi-histogram-1', 1)
})
Expand All @@ -74,7 +74,7 @@ test('histogram-basic-comparison', async (t) => {
// select element with class name `expand-toggle`
await t.click(Selector('.expand-toggle'))
await download_or_check_histogram(t, 'histogram-basic-comparison')
await screencap(t, 'histogram/histogram-basic-comparison')
await screencap(t)
})

fixture('comparison test heterogenous with nan')
Expand All @@ -89,7 +89,7 @@ test('histogram-basic-comparison-nan', async (t) => {
// select element with class name `expand-toggle`
await t.click(Selector('.expand-toggle'))
await download_or_check_histogram(t, 'histogram-basic-comparison-nan')
await screencap(t, 'histogram/histogram-basic-comparison-nan')
await screencap(t)
})

fixture('comparison test heterogenous with nan in the middle')
Expand All @@ -104,7 +104,7 @@ test('histogram-basic-comparison-nan-middle', async (t) => {
// select element with class name `expand-toggle`
await t.click(Selector('.expand-toggle'))
await download_or_check_histogram(t, 'histogram-basic-comparison-nan-middle')
await screencap(t, 'histogram/histogram-basic-comparison-nan-middle')
await screencap(t)
})

fixture('comparison ordering test')
Expand All @@ -116,5 +116,5 @@ fixture('comparison ordering test')
test('histogram-ordering', async (t) => {
await t.click(Selector('.expand-toggle'))
await download_or_check_histogram(t, 'histogram-ordering')
await screencap(t, 'histogram/histogram-ordering')
await screencap(t)
})
4 changes: 2 additions & 2 deletions react/test/mapper_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fixture('mapping')
})

test('state-map', async (t) => {
await screencap(t, 'state-map')
await screencap(t)
await check_geojson(t, 'state-map-geojson')
})

Expand All @@ -36,6 +36,6 @@ test('mapping-more-complex', async (t) => {
await t.resizeWindow(1400, 800)
await t.eval(() => { location.reload() })
await t.wait(5000)
await screencap(t, 'mapping-more-complex')
await screencap(t)
await check_geojson(t, 'mapping-more-complex-geojson')
})
18 changes: 9 additions & 9 deletions react/test/quiz_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,21 @@ quiz_fixture(
test('quiz-clickthrough-test', async (t) => {
await click_button(t, 'a')
await t.wait(2000)
await quiz_screencap(t, 'quiz/clickthrough-1')
await quiz_screencap(t)
await click_button(t, 'b')
await t.wait(2000)
await quiz_screencap(t, 'quiz/clickthrough-2')
await quiz_screencap(t)
await click_button(t, 'a')
await t.wait(2000)
await quiz_screencap(t, 'quiz/clickthrough-3')
await quiz_screencap(t)
await click_button(t, 'b')
await t.wait(2000)
await quiz_screencap(t, 'quiz/clickthrough-4')
await quiz_screencap(t)
await click_button(t, 'a')
await t.wait(2000)
await t.eval(() => { document.getElementById('quiz-timer')!.remove() })
await t.wait(3000)
await quiz_screencap(t, 'quiz/clickthrough-5')
await quiz_screencap(t)
const quiz_history: unknown = await t.eval(() => {
return JSON.stringify(JSON.parse(localStorage.getItem('quiz_history')!))
})
Expand Down Expand Up @@ -215,7 +215,7 @@ quiz_fixture(
test('quiz-percentage-correct', async (t) => {
await t.eval(() => { location.reload() })
await click_buttons(t, ['a', 'a', 'a', 'a', 'a'])
await quiz_screencap(t, 'quiz/percentage-correct')
await quiz_screencap(t)
await t.expect(await juxtastat_table()).eql(
`${Array.from(Array(30).keys()).map(i => `${i + 30}|99|101`).join('\n')}\n` + `7|99|15\n`,
)
Expand All @@ -228,7 +228,7 @@ test('quiz-percentage-correct', async (t) => {
})
await t.eval(() => { location.reload() })
await click_buttons(t, ['a', 'a', 'a', 'a', 'a'])
await quiz_screencap(t, 'quiz/percentage-correct-2')
await quiz_screencap(t)
await t.expect(await juxtastat_table()).eql(
`${Array.from(Array(30).keys()).map(i => `${i + 30}|99|101`).join('\n')}\n` + `7|99|15\n` + `8|99|15\n`,
)
Expand Down Expand Up @@ -339,7 +339,7 @@ test('quiz-results-test', async (t) => {
await t.eval(() => { location.reload() })
await t.wait(1000)
await t.eval(() => { location.reload() })
await quiz_screencap(t, 'quiz/results-page')
await quiz_screencap(t)
await check_text(t, 'Excellent! 😊 4/5', '🟩🟩🟩🟩🟥')
})

Expand Down Expand Up @@ -380,7 +380,7 @@ fixture('several quiz results')

test('several-quiz-results-test', async (t) => {
await t.eval(() => { location.reload() })
await quiz_screencap(t, 'quiz/results-page-several')
await quiz_screencap(t)
// true true true true false
await check_text(t, 'Excellent! 😊 4/5', '🟩🟩🟩🟩🟥')
// go to the next quiz via changing the href
Expand Down
10 changes: 5 additions & 5 deletions react/test/search_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('search-test', async (t) => {
await t
.click(SEARCH_FIELD)
.typeText(SEARCH_FIELD, 'Pasadena')
await screencap(t, 'search/san-marino-search-pasadena')
await screencap(t)
await t
.pressKey('enter')
await t.expect(getLocation())
Expand All @@ -23,21 +23,21 @@ test('search-test-with-extra-char', async (t) => {
await t
.click(SEARCH_FIELD)
.typeText(SEARCH_FIELD, 'Pasadena c')
await screencap(t, 'search/san-marino-search-pasadena-c')
await screencap(t)
})

test('search-test-with-special-chars', async (t) => {
await t
.click(SEARCH_FIELD)
.typeText(SEARCH_FIELD, 'Utt')
await screencap(t, 'search/san-marino-search-Utt')
await screencap(t)
})

test('search-test-different-first-char', async (t) => {
await t
.click(SEARCH_FIELD)
.typeText(SEARCH_FIELD, 'hina')
await screencap(t, 'search/san-marino-search-hina')
await screencap(t)
})

test('search-test-arrows', async (t) => {
Expand All @@ -50,7 +50,7 @@ test('search-test-arrows', async (t) => {
await t
.pressKey('down')
.pressKey('down')
await screencap(t, 'search/san-marino-search-pasadena-down-down')
await screencap(t)
await t
.pressKey('enter')
await t.expect(getLocation())
Expand Down
Loading

0 comments on commit adf425d

Please sign in to comment.