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

ci/ui: test filtering with lower and upper case #777

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions tests/cypress/latest/e2e/unit_tests/advanced_filtering.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ filterTests(['main'], () => {
});

it('Create fake machine inventories', () => {
// TODO: Use loop?
cy.importMachineInventory({machineInventoryFile: 'machine_inventory_1.yaml',
machineInventoryName: 'test-filter-one'});
cy.importMachineInventory({machineInventoryFile: 'machine_inventory_2.yaml',
machineInventoryName: 'test-filter-two'});
cy.importMachineInventory({machineInventoryFile: 'machine_inventory_3.yaml',
machineInventoryName: 'shouldnotmatch'});
let machineInventoryMap = new Map([
['machine_inventory_1', 'test-filter-one'],
['machine_inventory_2', 'test-filter-two'],
['machine_inventory_3', 'shouldnotmatch']
]);

machineInventoryMap.forEach((value, key) => {
cy.importMachineInventory({machineInventoryFile: key +'.yaml',
machineInventoryName: value});
});
});

it('Two machine inventories should appear by filtering on test-filter', () => {
Expand All @@ -56,11 +59,14 @@ filterTests(['main'], () => {
});

it('One machine inventory should appear by filtering on test-filter-one', () => {
// Only test-filter-one should appear with test-filter-one as filter
cy.checkFilter({filterName: 'test-filter-one',
testFilterOne: true,
testFilterTwo: false,
shouldNotMatch: false});
// Only test-filter-one should appear with test-filter-one and Test-Filter_One as filter
// Checking with lower and upper case make sure we are not hitting https://github.com/rancher/elemental/issues/627
['test-filter-one', 'Test-Filter-One'].forEach(filter => {
cy.checkFilter({filterName: filter,
testFilterOne: true,
testFilterTwo: false,
shouldNotMatch: false});
});
});

it('No machine inventory should appear by filtering on test-bad-filter', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/latest/fixtures/machine_inventory_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
annotations:
myInvAnnotation1: myInvAnnotationValue1
labels:
testfilter: test-filter-one
testfilter: Test-Filter-One
name: test-filter-one
namespace: fleet-default
spec:
Expand Down