forked from eclipse-sirius/sirius-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3982] Add support for command palette
Bug: eclipse-sirius#3982 Signed-off-by: Stéphane Bégaudeau <[email protected]> Signed-off-by: Guillaume Coutable <[email protected]>
- Loading branch information
1 parent
2040b3c
commit 45ce8d4
Showing
69 changed files
with
3,152 additions
and
631 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
import { Project } from '../../pages/Project'; | ||
import { Flow } from '../../usecases/Flow'; | ||
import { Explorer } from '../../workbench/Explorer'; | ||
import { Omnibox } from '../../workbench/Omnibox'; | ||
|
||
const projectName = 'Cypress - Omnibox'; | ||
describe('Project - Omnibox', () => { | ||
context('Given a Robot flow project', () => { | ||
let projectId: string = ''; | ||
beforeEach(() => { | ||
new Flow().createRobotProject(projectName).then((createdProjectData) => { | ||
projectId = createdProjectData.projectId; | ||
new Project().visit(projectId); | ||
}); | ||
}); | ||
|
||
afterEach(() => cy.deleteProject(projectId)); | ||
|
||
it('Then the omnibox can be display and used to select an element in the workbench', () => { | ||
const explorer = new Explorer(); | ||
const omnibox = new Omnibox(projectName); | ||
omnibox.display(); | ||
omnibox.sendQuery('').findByTestId('DSP').click(); | ||
omnibox.shouldBeClosed(); | ||
explorer.getSelectedTreeItems().contains('DSP').should('exist'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
export class Omnibox { | ||
constructor(readonly projectName: string) {} | ||
|
||
private getOmnibox(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return cy.getByTestId('omnibox'); | ||
} | ||
|
||
public display(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
cy.getByTestId(`navbar-${this.projectName}`).should('exist'); | ||
cy.get('body').type('{ctrl+k}'); | ||
cy.getByTestId('omnibox').should('exist'); | ||
return this.getOmnibox(); | ||
} | ||
|
||
public sendQuery(query: string, hasResult: boolean = true): Cypress.Chainable<JQuery<HTMLElement>> { | ||
if (query !== '') { | ||
this.getOmnibox().find('.MuiInputBase-input').type(`${query}`); | ||
} | ||
this.getOmnibox().findByTestId('submit-query-button').should('not.be.disabled'); | ||
this.getOmnibox().find('.MuiInputBase-input').type('{enter}'); | ||
|
||
this.getOmnibox().find('.MuiList-root').findByTestId('fetch-omnibox-result').should('not.exist'); | ||
if (hasResult) { | ||
this.getOmnibox().find('.MuiList-root').findByTestId('omnibox-no-result').should('not.exist'); | ||
} else { | ||
this.getOmnibox().find('.MuiList-root').findByTestId('omnibox-no-result').should('exist'); | ||
} | ||
|
||
this.getOmnibox().findByTestId('submit-query-button').should('be.disabled'); | ||
|
||
return this.getOmnibox().find('.MuiList-root'); | ||
} | ||
|
||
public shouldBeClosed(): void { | ||
cy.getByTestId('omnibox').should('not.exist'); | ||
} | ||
} |
Oops, something went wrong.