superset/superset-frontend/cypress-base/cypress/integration/dashboard/markdown.test.ts
Kamil Gabryjelski 486e0d412c
chore: Upgrade Webpack to v5 (#16701)
* Upgrade Webpack to v5

* Remove mapbox hack

* Replace url-loaders and file-loaders with asset modules

* Remove 1 rule

* Change --colors to --color

* Remove invalid option (--no-progress)

* Remove url-loader, bump plugin

* Fix AnnotationLayer formula check

* Remove redundant tests

* Bump cypress packages

* Remove old comment

* Fix tests

* Remove checks for number of scripts in markdown test

* Cosmetic changes

* Add tests

* Fix test

* Fix test

* Fixes test warnings

* disable flaky test

Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
Co-authored-by: Michael S. Molina <michael.s.molina@gmail.com>
2021-09-22 14:24:54 +03:00

70 lines
2.4 KiB
TypeScript

/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { TABBED_DASHBOARD, drag, resize } from './dashboard.helper';
describe('Dashboard edit markdown', () => {
beforeEach(() => {
cy.login();
cy.visit(TABBED_DASHBOARD);
});
it('should add markdown component to dashboard', () => {
cy.get('[data-test="dashboard-header"]')
.find('[aria-label="edit-alt"]')
.click();
// lazy load - need to open dropdown for the scripts to load
cy.get('[data-test="dashboard-header"]')
.find('[aria-label="more-horiz"]')
.click();
cy.get('[data-test="grid-row-background--transparent"]')
.first()
.as('component-background-first');
// add new markdown component
drag('[data-test="new-component"]', 'Markdown').to(
'@component-background-first',
);
cy.get('[data-test="dashboard-markdown-editor"]')
.should(
'have.text',
'✨Markdown✨Markdown✨MarkdownClick here to edit markdown',
)
.click();
cy.get('[data-test="dashboard-component-chart-holder"]')
.find('.ace_content')
.contains('Click here to edit [markdown](https://bit.ly/1dQOfRK)');
cy.get('[data-test="dashboard-markdown-editor"]')
.click()
.type('Test resize');
resize(
'[data-test="dashboard-markdown-editor"] .resizable-container span div:last-child',
).to(500, 600);
cy.get('[data-test="dashboard-markdown-editor"]').contains('Test resize');
cy.get('@component-background-first').click('right');
cy.get('[data-test="dashboard-component-chart-holder"]')
.find('.ace_content')
.should('not.exist');
});
});