Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a5e4738

Browse files
authoredFeb 8, 2024
tests(domains): added multiple cypress tests scenarios (#9750)
1 parent 4551164 commit a5e4738

File tree

2 files changed

+207
-46
lines changed

2 files changed

+207
-46
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
const domainName = "CypressNestedDomain";
2-
const domainDescription = "CypressNestedDomainDescription";
2+
3+
//Delete Unecessary Existing Domains
4+
const deleteExisitingDomain = () => {
5+
cy.get('a[href*="urn:li"] span[class^="ant-typography"]')
6+
.should('be.visible')
7+
.its('length')
8+
.then((length) => {
9+
for (let i = 0; i < length - 1; i++) {
10+
cy.get('a[href*="urn:li"] span[class^="ant-typography"]')
11+
.should('be.visible')
12+
.first()
13+
.click({ force: true });
14+
deleteFromDomainDropdown();
15+
}
16+
});
17+
cy.waitTextVisible('Marketing');
18+
}
319

420
const createDomain = () => {
5-
cy.clickOptionWithTestId("domains-new-domain-button");
21+
cy.get('.anticon-plus').first().click()
22+
cy.waitTextVisible('Create New Domain')
623
cy.get('[data-testid="create-domain-name"]').click().type(domainName);
7-
cy.get('[data-testid="create-domain-description"]').click().type(domainDescription);
824
cy.clickOptionWithTestId("create-domain-button");
925
cy.waitTextVisible("Created domain!");
1026
}
@@ -16,7 +32,7 @@ const moveDomaintoRootLevel = () => {
1632
cy.get('[data-testid="move-domain-modal"]').contains("Marketing").click({force: true});
1733
cy.waitTextVisible('Marketing')
1834
cy.clickOptionWithTestId("move-domain-modal-move-button")
19-
}
35+
}
2036

2137
const moveDomaintoParent = () => {
2238
cy.get('[data-testid="domain-list-item"]').contains("Marketing").prev().click();
@@ -25,70 +41,185 @@ const moveDomaintoParent = () => {
2541
cy.openThreeDotDropdown();
2642
cy.clickOptionWithTestId("entity-menu-move-button");
2743
cy.clickOptionWithTestId("move-domain-modal-move-button")
28-
}
44+
}
2945

30-
const deleteFromDomainDropdown = () => {
31-
cy.clickOptionWithText('Filters')
32-
cy.openThreeDotDropdown();
33-
cy.clickOptionWithTestId("entity-menu-delete-button");
34-
cy.waitTextVisible("Are you sure you want to remove this Domain?");
35-
cy.clickOptionWithText("Yes");
36-
}
46+
const getDomainList = (domainName) =>{
47+
cy.contains('span.ant-typography-ellipsis', domainName)
48+
.parent('[data-testid="domain-list-item"]')
49+
.find('[aria-label="right"]')
50+
.click();
51+
}
52+
53+
const deleteFromDomainDropdown = () => {
54+
cy.clickOptionWithText('Filters')
55+
cy.openThreeDotDropdown();
56+
cy.clickOptionWithTestId("entity-menu-delete-button");
57+
cy.waitTextVisible("Are you sure you want to remove this Domain?");
58+
cy.clickOptionWithText("Yes");
59+
}
3760

3861
const deleteDomain = () => {
3962
cy.clickOptionWithText(domainName).waitTextVisible('Domains');
4063
deleteFromDomainDropdown()
41-
}
64+
}
4265

