SortTable bug (Test)?

So what I am trying to do is to test whether I can sort countries table.. If i were to test it physically it works as intended but with test it failed. error message:
at vendor\livewire\livewire\src\Features\SupportTesting\MakesAssertions.php:49
45▕ }
46▕
47▕ function assertSeeHtmlInOrder($values)
48▕ {
➜ 49▕ PHPUnit::assertThat(
50▕ $values,
51▕ new SeeInOrder($this->html())
52▕ );
53▕

1 vendor\livewire\livewire\src\Features\SupportTesting\MakesAssertions.php:49
2 vendor\filament\tables\src\Testing\TestsRecords.php:34
at vendor\livewire\livewire\src\Features\SupportTesting\MakesAssertions.php:49
45▕ }
46▕
47▕ function assertSeeHtmlInOrder($values)
48▕ {
➜ 49▕ PHPUnit::assertThat(
50▕ $values,
51▕ new SeeInOrder($this->html())
52▕ );
53▕

1 vendor\livewire\livewire\src\Features\SupportTesting\MakesAssertions.php:49
2 vendor\filament\tables\src\Testing\TestsRecords.php:34
the CountryResourceTest:
describe('can sort countries by: ', function () {
$columnsToTest = collect([
'name',
// 'code',
// 'phonecode',
]);

$columnsToTest->each(function ($columnName) {
it($columnName, function () use ($columnName) {
$countries = Country::limit(10)->get();

livewire(CountryResource\Pages\ListCountries::class)
->loadTable()
->sortTable($columnName)
->assertCanSeeTableRecords($countries->sortBy($columnName), inOrder: true)
->sortTable($columnName, 'desc')
->assertCanSeeTableRecords($countries->sortByDesc($columnName), inOrder: true);
});
});
});
describe('can sort countries by: ', function () {
$columnsToTest = collect([
'name',
// 'code',
// 'phonecode',
]);

$columnsToTest->each(function ($columnName) {
it($columnName, function () use ($columnName) {
$countries = Country::limit(10)->get();

livewire(CountryResource\Pages\ListCountries::class)
->loadTable()
->sortTable($columnName)
->assertCanSeeTableRecords($countries->sortBy($columnName), inOrder: true)
->sortTable($columnName, 'desc')
->assertCanSeeTableRecords($countries->sortByDesc($columnName), inOrder: true);
});
});
});
the CountryResource table:
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->sortable()
->searchable(),
... some other TextColumn
])
->deferLoading();
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->sortable()
->searchable(),
... some other TextColumn
])
->deferLoading();
}
3 Replies
Rolland
Rolland3mo ago
in addition to this. i do the same test for other resource and the results sometimes Pass and sometimes Failed.
JJSanders
JJSanders3mo ago
Can it be that it is b/c you test with a large dataset and then sometimes it manages to sort within the timeout boundary and sometimes not?
Rolland
Rolland3mo ago
that could be the reason but i believe i have limited the queries to 10.. hmm. is my code incorrect?
Want results from more Discord servers?
Add your server
More Posts
Spatie Media Library Plugin for FilamentPHP not generating responsive imagesIs responsive images feature a Pro feature? Just use the syntax is the docs: use Filament\Forms\CShow content inside a Table on ViewAction ModalHello. I've tried using info-list and Repeater to list the DNS records in my application but I crashAccessing related $record(s) in hasMany repeatersHi all I have a repeater that uses a hasMany relationship (via a pivot model). I need to access eacTextInput live onBlur does not seem to work as expectedI have this test and name field in my form: ```php Forms\Components\TextInput::make('test') ->maxLAm i misunderstanding relation managers?Hi all, I keep getting the below error ```Call to undefined method App\Models\Product::categories(How to correctly override the table container blade view?I need to change around some structural things in the table container, namely I need to group certaiFileupload Component Multiple Files froze buttons on the modalFacing an issue with the ->multiple() method in their Livewire Fileupload component. When this methoFail validation for multiple fieldsIs it possible to simultaneously trigger validation failures for multiple fields when a specific conFilament - Laravel Model compatibility issue and errorError when I try to implement `protected function handleRecordUpdate(Model $record, array $data): MoLaravel Vapor attempts to load `vendor/livewire/livewire.js` (and gets a 404).I'm having some issues after a recent PR merge on one of my projects. I believe the issue is with ho