|
| 1 | +import { clickable, collection, create, fillable, isPresent, text } from 'ember-cli-page-object'; |
1 | 2 | import { module, test } from 'qunit';
|
2 |
| -import { setupRenderingTest } from 'ember-qunit'; |
3 |
| -import { setupMirage } from 'ember-cli-mirage/test-support'; |
4 |
| -import { render, settled } from '@ember/test-helpers'; |
| 3 | +import { pauseTest, render, settled } from '@ember/test-helpers'; |
| 4 | + |
5 | 5 | import { TestContext } from 'ember-test-helpers';
|
6 | 6 | import hbs from 'htmlbars-inline-precompile';
|
7 |
| -import { create, collection, clickable, isPresent, fillable, text } from 'ember-cli-page-object'; |
| 7 | +import { setupMirage } from 'ember-cli-mirage/test-support'; |
| 8 | +import { setupRenderingTest } from 'ember-qunit'; |
8 | 9 |
|
9 | 10 | const page = create({
|
10 | 11 | hasForm: isPresent('[data-test-config-variables-form]'),
|
@@ -113,4 +114,33 @@ module('Integration | Component | project-config-variables-list', function (hook
|
113 | 114 | assert.ok(page.variablesList.objectAt(0).hasDropDownEdit, 'Static Variable is editable');
|
114 | 115 | assert.notOk(page.variablesList.objectAt(3).hasDropDown, 'Dynamic Variable is not editable or deletable');
|
115 | 116 | });
|
| 117 | + |
| 118 | + test('renaming variables works', async function (assert) { |
| 119 | + let dbproj = await this.server.create('project', { name: 'Proj1' }); |
| 120 | + let proj = dbproj.toProtobuf().toObject(); |
| 121 | + let dbVariablesList = this.server.createList('config-variable', 3, 'random', { project: dbproj }); |
| 122 | + let dynamicVar = this.server.create('config-variable', 'dynamic', { project: dbproj }); |
| 123 | + dbVariablesList.push(dynamicVar); |
| 124 | + let varList = dbVariablesList.map((v) => { |
| 125 | + return v.toProtobuf().toObject(); |
| 126 | + }); |
| 127 | + this.set('variablesList', varList); |
| 128 | + this.set('project', proj); |
| 129 | + await render( |
| 130 | + hbs`<ProjectConfigVariables::List @variablesList={{this.variablesList}} @project={{this.project}}/>` |
| 131 | + ); |
| 132 | + assert.equal(page.variablesList.length, 4, 'the list contains the right number of variables'); |
| 133 | + await page.variablesList.objectAt(0).dropdown(); |
| 134 | + await page.variablesList.objectAt(0).dropdownEdit(); |
| 135 | + await page.varName('edited_var_name'); |
| 136 | + await page.saveButton(); |
| 137 | + // Necessary to wait for the next request after save |
| 138 | + await settled(); |
| 139 | + await page.variablesList.objectAt(1).dropdown(); |
| 140 | + assert.equal( |
| 141 | + page.variablesList.length, |
| 142 | + 4, |
| 143 | + 'the list contains the right number of variables after name edition' |
| 144 | + ); |
| 145 | + }); |
116 | 146 | });
|
0 commit comments