43-
//Delete Unecessary Existing Domains
44-
const deleteExisitingDomain = () => {
45-
cy.get('a[href*="urn:li"] span[class^="ant-typography"]')
46-
.should('be.visible')
47-
.its('length')
48-
.then((length) => {
49-
for (let i = 0; i < length - 1; i++) {
50-
cy.get('a[href*="urn:li"] span[class^="ant-typography"]')
51-
.should('be.visible')
52-
.first()
53-
.click({ force: true });
54-
deleteFromDomainDropdown();
55-
}
56-
});
57-
cy.waitTextVisible('My custom domain');
58-
}
66+
const verifyEditAndPerformAddAndRemoveActionForDomain = (entity, action, text, body) =>{
67+
cy.clickOptionWithText(entity)
68+
cy.clickOptionWithText(action)
69+
cy.get('[data-testid="tag-term-modal-input"]').type(text)
70+
cy.get('[data-testid="tag-term-option"]').contains(text).click()
71+
cy.clickOptionWithText(body)
72+
cy.get('[data-testid="add-tag-term-from-modal-btn"]').click()
73+
cy.waitTextVisible(text)
74+
}
5975

60-
describe("nested domains test", () => {
76+
const clearAndType = (text) =>{
77+
cy.get('[role="textbox"]').click().clear().type(text)
78+
}
79+
80+
const clearAndDelete = () =>{
81+
cy.clickOptionWithText("Edit")
82+
cy.get('[role="textbox"]').click().clear()
83+
cy.clickOptionWithTestId("description-editor-save-button")
84+
cy.waitTextVisible('No documentation')
85+
cy.mouseover('.ant-list-item-meta-content')
86+
cy.get('[aria-label="delete"]').click()
87+
cy.waitTextVisible('Link Removed')
88+
}
89+
90+
describe("Verify nested domains test functionalities", () => {
6191
beforeEach (() => {
6292
cy.loginWithCredentials();
6393
cy.goToDomainList();
6494
});
6595

66-
it("Create a new domain", () => {
67-
deleteExisitingDomain()
96+
it("Verify Create a new domain", () => {
97+
deleteExisitingDomain()
98+
cy.get('a[href*="urn:li"] span[class^="ant-typography"]')
99+
.should('be.visible')
68100
createDomain();
69101
cy.waitTextVisible("Domains");
70102
});
71103

72-
it("Move domain root level to parent level", () => {
104+
it ("verify Move domain root level to parent level", () => {
73105
cy.waitTextVisible(domainName)
74106
moveDomaintoRootLevel();
75107
cy.waitTextVisible("Moved Domain!")
76108
cy.goToDomainList();
77109
cy.waitTextVisible("1 sub-domain");
78110
});
79111

80-
it("Move domain parent level to root level", () => {
112+
it("Verify Move domain parent level to root level", () => {
81113
moveDomaintoParent();
82114
cy.waitTextVisible("Moved Domain!")
83115
cy.goToDomainList();
84116
cy.waitTextVisible(domainName);
85-
cy.waitTextVisible(domainDescription);
86117
});
87118

88-
it("Remove the domain", () => {
119+
it("Verify Documentation tab by adding editing Description and adding link", () => {
120+
cy.clickOptionWithText(domainName)
121+
cy.clickOptionWithId('#rc-tabs-0-tab-Documentation')
122+
cy.clickFirstOptionWithText("Add Documentation")
123+
clearAndType("Test added")
124+
cy.clickOptionWithTestId("description-editor-save-button")
125+
cy.waitTextVisible('Description Updated')
126+
cy.waitTextVisible('Test added')
127+
cy.clickFirstOptionWithTestId("add-link-button")
128+
cy.waitTextVisible("Add Link")
129+
cy.enterTextInTestId("add-link-modal-url", 'www.test.com')
130+
cy.enterTextInTestId("add-link-modal-label", 'Test Label')
131+
cy.clickOptionWithTestId("add-link-modal-add-button")
132+
cy.waitTextVisible("Test Label")
133+
cy.goToDomainList();
134+
cy.waitTextVisible("Test added")
135+
cy.clickOptionWithText(domainName)
136+
cy.clickOptionWithText("Documentation")
137+
clearAndDelete()
138+
})
139+
140+
it("Verify Right side panel functionalities", () => {
141+
cy.clickOptionWithText(domainName)
142+
cy.waitTextVisible("Filters")
143+
cy.clickOptionWithText("Add Documentation")
144+
clearAndType("Test documentation")
145+
cy.clickOptionWithTestId("description-editor-save-button")
146+
cy.ensureTextNotPresent("Add Documentation")
147+
cy.waitTextVisible('Test documentation')
148+
cy.clickFirstOptionWithSpecificTestId("add-link-button", 1)
149+
cy.waitTextVisible("URL")
150+
cy.enterTextInTestId("add-link-modal-url", 'www.test.com')
151+
cy.enterTextInTestId("add-link-modal-label", 'Test Label')
152+
cy.clickOptionWithTestId("add-link-modal-add-button")
153+
cy.waitTextVisible("Test Label")
154+
cy.clickOptionWithTestId("add-owners-button")
155+
cy.waitTextVisible("Find a user or group")
156+
cy.clickTextOptionWithClass(".rc-virtual-list-holder-inner", "DataHub")
157+
cy.clickOptionWithText("Find a user or group")
158+
cy.clickOptionWithId('#addOwnerButton')
159+
cy.waitTextVisible("DataHub")
160+
cy.goToDomainList();
161+
cy.waitTextVisible("Test documentation")
162+
cy.waitTextVisible("DataHub")
163+
cy.clickOptionWithText(domainName)
164+
cy.clickOptionWithText("Documentation")
165+
clearAndDelete()
166+
})
167+
168+
it("Verify Edit Domain Name", () => {
169+
cy.clickFirstOptionWithText(domainName)
170+
cy.clickOptionWithText('Filters')
171+
172+
//edit name
173+
cy.get('.anticon-edit').eq(0).click().then(() => {
174+
cy.get('.ant-typography-edit-content').type(" Edited").type('{enter}');
175+
});
176+
cy.waitTextVisible(domainName + " Edited")
177+
})
178+
179+
it("Verify Remove the domain", () => {
89180
deleteDomain();
90181
cy.goToDomainList();
91182
cy.ensureTextNotPresent(domainName);
92-
cy.ensureTextNotPresent(domainDescription);
93183
});
184+
185+
it('Verify Add and delete sub domain', () => {
186+
cy.clickFirstOptionWithText('Marketing')
187+
cy.clickOptionWithText('Filters')
188+
createDomain();
189+
cy.ensureTextNotPresent('Created domain!')
190+
getDomainList('Marketing')
191+
cy.clickOptionWithText(domainName)
192+
deleteFromDomainDropdown()
193+
cy.ensureTextNotPresent(domainName)
194+
})
195+
196+
it('Verify entities tab with adding and deleting assets and performing some actions', () => {
197+
cy.clickFirstOptionWithText('Marketing');
198+
cy.clickOptionWithText('Add assets');
199+
cy.waitTextVisible("Add assets to Domain");
200+
cy.enterTextInSpecificTestId("search-bar", 3, 'Baz Chart 1')
201+
cy.clickOptionWithSpecificClass('.ant-checkbox', 1)
202+
cy.clickOptionWithId('#continueButton')
203+
cy.waitTextVisible("Added assets to Domain!")
204+
cy.openThreeDotMenu()
205+
cy.clickOptionWithText("Edit")
206+
cy.clickOptionWithSpecificClass('.ant-checkbox', 1)
207+
verifyEditAndPerformAddAndRemoveActionForDomain('Tags', 'Add tags', 'Cypress', 'Add Tags')
208+
cy.clickOptionWithText('Baz Chart 1')
209+
cy.waitTextVisible("Cypress")
210+
cy.waitTextVisible("Marketing")
211+
cy.go('back')
212+
cy.openThreeDotMenu()
213+
cy.clickOptionWithText("Edit")
214+
cy.clickOptionWithSpecificClass('.ant-checkbox', 1)
215+
verifyEditAndPerformAddAndRemoveActionForDomain('Tags', 'Remove tags', 'Cypress', 'Remove Tags')
216+
cy.clickTextOptionWithClass('.ant-dropdown-trigger', 'Domain')
217+
cy.clickOptionWithText('Unset Domain')
218+
cy.clickOptionWithText("Yes");
219+
cy.clickOptionWithText('Baz Chart 1')
220+
cy.waitTextVisible('Dashboards')
221+
cy.reload()
222+
cy.ensureTextNotPresent("Cypress")
223+
cy.ensureTextNotPresent("Marketing")
224+
})
94225
});

‎smoke-test/tests/cypress/cypress/support/commands.js

+39-9
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ export function getTimestampMillisNumDaysAgo (numDays) {
2323

2424

2525
Cypress.Commands.add('login', () => {
26-
cy.request({
27-
method: 'POST',
28-
url: '/logIn',
29-
body: {
30-
username: Cypress.env('ADMIN_USERNAME'),
31-
password: Cypress.env('ADMIN_PASSWORD'),
32-
},
33-
retryOnStatusCodeFailure: true,
34-
});
26+
cy.request({
27+
method: 'POST',
28+
url: '/logIn',
29+
body: {
30+
username: Cypress.env('ADMIN_USERNAME'),
31+
password: Cypress.env('ADMIN_PASSWORD'),
32+
},
33+
retryOnStatusCodeFailure: true,
34+
});
3535
})
3636

3737
Cypress.Commands.add("loginWithCredentials", (username, password) => {
@@ -163,10 +163,18 @@ Cypress.Commands.add("openThreeDotDropdown", () => {
163163
cy.clickOptionWithTestId("entity-header-dropdown")
164164
});
165165

166+
Cypress.Commands.add("openThreeDotMenu", () => {
167+
cy.clickOptionWithTestId("three-dot-menu")
168+
});
169+
166170
Cypress.Commands.add("clickOptionWithText", (text) => {
167171
cy.contains(text).should('be.visible').click();
168172
});
169173

174+
Cypress.Commands.add("clickFirstOptionWithText", (text) => {
175+
cy.contains(text).first().click();
176+
});
177+
170178
Cypress.Commands.add("clickOptionWithTextToScrollintoView", (text) => {
171179
cy.contains(text).scrollIntoView().click();
172180
});
@@ -222,6 +230,13 @@ Cypress.Commands.add("getWithTestId", (id) => {
222230
return cy.get(selectorWithtestId(id));
223231
});
224232

233+
Cypress.Commands.add("clickOptionWithId", (id) => {
234+
cy.get(id).click()
235+
})
236+
237+
Cypress.Commands.add("enterTextInSpecificTestId", (id, value, text) => {
238+
cy.get(selectorWithtestId(id)).eq(value).type(text);
239+
})
225240
Cypress.Commands.add("enterTextInTestId", (id, text) => {
226241
cy.get(selectorWithtestId(id)).type(text);
227242
})
@@ -238,6 +253,21 @@ Cypress.Commands.add("clickFirstOptionWithTestId", (id) => {
238253
});
239254
})
240255

256+
Cypress.Commands.add("clickFirstOptionWithSpecificTestId", (id,value) => {
257+
cy.get(selectorWithtestId(id)).eq(value).click({
258+
force: true,
259+
});
260+
})
261+
262+
Cypress.Commands.add("clickOptionWithSpecificClass", (locator, value) => {
263+
cy.get(locator).should('be.visible')
264+
cy.get(locator).eq(value).click();
265+
})
266+
267+
Cypress.Commands.add("clickTextOptionWithClass", (locator, text) => {
268+
cy.get(locator).should('be.visible').contains(text).click({force:true})
269+
})
270+
241271
Cypress.Commands.add("hideOnboardingTour", () => {
242272
cy.get('body').type("{ctrl} {meta} h");
243273
});

0 commit comments

Comments
 (0)
Please sign in to comment.