Skip to content

Commit

Permalink
ci/ui: test filtering with lower and upper case
Browse files Browse the repository at this point in the history
  • Loading branch information
juadk committed Apr 6, 2023
1 parent f3396ab commit 0824534
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
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

0 comments on commit 0824534

Please sign in to comment.