Skip to content
Snippets Groups Projects
Unverified Commit df0d235d authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

Attempt to fix GH Actions sql-field-filter-string flake (#18466)

parent afe3b242
No related branches found
No related tags found
No related merge requests found
export const STRING_FILTER_SUBTYPES = {
String: {
searchTerm: "Synerg",
value: "Synergistic Granite Chair",
representativeResult: "Synergistic Granite Chair",
},
"String is not": {
searchTerm: "Synerg",
value: "Synergistic Granite Chair",
representativeResult: "Rustic Paper Wallet",
},
"String contains": {
searchTerm: null,
value: "Bronze",
representativeResult: "Incredible Bronze Pants",
},
"String does not contain": {
searchTerm: null,
value: "Bronze",
representativeResult: "Rustic Paper Wallet",
},
"String starts with": {
searchTerm: null,
value: "Rustic",
representativeResult: "Rustic Paper Wallet",
},
"String ends with": {
searchTerm: null,
value: "Hat",
representativeResult: "Small Marble Hat",
},
......
......@@ -137,6 +137,17 @@ function enterDefaultValue(value) {
cy.button("Add filter").click();
}
/**
* @param {string} searchTerm
* @param {string} result
*/
export function pickDefaultValue(searchTerm, result) {
cy.findByPlaceholderText("Enter a default value...").type(searchTerm);
cy.findByText(result).click();
cy.button("Add filter").click();
}
/**
*
* @param {string|Array.<string>} value
......
......@@ -33,7 +33,7 @@ describe("scenarios > filters > sql filters > field filter > String", () => {
});
Object.entries(STRING_FILTER_SUBTYPES).forEach(
([subType, { value, representativeResult }]) => {
([subType, { searchTerm, value, representativeResult }]) => {
describe(`should work for ${subType}`, () => {
it("when set through the filter widget", () => {
FieldFilter.setWidgetType(subType);
......@@ -54,7 +54,10 @@ describe("scenarios > filters > sql filters > field filter > String", () => {
SQLFilter.toggleRequired();
FieldFilter.openEntryForm({ isFilterRequired: true });
FieldFilter.addDefaultStringFilter(value);
searchTerm
? FieldFilter.pickDefaultValue(searchTerm, value)
: FieldFilter.addDefaultStringFilter(value);
SQLFilter.runQuery();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment