fix: fix 5-ndv e2e tests

This commit is contained in:
Alex Grozav 2023-07-24 16:49:57 +03:00
parent f6aaa4ffe4
commit 9b9aab2a65
3 changed files with 22 additions and 23 deletions

View file

@ -28,17 +28,14 @@ describe('NDV', () => {
cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite'); cy.grantBrowserPermissions('clipboardReadWrite', 'clipboardSanitizedWrite');
cy.window() cy.readClipboard().then((url) => {
.focus() cy.request({
.readClipboard() method: 'GET',
.then((url) => { url,
cy.request({ }).then((resp) => {
method: 'GET', expect(resp.status).to.eq(200);
url,
}).then((resp) => {
expect(resp.status).to.eq(200);
});
}); });
});
ndv.getters.outputDisplayMode().should('have.length.at.least', 1).and('be.visible'); ndv.getters.outputDisplayMode().should('have.length.at.least', 1).and('be.visible');
}); });
@ -120,7 +117,7 @@ describe('NDV', () => {
setupSchemaWorkflow(); setupSchemaWorkflow();
ndv.getters.outputDisplayMode().children().should('have.length', 3); ndv.getters.outputDisplayMode().children().should('have.length', 3);
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Table'); ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Table');
ndv.getters.outputDisplayMode().contains('Schema').click(); ndv.actions.switchOutputMode('Schema');
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Schema'); ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Schema');
schemaKeys.forEach((key) => { schemaKeys.forEach((key) => {
@ -133,7 +130,7 @@ describe('NDV', () => {
}); });
it('should preserve schema view after execution', () => { it('should preserve schema view after execution', () => {
setupSchemaWorkflow(); setupSchemaWorkflow();
ndv.getters.outputDisplayMode().contains('Schema').click(); ndv.actions.switchOutputMode('Schema');
ndv.actions.execute(); ndv.actions.execute();
ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Schema'); ndv.getters.outputDisplayMode().find('[class*=active]').should('contain', 'Schema');
}); });
@ -145,7 +142,7 @@ describe('NDV', () => {
.outputPanel() .outputPanel()
.find('[data-test-id=run-data-schema-item]') .find('[data-test-id=run-data-schema-item]')
.filter(':contains("objectValue")'); .filter(':contains("objectValue")');
ndv.getters.outputDisplayMode().contains('Schema').click(); ndv.actions.switchOutputMode('Schema');
expandedObjectProps.forEach((key) => { expandedObjectProps.forEach((key) => {
ndv.getters ndv.getters
@ -176,9 +173,9 @@ describe('NDV', () => {
ndv.actions.execute(); ndv.actions.execute();
ndv.getters.outputPanel().contains('25 items').should('exist'); ndv.getters.outputPanel().contains('25 items').should('exist');
ndv.getters.outputPanel().find('[class*=_pagination]').should('exist'); ndv.getters.outputPanel().find('[class*=_pagination]').should('exist');
ndv.getters.outputDisplayMode().contains('Schema').click(); ndv.actions.switchOutputMode('Schema');
ndv.getters.outputPanel().find('[class*=_pagination]').should('not.exist'); ndv.getters.outputPanel().find('[class*=_pagination]').should('not.exist');
ndv.getters.outputDisplayMode().contains('JSON').click(); ndv.actions.switchOutputMode('JSON');
ndv.getters.outputPanel().find('[class*=_pagination]').should('exist'); ndv.getters.outputPanel().find('[class*=_pagination]').should('exist');
}); });
it('should display large schema', () => { it('should display large schema', () => {
@ -191,7 +188,7 @@ describe('NDV', () => {
ndv.getters.outputPanel().contains('20 items').should('exist'); ndv.getters.outputPanel().contains('20 items').should('exist');
ndv.getters.outputPanel().find('[class*=_pagination]').should('exist'); ndv.getters.outputPanel().find('[class*=_pagination]').should('exist');
ndv.getters.outputDisplayMode().contains('Schema').click(); ndv.actions.switchOutputMode('Schema');
ndv.getters.outputPanel().find('[class*=_pagination]').should('not.exist'); ndv.getters.outputPanel().find('[class*=_pagination]').should('not.exist');
ndv.getters ndv.getters
.outputPanel() .outputPanel()
@ -200,7 +197,7 @@ describe('NDV', () => {
}); });
}); });
it.only('can link and unlink run selectors between input and output', () => { it('can link and unlink run selectors between input and output', () => {
cy.createFixtureWorkflow('Test_workflow_5.json', 'Test'); cy.createFixtureWorkflow('Test_workflow_5.json', 'Test');
workflowPage.actions.zoomToFit(); workflowPage.actions.zoomToFit();
workflowPage.actions.executeWorkflow(); workflowPage.actions.executeWorkflow();

View file

@ -1,4 +1,5 @@
import { BasePage } from './base'; import { BasePage } from './base';
import { getVisibleSelect } from '../utils';
export class NDV extends BasePage { export class NDV extends BasePage {
getters = { getters = {
@ -139,11 +140,11 @@ export class NDV extends BasePage {
}, },
changeInputRunSelector: (runName: string) => { changeInputRunSelector: (runName: string) => {
this.getters.inputRunSelector().click(); this.getters.inputRunSelector().click();
cy.get('.el-select-dropdown:visible .el-select-dropdown__item').contains(runName).click(); getVisibleSelect().find('.el-select-dropdown__item').contains(runName).click();
}, },
changeOutputRunSelector: (runName: string) => { changeOutputRunSelector: (runName: string) => {
this.getters.outputRunSelector().click(); this.getters.outputRunSelector().click();
cy.get('.el-select-dropdown:visible .el-select-dropdown__item').contains(runName).click(); getVisibleSelect().find('.el-select-dropdown__item').contains(runName).click();
}, },
toggleOutputRunLinking: () => { toggleOutputRunLinking: () => {
this.getters.outputRunSelector().find('button').click(); this.getters.outputRunSelector().find('button').click();

View file

@ -153,14 +153,12 @@
{{ $locale.baseText(linkedRuns ? 'runData.unlinking.hint' : 'runData.linking.hint') }} {{ $locale.baseText(linkedRuns ? 'runData.unlinking.hint' : 'runData.linking.hint') }}
</template> </template>
<n8n-icon-button <n8n-icon-button
v-if="linkedRuns" :icon="linkedRuns ? 'unlink' : 'link'"
icon="unlink"
text text
type="tertiary" type="tertiary"
size="small" size="small"
@click="unlinkRun" @click="toggleLinkRuns"
/> />
<n8n-icon-button v-else icon="link" text type="tertiary" size="small" @click="linkRun" />
</n8n-tooltip> </n8n-tooltip>
<slot name="run-info"></slot> <slot name="run-info"></slot>
@ -1130,6 +1128,9 @@ export default defineComponent({
type: 'showTooMuchData', type: 'showTooMuchData',
}); });
}, },
toggleLinkRuns() {
this.linkedRuns ? this.unlinkRun() : this.linkRun();
},
linkRun() { linkRun() {
this.$emit('linkRun'); this.$emit('linkRun');
}, },