Skip to content

Commit

Permalink
Merge pull request #83 from mbland/test-page-opener
Browse files Browse the repository at this point in the history
Replace test/page-loader.js with test-page-opener
  • Loading branch information
mbland committed Jan 6, 2024
2 parents 33e9fe5 + 4c1bdb8 commit b0f1709
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 356 deletions.
4 changes: 2 additions & 2 deletions strcalc/src/main/frontend/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* @module init
*/

import Introduction from './introduction'
import Calculator from './calculator'
import Introduction from './introduction.js'
import Calculator from './calculator.js'

export default class App {
/**
Expand Down
2 changes: 1 addition & 1 deletion strcalc/src/main/frontend/components/calculators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

import { postFormData } from './request'
import { postFormData } from './request.js'

export const DEFAULT_ENDPOINT = './add'

Expand Down
2 changes: 1 addition & 1 deletion strcalc/src/main/frontend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @module main
*/
import App from './components/app.js'
import calculators from './components/calculators'
import calculators from './components/calculators.js'

/**
* Calls the app initializer with production parameters.
Expand Down
14 changes: 8 additions & 6 deletions strcalc/src/main/frontend/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { describe, afterEach, expect, test } from 'vitest'
import { PageLoader } from './test/page-loader.js'
import StringCalculatorPage from './test/page'
import { afterEach, beforeAll, describe, expect, test } from 'vitest'
import StringCalculatorPage from './test/page.js'
import TestPageOpener from 'test-page-opener'

describe('String Calculator UI on initial page load', () => {
const loader = new PageLoader('/strcalc/')
afterEach(() => loader.closeAll())
let opener

beforeAll(async () => opener = await TestPageOpener.create('/strcalc/'))
afterEach(() => opener.closeAll())

test('contains the "Hello, World!" placeholder', async () => {
const { document } = await loader.load('index.html')
const { document } = await opener.open('index.html')
const appElem = document.querySelector('#app')

const e = new StringCalculatorPage(appElem, document).title()
Expand Down
1 change: 1 addition & 0 deletions strcalc/src/main/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"handlebars": "^4.7.8",
"jsdoc-cli-wrapper": "^1.0.4",
"jsdom": "^23.1.0",
"test-page-opener": "^1.0.3",
"vite": "^5.0.11",
"vitest": "^1.1.3",
"webdriverio": "^8.27.0"
Expand Down
10 changes: 10 additions & 0 deletions strcalc/src/main/frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b0f1709

Please sign in to comment.