mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
- Update MUI v4 to v5
- Remove the SCSS dependency completely and use MUI for theming. - Update - date-fns, @date-io, notistack. Remove - popper.js, sass-loader. - Cleanup webpack config. - Port PSQL tool to use MUI themes instead of SCSS theme. - Theme change will reflect realtime without refreshing pgAdmin.
This commit is contained in:
@@ -109,7 +109,7 @@ class KeyboardShortcutFeatureTest(BaseFeatureTest):
|
||||
else:
|
||||
attempt -= 1
|
||||
|
||||
maximize_button = self.page.find_by_xpath(
|
||||
maximize_button = self.page.find_by_css_selector(
|
||||
NavMenuLocators.maximize_pref_dialogue_css)
|
||||
maximize_button.click()
|
||||
|
||||
@@ -129,9 +129,5 @@ class KeyboardShortcutFeatureTest(BaseFeatureTest):
|
||||
file_menu.click()
|
||||
file_menu.send_keys(key)
|
||||
|
||||
maximize_button = self.page.find_by_xpath(
|
||||
NavMenuLocators.maximize_pref_dialogue_css)
|
||||
maximize_button.click()
|
||||
|
||||
# save and close the preference dialog.
|
||||
self.page.click_modal('Save')
|
||||
|
||||
@@ -123,7 +123,7 @@ class PGDataypeFeatureTest(BaseFeatureTest):
|
||||
NavMenuLocators.show_system_objects_pref_label_xpath))
|
||||
)
|
||||
|
||||
maximize_button = self.page.find_by_xpath(
|
||||
maximize_button = self.page.find_by_css_selector(
|
||||
NavMenuLocators.maximize_pref_dialogue_css)
|
||||
maximize_button.click()
|
||||
|
||||
@@ -148,11 +148,6 @@ class PGDataypeFeatureTest(BaseFeatureTest):
|
||||
|
||||
switch_box_element.click()
|
||||
|
||||
maximize_button = self.page.find_by_xpath(
|
||||
NavMenuLocators.maximize_pref_dialogue_css)
|
||||
maximize_button.click()
|
||||
time.sleep(0.5)
|
||||
|
||||
# save and close the preference dialog.
|
||||
self.page.click_modal('Save')
|
||||
break
|
||||
|
||||
@@ -262,7 +262,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
|
||||
(By.XPATH, NavMenuLocators.show_system_objects_pref_label_xpath))
|
||||
)
|
||||
|
||||
maximize_button = self.page.find_by_xpath(
|
||||
maximize_button = self.page.find_by_css_selector(
|
||||
NavMenuLocators.maximize_pref_dialogue_css)
|
||||
maximize_button.click()
|
||||
|
||||
@@ -325,10 +325,6 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
|
||||
print('Binary path Key is Incorrect or '
|
||||
'server version is None.')
|
||||
|
||||
maximize_button = self.page.find_by_xpath(
|
||||
NavMenuLocators.maximize_pref_dialogue_css)
|
||||
maximize_button.click()
|
||||
|
||||
# save and close the preference dialog.
|
||||
if path_already_set:
|
||||
self.page.click_modal('Cancel')
|
||||
|
||||
@@ -115,7 +115,7 @@ class CopySQLFeatureTest(BaseFeatureTest):
|
||||
wait.until(EC.presence_of_element_located(
|
||||
(By.XPATH, NavMenuLocators.show_system_objects_pref_label_xpath))
|
||||
)
|
||||
maximize_button = self.page.find_by_xpath(
|
||||
maximize_button = self.page.find_by_css_selector(
|
||||
NavMenuLocators.maximize_pref_dialogue_css)
|
||||
maximize_button.click()
|
||||
|
||||
@@ -144,9 +144,5 @@ class CopySQLFeatureTest(BaseFeatureTest):
|
||||
|
||||
switch_box_element.click()
|
||||
|
||||
maximize_button = self.page.find_by_xpath(
|
||||
NavMenuLocators.maximize_pref_dialogue_css)
|
||||
maximize_button.click()
|
||||
|
||||
# save and close the preference dialog.
|
||||
self.page.click_modal('Save')
|
||||
|
||||
@@ -75,7 +75,7 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest):
|
||||
edit_object.click()
|
||||
membership_tab = WebDriverWait(self.page.driver, 4).until(
|
||||
EC.presence_of_element_located((
|
||||
By.XPATH, "//span[normalize-space(text())='Membership']")))
|
||||
By.XPATH, "//button[normalize-space(text())='Membership']")))
|
||||
membership_tab.click()
|
||||
|
||||
# Fetch the source code for our custom control
|
||||
@@ -89,7 +89,7 @@ class CheckRoleMembershipControlFeatureTest(BaseFeatureTest):
|
||||
'<h1>test</h1>',
|
||||
'Role Membership Control'
|
||||
)
|
||||
self.page.find_by_xpath("//button/span[text()='Close']").click()
|
||||
self.page.find_by_xpath("//button[text()='Close']").click()
|
||||
|
||||
def _check_escaped_characters(self, source_code, string_to_find, source):
|
||||
# For XSS we need to search against element's html code
|
||||
|
||||
@@ -51,8 +51,9 @@ class NavMenuLocators:
|
||||
show_system_objects_pref_label_xpath = \
|
||||
"//label[contains(text(), 'Show system objects?')]"
|
||||
|
||||
maximize_pref_dialogue_css = "//div[text()='Preferences']" \
|
||||
"//following::div//span[1]"
|
||||
maximize_pref_dialogue_css = "button[data-label='Maximize']"
|
||||
|
||||
maximize_pref_dialogue_css = "button[data-label='Maximize']"
|
||||
|
||||
specified_pref_node_exp_status = \
|
||||
"//*[@id='treeContainer']//div//span[text()='{0}']"
|
||||
@@ -278,6 +279,6 @@ class PropertyDialogueLocators:
|
||||
# This will contain xpaths for elements in properties dialogue
|
||||
server_dialogue_title = "//span[text()='Register - Server']"
|
||||
|
||||
server_connection_tab = "//button/span[text()='Connection']"
|
||||
server_connection_tab = "//button[text()='Connection']"
|
||||
|
||||
server_tab_save = "//button/span[text()='Save']"
|
||||
server_tab_save = "//button[text()='Save']"
|
||||
|
||||
@@ -155,8 +155,22 @@ class PgadminPage:
|
||||
self.click_element(self.find_by_css_selector(
|
||||
"li[data-label='Query Tool']"))
|
||||
|
||||
self.wait_for_element_to_be_visible(
|
||||
self.driver, "//div[@id='btn-conn-status']", 5)
|
||||
self.driver.switch_to.default_content()
|
||||
WebDriverWait(self.driver, 10).until(
|
||||
EC.frame_to_be_available_and_switch_to_it(
|
||||
(By.TAG_NAME, "iframe")))
|
||||
|
||||
WebDriverWait(self.driver, self.timeout).until(
|
||||
EC.visibility_of_element_located(
|
||||
(By.CSS_SELECTOR, QueryToolLocators.btn_execute_query_css)
|
||||
), "Timed out waiting for execute query button to appear"
|
||||
)
|
||||
|
||||
# Need to add this as by default tool tip is shown for file
|
||||
ActionChains(self.driver).move_to_element(
|
||||
self.driver.find_element(
|
||||
By.CSS_SELECTOR,
|
||||
QueryToolLocators.btn_execute_query_css)).perform()
|
||||
|
||||
def open_view_data(self, table_name):
|
||||
self.click_element(self.find_by_css_selector(
|
||||
@@ -898,9 +912,7 @@ class PgadminPage:
|
||||
return element
|
||||
except (NoSuchElementException, WebDriverException):
|
||||
return False
|
||||
|
||||
time.sleep(1)
|
||||
# self.wait_for_query_tool_loading_indicator_to_disappear(12)
|
||||
|
||||
retry = 2
|
||||
while retry > 0:
|
||||
@@ -909,9 +921,7 @@ class PgadminPage:
|
||||
WebDriverWait(self.driver, 10).until(
|
||||
EC.frame_to_be_available_and_switch_to_it(
|
||||
(By.TAG_NAME, "iframe")))
|
||||
self.find_by_css_selector(
|
||||
"div.dock-tab-btn[id$=\"id-query\"]").click()
|
||||
# self.find_by_xpath("//div[text()='Query Editor']").click()
|
||||
self.find_by_xpath("//span[text()='Query']").click()
|
||||
|
||||
codemirror_ele = WebDriverWait(
|
||||
self.driver, timeout=self.timeout, poll_frequency=0.01) \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useRef } from 'react';
|
||||
import CustomPropTypes from '../../../../pgadmin/static/js/custom_prop_types';
|
||||
export * from '@material-ui/core';
|
||||
export * from '@mui/material';
|
||||
|
||||
// mock popper
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
@@ -1,9 +0,0 @@
|
||||
import PopperJs from 'popper.js';
|
||||
|
||||
export default class Popper {
|
||||
static placements = PopperJs.placements;
|
||||
|
||||
destroy() {/* mock */}
|
||||
scheduleUpdate() {/* mock */}
|
||||
update() {/* mock */}
|
||||
}
|
||||
@@ -10,7 +10,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { withTheme } from '../fake_theme';
|
||||
import InfoIcon from '@material-ui/icons/InfoRounded';
|
||||
import InfoIcon from '@mui/icons-material/InfoRounded';
|
||||
|
||||
|
||||
import {PrimaryButton, DefaultButton, PgIconButton} from 'sources/components/Buttons';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
import OneToManyPortModel from 'pgadmin.tools.erd/erd_tool/ports/OneToManyPort';
|
||||
import {OneToManyLinkModel, OneToManyLinkWidget, OneToManyLinkFactory} from 'pgadmin.tools.erd/erd_tool/links/OneToManyLink';
|
||||
import { render } from '@testing-library/react';
|
||||
import Theme from '../../../pgadmin/static/js/Theme';
|
||||
|
||||
|
||||
describe('ERD OneToManyLinkModel', ()=>{
|
||||
@@ -130,7 +131,9 @@ describe('ERD OneToManyLinkWidget', ()=>{
|
||||
|
||||
it('render', ()=>{
|
||||
let linkWidget = render(
|
||||
<svg><OneToManyLinkWidget link={link} diagramEngine={engine} factory={linkFactory} /></svg>
|
||||
<Theme>
|
||||
<svg><OneToManyLinkWidget link={link} diagramEngine={engine} factory={linkFactory} /></svg>
|
||||
</Theme>
|
||||
);
|
||||
|
||||
let paths = linkWidget.container.querySelectorAll('g g');
|
||||
|
||||
@@ -10,13 +10,16 @@
|
||||
import React from 'react';
|
||||
import QuickSearch from '../../../pgadmin/static/js/QuickSearch';
|
||||
import { render } from '@testing-library/react';
|
||||
import Theme from '../../../pgadmin/static/js/Theme';
|
||||
|
||||
let ctrl;
|
||||
|
||||
describe('quick search test cases', function () {
|
||||
beforeEach(() => {
|
||||
ctrl = render(
|
||||
<QuickSearch />
|
||||
<Theme>
|
||||
<QuickSearch />
|
||||
</Theme>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -65,5 +65,4 @@ document.createRange = () => {
|
||||
};
|
||||
|
||||
|
||||
jest.setTimeout(15000); // 1 second
|
||||
|
||||
jest.setTimeout(18000); // 1 second
|
||||
|
||||
Reference in New Issue
Block a user