Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion openmetadata-ui/src/main/resources/ui/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig } from 'cypress';
import plugins from './cypress/plugins/index.js';

export default defineConfig({
projectId: 'a9yxci',
projectId: 'w6gjxd',
viewportWidth: 1240,
viewportHeight: 660,
watchForFileChanges: false,
Expand All @@ -13,6 +13,7 @@ export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
experimentalSessionAndOrigin: true,
setupNodeEvents(on, config) {
return plugins(on, config);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ import {
addCustomPropertiesForEntity,
deleteCreatedProperty,
editCreatedProperty,
interceptURL,
login,
verifyResponseStatusCode
interceptURL, verifyResponseStatusCode
} from '../../common/common';
import { ENTITIES, LOGIN, uuid } from '../../constants/constants';

describe('Custom Properties should work properly', () => {
before(() => {
cy.clearLocalStorageSnapshot('localStorage');
login(LOGIN.username, LOGIN.password);
cy.goToHomePage();
cy.saveLocalStorage('localstorage');
});
// before(() => {
// // cy.clearLocalStorageSnapshot('localStorage');
// // login(LOGIN.username, LOGIN.password);
// // cy.saveLocalStorage('localstorage');
// });
beforeEach(() => {
cy.log('Restoring local storage snapshot');
cy.restoreLocalStorage('localstorage');
cy.clickOnLogo();
// cy.log('Restoring local storage snapshot');
// cy.restoreLocalStorage('localstorage');
cy.login(LOGIN.username, LOGIN.password);
cy.visit('/')
cy.goToHomePage();
interceptURL('GET', '/api/v1/users*', 'settingsPage');
cy.get('[data-testid="appbar-item-settings"]').should('be.visible').click();
verifyResponseStatusCode('@settingsPage', 200);
Expand Down Expand Up @@ -260,8 +259,8 @@ describe('Custom Properties should work properly', () => {
});
});

afterEach(() => {
cy.log('Saving Local storage snapshot')
cy.saveLocalStorage('localstorage');
})
// afterEach(() => {
// cy.log('Saving Local storage snapshot')
// cy.saveLocalStorage('localstorage');
// })
});
19 changes: 19 additions & 0 deletions openmetadata-ui/src/main/resources/ui/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

import { interceptURL, verifyResponseStatusCode } from "../common/common";
import { BASE_URL } from "../constants/constants";

Cypress.Commands.add('loginByGoogleApi', () => {
cy.log('Logging in to Google');
cy.request({
Expand Down Expand Up @@ -79,3 +82,19 @@ Cypress.on('uncaught:exception', (err) => {
return false;
}
});


Cypress.Commands.add('login', (username, password) => {
cy.session([username, password], () => {
cy.visit('/');
cy.get('[id="email"]').should('be.visible').clear().type(username);
cy.get('[id="password"]').should('be.visible').clear().type(password);
interceptURL('POST', '/api/v1/users/login', 'login')
interceptURL('GET', '/api/v1/users/*', 'loadPage')
cy.get('.ant-btn').contains('Login').should('be.visible').click();
verifyResponseStatusCode('@login', 200)
verifyResponseStatusCode('@loadPage', 200)
cy.url().should('eq', `${BASE_URL}/my-data`)
cy.get('[data-testid="tables"]').should('be.visible')
})
})