reditor.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright 2018-2022 Elyra Authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. describe('R Editor tests', () => {
  17. before(() => {
  18. cy.resetJupyterLab();
  19. cy.bootstrapFile('helloworld.r'); // load R file used to check existing contents
  20. });
  21. after(() => {
  22. // delete files created for testing
  23. cy.deleteFile('untitled*.r');
  24. cy.deleteFile('helloworld.r'); // delete R file used for testing
  25. });
  26. // R Editor Tests
  27. it('opens blank R file from launcher', () => {
  28. cy.createNewScriptEditor('R');
  29. cy.get('.lm-TabBar-tab[data-type="document-title"]');
  30. });
  31. it('check R editor tab right click content', () => {
  32. cy.checkRightClickTabContent('R');
  33. });
  34. it('close R editor', () => {
  35. cy.closeTab(-1);
  36. });
  37. it('open R file with expected content', () => {
  38. cy.openFileAndCheckContent('r');
  39. });
  40. it('check icons', () => {
  41. // Check file menu editor contents
  42. cy.findByRole('menuitem', { name: /file/i }).click();
  43. cy.findByText(/^new$/i).click();
  44. cy.get(
  45. '[data-command="script-editor:create-new-r-editor"] svg[data-icon="elyra:rIcon"]'
  46. );
  47. // Check r icons from launcher & file explorer
  48. cy.get(
  49. '.jp-LauncherCard[data-category="Elyra"][title="Create a new R Editor"] svg[data-icon="elyra:rIcon"]'
  50. ).click();
  51. cy.get(
  52. '#filebrowser [title*="Name: untitled1.r"] svg[data-icon="elyra:rIcon"]'
  53. );
  54. cy.closeTab(-1);
  55. });
  56. it('opens blank R file from menu', () => {
  57. cy.findByRole('menuitem', { name: /file/i }).click();
  58. cy.findByText(/^new$/i).click();
  59. cy.get(
  60. '[data-command="script-editor:create-new-r-editor"] > .lm-Menu-itemLabel'
  61. ).click();
  62. });
  63. it('check toolbar and its content for R file', () => {
  64. cy.checkScriptEditorToolbarContent();
  65. });
  66. });