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

StringCalculatorPage autogenerates app element IDs #53

Merged
merged 1 commit into from
Dec 17, 2023

Conversation

mbland
Copy link
Owner

@mbland mbland commented Dec 17, 2023

StringCalculatorPage.new() works well, but I realized two things:

  • I could autogenerate app element IDs using monotonically increasing numbers, eliminating the need for an appElemId argument.

  • Creating and destroying a new <div> for every test case seemed to start slowing the tests down.

Now the guidance isn't to call StringCalculatorPage.cleanup() in afterEach, but to use the pattern:

describe('initial state after calling initApp', () => {
  const page = StringCalculatorPage.new()

  afterEach(() => page.clear())
  afterAll(() => page.remove())

StringCalculatorPage.new() works well, but I realized two things:

- I could autogenerate app element IDs using monotonically increasing
  numbers, eliminating the need for an appElemId argument.

- Creating and destroying a new <div> for every test case seemed to
  start slowing the tests down.

Now the guidance isn't to call StringCalculatorPage.cleanup() in
afterEach, but to use the pattern:

```js
describe('initial state after calling initApp', () => {
  const page = StringCalculatorPage.new()

  afterEach(() => page.clear())
  afterAll(() => page.remove())
```
@mbland mbland self-assigned this Dec 17, 2023
@mbland mbland merged commit 5fb43ea into main Dec 17, 2023
3 checks passed
@mbland mbland deleted the stringcalculatorpage-auto-appelemids branch December 17, 2023 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant