Browse Source

test: CY fix for attachment cell handling

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3396/head
Raju Udava 2 years ago
parent
commit
16aab18795
  1. 3
      packages/nc-gui-v2/composables/useColumn.ts
  2. 79
      scripts/cypress-v2/integration/common/6f_attachments.js
  3. 3
      scripts/cypress-v2/support/page_objects/mainPage.js

3
packages/nc-gui-v2/composables/useColumn.ts

@ -8,7 +8,8 @@ export function useColumn(column: Ref<ColumnType>) {
const uiDatatype: ComputedRef<UITypes> = computed(() => column?.value?.uidt as UITypes) const uiDatatype: ComputedRef<UITypes> = computed(() => column?.value?.uidt as UITypes)
const abstractType = computed(() => const abstractType = computed(() =>
isVirtualCol(column?.value) // kludge: CY test hack; column.value is being received NULL during attach cell delete operation
isVirtualCol(column?.value) || !column?.value
? null ? null
: SqlUiFactory.create(project.value?.bases?.[0]?.config || { client: 'mysql2' }).getAbstractType(column?.value), : SqlUiFactory.create(project.value?.bases?.[0]?.config || { client: 'mysql2' }).getAbstractType(column?.value),
) )

79
scripts/cypress-v2/integration/common/6f_attachments.js

@ -21,28 +21,29 @@ export const genTest = (apiType, dbType) => {
}); });
after(() => { after(() => {
// cy.restoreLocalStorage(); cy.restoreLocalStorage();
// cy.wait(1000); cy.wait(1000);
// mainPage.deleteColumn("testAttach"); // clean up
// mainPage.deleteColumn("testAttach");
// // clean up newly added rows into Country table operations
// // this auto verifies successfull addition of rows to table as well // clean up newly added rows into Country table operations
// mainPage.getPagination(5).click(); // this auto verifies successfull addition of rows to table as well
// // kludge: flicker on load mainPage.getPagination(5).click();
// cy.wait(3000) // kludge: flicker on load
// cy.wait(3000)
// // wait for page rendering to complete
// cy.get(".nc-grid-row").should("have.length", 10); // wait for page rendering to complete
// // mainPage cy.get(".nc-grid-row").should("have.length", 10);
// // .getRow(10) // mainPage
// // .find(".mdi-checkbox-blank-outline") // .getRow(10)
// // .click({ force: true }); // .find(".mdi-checkbox-blank-outline")
// // .click({ force: true });
// mainPage.getCell("Country", 10).rightclick();
// cy.getActiveMenu().contains("Delete Row").click(); mainPage.getCell("Country", 10).rightclick();
// cy.getActiveMenu().contains("Delete Row").click();
// cy.closeTableTab("Country");
cy.closeTableTab("Country");
}); });
it(`Add column of type attachments`, () => { it(`Add column of type attachments`, () => {
@ -83,6 +84,7 @@ export const genTest = (apiType, dbType) => {
.then(($obj) => { .then(($obj) => {
let linkText = $obj.text().trim(); let linkText = $obj.text().trim();
cy.log(linkText); cy.log(linkText);
cy.visit(linkText, { cy.visit(linkText, {
baseUrl: null, baseUrl: null,
}); });
@ -102,23 +104,13 @@ export const genTest = (apiType, dbType) => {
cy.get('.nc-attachment-cell') cy.get('.nc-attachment-cell')
.attachFile(`sampleFiles/1.json`, { subjectType: 'drag-n-drop' }); .attachFile(`sampleFiles/1.json`, { subjectType: 'drag-n-drop' });
// cy.get(".nc-field-editables")
// .last()
// .find('input[type="file"]')
// .attachFile(`sampleFiles/1.json`);
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click(); cy.get(".nc-form").find("button").contains("Submit").click();
cy.get(".ant-alert-message") cy.get(".ant-alert-message")
.contains("Successfully submitted form data") .contains("Successfully submitted form data")
.should("exist"); .should("exist");
// // submit button & validate
// cy.get(".nc-form")
// .find("button")
// .contains("Submit")
// .click();
cy.toastWait("Saved successfully"); cy.toastWait("Saved successfully");
}); });
}); });
@ -158,29 +150,6 @@ export const genTest = (apiType, dbType) => {
mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv); mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv);
mainPage.unhideField("LastUpdate"); mainPage.unhideField("LastUpdate");
mainPage.filterReset(); mainPage.filterReset();
// clean up
mainPage.deleteColumn("testAttach");
// clean up newly added rows into Country table operations
// this auto verifies successfull addition of rows to table as well
mainPage.getPagination(5).click();
// kludge: flicker on load
cy.wait(3000)
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);
// mainPage
// .getRow(10)
// .find(".mdi-checkbox-blank-outline")
// .click({ force: true });
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu().contains("Delete Row").click();
cy.closeTableTab("Country");
}); });
}); });
}; };

3
scripts/cypress-v2/support/page_objects/mainPage.js

@ -226,8 +226,7 @@ export class _mainPage {
cy.get(".ant-btn-dangerous:visible").contains("Delete").click(); cy.get(".ant-btn-dangerous:visible").contains("Delete").click();
cy.wait(500) cy.wait(500)
// fix me! cy.get(`th:contains(${colName})`).should("not.exist");
// cy.get(`th:contains(${colName})`).should("not.exist");
}; };
getAuthToken = () => { getAuthToken = () => {

Loading…
Cancel
Save