Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit a65cd62

Browse files
author
Matt Mazzola
authored
test: update for product changes (#44)
* test: mock results * test: action conditions * test: action deletion * test: action modal * test: descriptions and tags * test: fix typo in index * test: clean up entity word selection event * test: from log tags * test: api coverage * test: set entity wait for completed
1 parent 0482730 commit a65cd62

File tree

13 files changed

+125
-68
lines changed

13 files changed

+125
-68
lines changed

packages/ui/cypress/integration/regressionTs/actionCallbackResults.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,11 @@ describe('Action Callback Results', () => {
403403

404404
after(() => {
405405
cy.get(s.callbackResultModal.buttons.cancel)
406+
.click()
406407
})
407408
})
408409

409-
describe(`Mock Mock Results`, () => {
410+
describe(`Model Mock Results`, () => {
410411
before(() => {
411412
cy.get(s.action.mockResult.modelRow)
412413
.eq(1)
@@ -439,6 +440,7 @@ describe('Action Callback Results', () => {
439440

440441
after(() => {
441442
cy.get(s.callbackResultModal.buttons.cancel)
443+
.click()
442444
})
443445
})
444446
})

packages/ui/cypress/integration/regressionTs/actionConditions.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ describe('Action Conditions', () => {
604604
util.removeLabel('4')
605605

606606
cy.get('body')
607-
.trigger(constants.events.selectWord, { detail: { phrase: '21', inex: 0 } })
607+
.trigger(constants.events.selectWord, { detail: { phrase: '21', index: 0 } })
608608

609609
cy.get(s.entityPicker.inputSearch)
610610
.type(testData.entities.number)

packages/ui/cypress/integration/regressionTs/actionDeletion.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ describe('Action Deletion', () => {
137137
.contains(testData.dialogs.markInvalid)
138138
.click()
139139

140+
cy.get(s.common.spinner, { timeout: constants.spinner.timeout })
141+
.should('not.exist')
142+
140143
// verify has invalid
141144
cy.get(s.webChat.messageFromMeException)
142145
cy.get(s.dialogModal.error)
@@ -147,6 +150,9 @@ describe('Action Deletion', () => {
147150
.contains(testData.dialogs.stillValidAfterRemoval)
148151
.click()
149152

153+
cy.get(s.common.spinner, { timeout: constants.spinner.timeout })
154+
.should('not.exist')
155+
150156
// verify not invalid
151157
cy.get(s.dialogModal.container)
152158
cy.get(s.webChat.messageFromMeException)
@@ -162,6 +168,9 @@ describe('Action Deletion', () => {
162168
.contains(testData.dialogs.notOnlyScorerStep)
163169
.click()
164170

171+
cy.get(s.common.spinner, { timeout: constants.spinner.timeout })
172+
.should('not.exist')
173+
165174
// verify not invalid
166175
cy.get(s.dialogModal.container)
167176
cy.get(s.webChat.messageDownArrow)

packages/ui/cypress/integration/regressionTs/actionModal.spec.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('action modal', () => {
2727
cy.wait(500)
2828
cy.get(s.common.spinner, { timeout: constants.spinner.timeout })
2929
.should('not.exist')
30-
30+
3131
cy.get(s.actions.buttonNewAction)
3232
.click()
3333
})
@@ -94,13 +94,17 @@ describe('action modal', () => {
9494
// TODO: Find out why this fails to select picker item?
9595
it('adding an entity should make removable required entities non-removable', () => {
9696
cy.WaitForStableDOM()
97-
97+
9898
cy.get(s.action.inputRequiredConditions)
99-
.type('e{enter}')
99+
.type('e')
100+
101+
cy.get(s.officePicker.splitButton)
102+
.contains(testData.entity1)
103+
.click()
100104

101105
// Condition is removable
102106
cy.get(s.action.tagPickerRequired)
103-
.get(s.officePicker.tagItem)
107+
.find(s.officePicker.tagItem)
104108
.contains(testData.entity1)
105109
.get(s.officePicker.tagItemClose)
106110

@@ -172,8 +176,13 @@ describe('action modal', () => {
172176

173177
describe('required entities', () => {
174178
it('should not be able to add entities that are disqualified', () => {
179+
const entityName = testData.entity1
175180
cy.get(s.action.inputDisqualifiedConditions)
176-
.type('e{enter}')
181+
.type('e')
182+
183+
cy.get(s.officePicker.splitButton)
184+
.contains(entityName)
185+
.click()
177186

178187
cy.get(s.action.inputRequiredConditions)
179188
.type('e')
@@ -186,15 +195,20 @@ describe('action modal', () => {
186195

187196
describe('disqualifying entities', () => {
188197
it('should not be able to add entities that are required', () => {
198+
const entityName = testData.entity1
189199
cy.get(s.action.inputRequiredConditions)
190-
.type('e{enter}')
200+
.type('e')
201+
202+
cy.get(s.officePicker.splitButton)
203+
.contains(entityName)
204+
.click()
191205

192206
cy.get(s.action.inputDisqualifiedConditions)
193207
.type('e')
194208

195209
cy.get(s.officePicker.suggestions)
196210
.get(s.officePicker.buttonSuggestion)
197-
.should('not.have.text', testData.entity1)
211+
.should('not.have.text', entityName)
198212
})
199213
})
200214

@@ -235,7 +249,11 @@ describe('action modal', () => {
235249
.should('not.exist')
236250

237251
cy.get(s.action.inputRequiredConditions)
238-
.type('new{enter}')
252+
.type('new')
253+
254+
cy.get(s.officePicker.splitButton)
255+
.contains(testData.newEntity)
256+
.click()
239257
})
240258
})
241259

packages/ui/cypress/integration/regressionTs/descriptionAndTags.spec.ts

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
import * as models from '../../support/Models'
2-
import * as model from '../../support/components/ModelPage'
3-
import * as actions from '../../support/Actions'
4-
import * as actionsList from '../../support/components/ActionsGrid'
5-
import * as trainDialogsGrid from '../../support/components/TrainDialogsGrid'
6-
import * as trainDialog from '../../support/Train'
7-
import * as logDialogModal from '../../support/components/LogDialogModal'
81
import s from '../../support/selectors'
92
import constants from '../../support/constants'
103
import * as util from '../../support/utilities'
@@ -337,17 +330,18 @@ describe('Description and Tags', () => {
337330
.contains(`${testData.description}${testData.descriptionEdit}${testData.descriptionEdit}${testData.descriptionEdit}`)
338331
.click()
339332

340-
// Verify it has all three of the tags
333+
// Verify it has all the tags
341334
cy.get(s.dialogModal.tags)
342-
.should(($tags) => {
343-
const texts = $tags.map((i, el) => Cypress.$(el).text()).get()
344-
expect(texts).to.deep.eq([
345-
testData.tag01,
346-
testData.tag02,
347-
testData.tag03,
348-
testData.tag04,
349-
])
350-
})
335+
.should('have.length', 4)
336+
// .should(($tags) => {
337+
// const texts = $tags.map((i, el) => Cypress.$(el).text()).get()
338+
// expect(texts).to.deep.eq([
339+
// testData.tag01,
340+
// testData.tag02,
341+
// testData.tag03,
342+
// testData.tag04,
343+
// ])
344+
// })
351345
})
352346
})
353347

@@ -401,7 +395,7 @@ describe('Description and Tags', () => {
401395

402396
cy.server()
403397
cy.route('POST', '/sdk/app/*/scorefromtraindialog').as('postScoreFromTrainDialog')
404-
cy.route('POST', '/sdk/app/*/history*').as('postHistory')
398+
cy.route('POST', '/sdk/app/*/activities*').as('postHistory')
405399

406400
cy.get(s.dialogModal.buttonScoreActionsButton)
407401
.click()
@@ -413,16 +407,17 @@ describe('Description and Tags', () => {
413407
.should('have.value', `${testData.description}${testData.descriptionEdit}${testData.descriptionEdit}${testData.descriptionEdit}${testData.descriptionEdit}`)
414408

415409
cy.get(s.dialogModal.tags)
416-
.should(($tags) => {
417-
const texts = $tags.map((i, el) => Cypress.$(el).text()).get()
418-
expect(texts).to.deep.eq([
419-
testData.tag01,
420-
testData.tag02,
421-
testData.tag03,
422-
testData.tag04,
423-
testData.tag05,
424-
])
425-
})
410+
.should('have.length', 5)
411+
// .should(($tags) => {
412+
// const texts = $tags.map((i, el) => Cypress.$(el).text()).get()
413+
// expect(texts).to.deep.eq([
414+
// testData.tag01,
415+
// testData.tag02,
416+
// testData.tag03,
417+
// testData.tag04,
418+
// testData.tag05,
419+
// ])
420+
// })
426421

427422
cy.wait(500)
428423
cy.get(s.common.spinner, { timeout: constants.spinner.timeout })
@@ -510,13 +505,16 @@ describe('Description and Tags', () => {
510505
cy.get(s.chatModal.buttonDone)
511506
.click()
512507

508+
cy.wait(2000)
513509
cy.get(s.common.spinner, { timeout: constants.spinner.timeout })
514510
.should('not.exist')
515511

516512
cy.get(s.logDialogs.description)
517513
.contains(testData.input)
518514
.click()
519515

516+
cy.get(s.dialogModal.title)
517+
520518
// Verify fields for tags for description
521519
cy.get(s.dialogModal.inputDescription)
522520
cy.get(s.dialogModal.buttonAddTag)

packages/ui/cypress/integration/regressionTs/entityConflicts.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('Entity Conflicts', () => {
4545
util.removeLabel(testData.dialog.word1)
4646

4747
cy.get('body')
48-
.trigger(constants.events.selectWord, { detail: { phrase: wordToLabel, inex: 0 } })
48+
.trigger(constants.events.selectWord, { detail: { phrase: wordToLabel, index: 0 } })
4949

5050
cy.get(s.entityPicker.options)
5151
.contains(entityName)
@@ -211,7 +211,7 @@ describe('Entity Conflicts', () => {
211211
util.removeLabel(labeledWord1)
212212

213213
cy.get('body')
214-
.trigger(constants.events.selectWord, { detail: { phrase: labeledWord2, inex: 0 } })
214+
.trigger(constants.events.selectWord, { detail: { phrase: labeledWord2, index: 0 } })
215215

216216
cy.get(s.entityPicker.inputSearch)
217217
.wait(100)
@@ -329,7 +329,7 @@ describe('Entity Conflicts', () => {
329329
util.removeLabel(labeledWord1)
330330

331331
cy.get('body')
332-
.trigger(constants.events.selectWord, { detail: { phrase: labeledWord2, inex: 0 } })
332+
.trigger(constants.events.selectWord, { detail: { phrase: labeledWord2, index: 0 } })
333333

334334
cy.get(s.entityPicker.inputSearch)
335335
.wait(100)
@@ -350,7 +350,7 @@ describe('Entity Conflicts', () => {
350350
util.removeLabel(labeledWord1)
351351

352352
cy.get('body')
353-
.trigger(constants.events.selectWord, { detail: { phrase: labeledWord2, inex: 0 } })
353+
.trigger(constants.events.selectWord, { detail: { phrase: labeledWord2, index: 0 } })
354354

355355
cy.get(s.entityPicker.inputSearch)
356356
.wait(100)

packages/ui/cypress/integration/regressionTs/entityPicker.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('EntityPicker', () => {
7474
it('should open with 0 entities in the list', () => {
7575
// select word
7676
cy.get('body')
77-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word1, inex: 0 } })
77+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word1, index: 0 } })
7878

7979
// verify empty search text
8080
cy.get(s.entityPicker.inputSearch)
@@ -91,7 +91,7 @@ describe('EntityPicker', () => {
9191
it('should auto labeled the newly created entity', () => {
9292
// select word
9393
cy.get('body')
94-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word1, inex: 0 } })
94+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word1, index: 0 } })
9595

9696
// click create new entity
9797
cy.get(s.entityPicker.buttonNew)
@@ -110,14 +110,14 @@ describe('EntityPicker', () => {
110110
it('should open with previously created entity in options', () => {
111111
// select word2
112112
cy.get('body')
113-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word2, inex: 0 } })
113+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word2, index: 0 } })
114114

115115
// verify list has entity
116116
cy.get(s.entityPicker.options)
117117
.contains(testData.entity1)
118118
.should('have.length', 1)
119119

120-
cy.WaitForStableDOM()
120+
cy.WaitForStableDOM()
121121

122122
cy.get(s.extractionEditor.overlay)
123123
.click()
@@ -130,7 +130,7 @@ describe('EntityPicker', () => {
130130

131131
// select word2
132132
cy.get('body')
133-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word2, inex: 0 } })
133+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word2, index: 0 } })
134134

135135
// verify list has entity
136136
cy.get(s.entityPicker.options)
@@ -217,12 +217,12 @@ describe('EntityPicker', () => {
217217
describe('controls', () => {
218218
before(() => {
219219
cy.get('body')
220-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word1, inex: 0 } })
220+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word1, index: 0 } })
221221
})
222222

223223
it('when pressing tab it should select the highlighted entity', () => {
224224
cy.get('body')
225-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word1, inex: 0 } })
225+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word1, index: 0 } })
226226

227227
// Tab works if user, but doesn't here because we never selected the text, only used custom event to simulate selection
228228
cy.get(s.entityPicker.inputSearch)
@@ -234,7 +234,7 @@ describe('EntityPicker', () => {
234234

235235
it('when pressing enter it should select the highlighted entity', () => {
236236
cy.get('body')
237-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word2, inex: 0 } })
237+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word2, index: 0 } })
238238

239239
// Tab works if user, but doesn't here because we never selected the text, only used custom event to simulate selection
240240
cy.get(s.entityPicker.inputSearch)
@@ -244,7 +244,7 @@ describe('EntityPicker', () => {
244244
describe('highlight', () => {
245245
before(() => {
246246
cy.get('body')
247-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word3, inex: 0 } })
247+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word3, index: 0 } })
248248
})
249249

250250
it('should list all the entities in the model', () => {
@@ -274,7 +274,7 @@ describe('EntityPicker', () => {
274274
.click()
275275

276276
cy.get('body')
277-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word3, inex: 0 } })
277+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word3, index: 0 } })
278278

279279
cy.get(s.entityPicker.inputSearch)
280280
.should('have.text', '')
@@ -289,7 +289,7 @@ describe('EntityPicker', () => {
289289
describe('arrow keys', () => {
290290
before(() => {
291291
cy.get('body')
292-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word3, inex: 0 } })
292+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word3, index: 0 } })
293293
})
294294

295295
it('when pressing down arrow it should move the highlight down', () => {
@@ -360,7 +360,7 @@ describe('EntityPicker', () => {
360360
.should('not.exist')
361361

362362
cy.get('body')
363-
.trigger(constants.events.selectWord, { detail: { phrase: testData.word3, inex: 0 } })
363+
.trigger(constants.events.selectWord, { detail: { phrase: testData.word3, index: 0 } })
364364

365365
cy.get(s.entityPicker.inputSearch)
366366
.wait(50)

0 commit comments

Comments
 (0)