-
Notifications
You must be signed in to change notification settings - Fork 50
[DO NOT MERGE] flaky test investigation #3364
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
base: main
Are you sure you want to change the base?
Changes from 15 commits
9f23fb4
2c54408
efa0a8a
a277856
253b148
18ec891
dedeadc
431e2d1
b38a0bc
9393046
fa6e5ce
1e579dd
6ab7d5b
b0f1c7c
b071e74
a1a90fa
65bfa2a
71c8b1d
b22f578
b7b3490
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import { tracked } from '@glimmer/tracking'; | |
| import { guidFor } from '@ember/object/internals'; | ||
| import { service } from '@ember/service'; | ||
| import { modifier } from 'ember-modifier'; | ||
| import { isDestroyed, isDestroying } from '@ember/destroyable'; | ||
| import HdsAdvancedTableTableModel from './models/table.ts'; | ||
|
|
||
| import type Owner from '@ember/owner'; | ||
|
|
@@ -559,7 +560,7 @@ export default class HdsAdvancedTable extends Component<HdsAdvancedTableSignatur | |
|
|
||
| if (reorderedMessageText !== undefined) { | ||
| this.reorderedMessageText = reorderedMessageText; | ||
| } else { | ||
| } else if (!isDestroyed(this) && !isDestroying(this)) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fwiw: I tried a similar approach a while back and it seemed to solve the issue with |
||
| const newPosition = insertedAt + 1; | ||
| const translatedReorderedMessageText = this.hdsIntl.t( | ||
| 'hds.advanced-table.reordered-message', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| */ | ||
|
|
||
| import Service from '@ember/service'; | ||
| import { getOwner } from '@ember/owner'; | ||
| import { service } from '@ember/service'; | ||
| import { isPresent } from '@ember/utils'; | ||
| import { assert } from '@ember/debug'; | ||
|
|
||
|
|
@@ -18,18 +18,7 @@ export type HdsIntlTOptions = FormatMessageParameters[1] & { | |
| }; | ||
|
|
||
| export default class HdsIntlService extends Service { | ||
| get intl(): IntlService | undefined { | ||
| const owner = getOwner(this); | ||
|
|
||
| if ( | ||
| typeof owner?.factoryFor === 'function' && | ||
| owner.factoryFor('service:intl') | ||
| ) { | ||
| return owner.lookup('service:intl'); | ||
| } | ||
|
|
||
| return undefined; | ||
| } | ||
| @service('intl') declare intl: IntlService; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zamoore I think this is how we are supposed to do it but I'm not 100%, worth a check though.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this cause errors in codebases where
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would have, moved |
||
|
|
||
| t(key: string, options: HdsIntlTOptions): string { | ||
| const { default: defaultString, ...restOptions } = options; | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am still not sure how we'd actually test this w/o creating an engines situation...
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only tested in cloud-ui through RC, it only viable option without spinning another test app with engines, I guess we could create a failing test 🤔 in the showcase
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should be able to do an ember-try scenario |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,7 +376,8 @@ const hbsNestedAdvancedTable = hbs`<Hds::AdvancedTable | |
| </:body> | ||
| </Hds::AdvancedTable>`; | ||
|
|
||
| const hbsResizableColumnsAdvancedTable = hbs`<div style="width: 1000px;"> | ||
| const hbsResizableColumnsAdvancedTable = hbs`{{!-- template-lint-disable no-inline-styles --}} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're getting a lot of errors in our showcase and tests because we aren't taking the time to obey the linting rules or do types properly. Maybe this gets fixed with the refactor so we should just wait on it, but I've noted a few things just in case. |
||
| <div style="width: 1000px;"> | ||
| <Hds::AdvancedTable | ||
| @model={{this.model}} @columns={{this.columns}} @hasResizableColumns={{true}} id="resize-test-table" | ||
| > | ||
|
|
@@ -386,7 +387,7 @@ const hbsResizableColumnsAdvancedTable = hbs`<div style="width: 1000px;"> | |
| <B.Td>{{B.data.col2}}</B.Td> | ||
| </B.Tr> | ||
| </:body> | ||
| </Hds::AdvancedTable></div>`; | ||
| </Hds::AdvancedTable></div>{{!-- template-lint-enable no-inline-styles --}}`; | ||
|
|
||
| module('Integration | Component | hds/advanced-table/index', function (hooks) { | ||
| setupRenderingTest(hooks); | ||
|
|
@@ -727,10 +728,14 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) { | |
| ); | ||
| await focus(firstThElement); | ||
| await focus(firstReorderHandle); | ||
| // need to flush the frame to let the RAF waiter finish doing its thing | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is what we need but also not sure why we're finding three things in the DOM and then focusing on two things in direct succession before asserting anything. Do we need the first focus? Could we find and focus the |
||
| await new Promise((resolve) => requestAnimationFrame(resolve)); | ||
|
|
||
| assert.dom(firstReorderHandle).isFocused(); | ||
|
|
||
| await triggerKeyEvent(firstReorderHandle, 'keydown', 'ArrowRight'); | ||
| let columnOrder = await getColumnOrder(this.columns); | ||
| await settled(); | ||
| assert.deepEqual( | ||
| columnOrder, | ||
| [this.columns[1].key, this.columns[0].key, this.columns[2].key], | ||
|
|
@@ -740,6 +745,8 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) { | |
|
|
||
| await triggerKeyEvent(firstReorderHandle, 'keydown', 'ArrowRight'); | ||
| columnOrder = await getColumnOrder(this.columns); | ||
| // doing this because request animation frame stuff | ||
| await settled(); | ||
| assert.deepEqual( | ||
| columnOrder, | ||
| [this.columns[1].key, this.columns[2].key, this.columns[0].key], | ||
|
|
@@ -749,6 +756,7 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) { | |
|
|
||
| await triggerKeyEvent(firstReorderHandle, 'keydown', 'ArrowLeft'); | ||
| columnOrder = await getColumnOrder(this.columns); | ||
| await settled(); | ||
| assert.deepEqual( | ||
| columnOrder, | ||
| [this.columns[1].key, this.columns[0].key, this.columns[2].key], | ||
|
|
@@ -842,7 +850,7 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) { | |
| ]; | ||
|
|
||
| // when dealing with dynamic columns, you must handle the order of all potential columns rather than just the ones currently rendered | ||
| // inital column order is 'artist', 'album', 'year', 'genre' | ||
| // initial column order is 'artist', 'album', 'year', 'genre' | ||
| const initialColumnOrder = availableColumns.map((col) => col.key); | ||
|
|
||
| // initially set the columns in the reverse order to ensure the table respects the column order and ommit the genre column | ||
|
|
@@ -876,6 +884,7 @@ module('Integration | Component | hds/advanced-table/index', function (hooks) { | |
|
|
||
| // make sure the initial column order is correct based on the columnOrder | ||
| let columnOrder = await getColumnOrder(this.columns); | ||
| await settled(); | ||
| assert.deepEqual( | ||
| columnOrder, | ||
| ['artist', 'album', 'year'], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shleewhite since we talked about it today I didn't make a lot of changes BUT a lot of tests that were consistently failing stopped failing after adding the destroyed/destroying check.