Skip to content

Commit

Permalink
[ML] fix tests arrangement
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Mar 15, 2020
1 parent 24d4b57 commit 526f88c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const ml = getService('ml');
describe('data frame analytics jobs cloning supported by UI form', function() {
describe('jobs cloning supported by UI form', function() {
this.tags(['smoke']);

const testDataList: Array<{
Expand Down Expand Up @@ -119,21 +119,11 @@ export default function({ getService }: FtrProviderContext) {
})();

before(async () => {
// Create jobs for cloning
for (const testData of testDataList) {
await esArchiver.load(testData.archive);
await ml.api.createDataFrameAnalyticsJob(testData.job as DataFrameAnalyticsConfig);
}
await ml.securityUI.loginAsMlPowerUser();
});

after(async () => {
await ml.api.cleanMlIndices();
// Clean destination indices of the original jobs
for (const testData of testDataList) {
await ml.api.deleteIndices(testData.job.dest!.index as string);
await esArchiver.unload(testData.archive);
}
});

for (const testData of testDataList) {
Expand All @@ -142,6 +132,9 @@ export default function({ getService }: FtrProviderContext) {
const cloneDestIndex = `${testData.job!.dest!.index}_clone`;

before(async () => {
await esArchiver.load(testData.archive);
await ml.api.createDataFrameAnalyticsJob(testData.job as DataFrameAnalyticsConfig);

await ml.navigation.navigateToMl();
await ml.navigation.navigateToDataFrameAnalytics();
await ml.dataFrameAnalyticsTable.waitForAnalyticsToLoad();
Expand All @@ -151,6 +144,8 @@ export default function({ getService }: FtrProviderContext) {

after(async () => {
await ml.api.deleteIndices(cloneDestIndex);
await ml.api.deleteIndices(testData.job.dest!.index as string);
await esArchiver.unload(testData.archive);
});

it('should open the flyout with a proper header', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,8 @@ export function MachineLearningDataFrameAnalyticsCreationProvider(
},

async isCreateButtonDisabled() {
const attrValue = await testSubjects.getAttribute(
'mlAnalyticsCreateJobFlyoutCreateButton',
'disabled'
);
return attrValue === '';
const isEnabled = await testSubjects.isEnabled('mlAnalyticsCreateJobFlyoutCreateButton');
return !isEnabled;
},

async createAnalyticsJob() {
Expand Down

0 comments on commit 526f88c

Please sign in to comment.