|
1 | 1 | describe('Can add and edit statements', () => { |
2 | | - it('adds a new statement then edits it', () => { |
| 2 | + it('adds a new statement', () => { |
3 | 3 | const statementText = `Cypress statement ${Date.now()}` |
4 | | - const updatedStatementText = `${statementText} - edited` |
5 | 4 |
|
6 | 5 | cy.login().then(() => { |
7 | 6 | cy.visit('/videos/Jzqg') |
8 | 7 |
|
9 | | - cy.contains('div', 'Add a Statement', { matchCase: false, timeout: 10000 }).parent().click() |
10 | | - |
11 | | - cy.get('#col-video') |
12 | | - .find('a[href^="/s/"]') |
13 | | - .first() |
14 | | - .invoke('text') |
15 | | - .then((speakerName) => { |
16 | | - if (speakerName) { |
17 | | - cy.get('input[name="speaker_id"]').type(`${speakerName.trim()}{enter}`, { force: true }) |
18 | | - } |
19 | | - }) |
20 | | - |
21 | | - cy.get('textarea[name="text"]').type(statementText) |
22 | | - |
| 8 | + // Add a statement |
| 9 | + cy.contains('[data-cy="action-bubble"]', 'Add a Statement').click() |
| 10 | + cy.get('[data-cy="statement-form"] textarea[name="text"]').type(statementText) |
23 | 11 | cy.contains('button[type=submit]', 'Save').click() |
24 | 12 |
|
25 | | - cy.contains('blockquote', statementText, { timeout: 15000 }).should('exist') |
26 | | - |
27 | | - cy.contains('[data-cy="statement"]', statementText) |
28 | | - .find('button[aria-haspopup="menu"]') |
29 | | - .click() |
30 | | - |
31 | | - cy.contains('[role="menuitem"]', 'Edit').click() |
32 | | - |
33 | | - cy.get('textarea[name="text"]').clear().type(updatedStatementText) |
34 | | - |
| 13 | + cy.contains('A speaker should be added. To continue without one, press "Save".').should( |
| 14 | + 'exist', |
| 15 | + ) |
35 | 16 | cy.contains('button[type=submit]', 'Save').click() |
36 | | - |
37 | | - cy.contains('[data-cy="statement"]', updatedStatementText, { timeout: 15000 }).should('exist') |
| 17 | + cy.contains('[data-cy="statement"]', statementText, { timeout: 15000 }).should('exist') |
38 | 18 | }) |
39 | 19 | }) |
40 | 20 | }) |
0 commit comments