Skip to content

Commit

Permalink
Fixes yasr step functions.
Browse files Browse the repository at this point in the history
What
Removes the yasqe yasr parameter from YasrSteps.

Why
The usage of such steps is inconsistent. The count of yasr instances depends on how the sparql view is opened:

- When the sparql view is opened and has more than one tab, calling a method like `getYasr(yasrIndex = 0)` would be expected to fetch an instance of the second tab. However, this is not the case. When the view is opened, only one instance is created for the active tab, so the test will fail with a timeout because the steps try to fetch the second instance of yasr.
- When the sparql view is opened with one tab, and then another tab is created, the steps work fine since yasgui has created two instances.

The parameter is removed to prevent misleading other developers who might not be aware of this yasr behavior.

How
The index parameter is removed and affected tests are fixed. Now all functions work with the active yasr of the active tab.
  • Loading branch information
boyan-tonchev committed Aug 10, 2023
1 parent 31af24e commit ce70d77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe('Graphs config', () => {
// When I select preview query results
VisualGraphSteps.previewQueryResults();
// Then I expect to see the results table
YasrSteps.getYasr(0).should('be.visible');
YasrSteps.getYasr().should('be.visible');
// When I select to edit query
VisualGraphSteps.editQuery();
// Then I expect to see the query editor with the previously selected query
Expand All @@ -282,7 +282,7 @@ describe('Graphs config', () => {
// When I select to preview query results
VisualGraphSteps.previewQueryResults();
// Then I expect to see the results table
YasrSteps.getYasr(0).should('be.visible');
YasrSteps.getYasr().should('be.visible');
// When I select to edit the selected query
VisualGraphSteps.editQuery();
// Then I expect to see the editor with the selected query
Expand Down
10 changes: 3 additions & 7 deletions test-cypress/steps/yasgui/yasr-steps.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export class YasrSteps {
static getYasr(yasrIndex = 0) {
return cy.get('.yasr').eq(yasrIndex);
}

static getActiveYasr() {
static getYasr() {
return cy.get('.tabPanel.active .yasr');
}

Expand All @@ -12,7 +8,7 @@ export class YasrSteps {
}

static getResponseInfo() {
return YasrSteps.getActiveYasr().find('.yasr_response_chip');
return YasrSteps.getYasr().find('.yasr_response_chip');
}

static getErrorHeader() {
Expand All @@ -24,7 +20,7 @@ export class YasrSteps {
}

static getResults() {
return cy.get('.yasr_results tbody').find('tr');
return YasrSteps.getYasr('.yasr_results tbody').find('tr');
}

static getResultTableHeader() {
Expand Down

0 comments on commit ce70d77

Please sign in to comment.