Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADM-926-fix:[frontend] fix: add two time range to test #1421

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions frontend/e2e/fixtures/import-file/chart-step-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,22 @@ export const chartStepData = {
],
noCardDateRange: [
{
startDate: '2021-04-07T00:00:00.000+08:00',
endDate: '2021-04-08T23:59:59.999+08:00',
startDate: '2011-04-07T00:00:00.000+08:00',
endDate: '2011-04-08T23:59:59.999+08:00',
},
{
startDate: '2011-03-07T00:00:00.000+08:00',
endDate: '2011-03-08T23:59:59.999+08:00',
},
],
rightDateRange: [
{
startDate: '2024-01-15T00:00:00.000+08:00',
endDate: '2024-01-16T23:59:59.999+08:00',
},
{
startDate: '2024-01-17T00:00:00.000+08:00',
endDate: '2024-01-19T23:59:59.999+08:00',
},
],
};
8 changes: 4 additions & 4 deletions frontend/e2e/pages/metrics/config-step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ export class ConfigStep {
expect(this.requiredDataErrorMessage).toBeTruthy();
}

async typeInDateRange({ startDate, endDate }: { startDate: string; endDate: string }) {
await this.fromDateInput.fill(startDate);
await this.toDateInput.fill(endDate);
async typeInDateRange({ startDate, endDate, number = 0 }: { startDate: string; endDate: string; number?: number }) {
await this.fromDateInput.nth(number).fill(startDate);
await this.toDateInput.nth(number).fill(endDate);
}

async validateNextButtonNotClickable() {
Expand Down Expand Up @@ -279,7 +279,7 @@ export class ConfigStep {
}

async selectBoardMetricsOnly() {
await this.requiredMetricsLabel.click();
await this.requiredMetricsLabel.first().click();
await this.velocityCheckbox.click();
await this.classificationCheckbox.click();
await this.cycleTimeCheckbox.click();
Expand Down
43 changes: 32 additions & 11 deletions frontend/e2e/specs/side-path/charting-unhappy-path.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { importModifiedCorrectConfig as modifiedCorrectProjectFromFile } from '../../fixtures/import-file/unhappy-path-file';
import { chartStepData } from '../../fixtures/import-file/chart-step-data';
import { test } from '../../fixtures/test-with-extend-fixtures';
import { clearTempDir } from '../../utils/clear-temp-dir';
Expand All @@ -9,18 +8,31 @@ test.beforeAll(async () => {
});

test('Charting unhappy path on config and metri page', async ({ homePage, configStep, metricsStep }) => {
const rightDateRange = {
startDate: format(modifiedCorrectProjectFromFile.dateRange.startDate),
endDate: format(modifiedCorrectProjectFromFile.dateRange.endDate),
const rightDateRange_frist = {
startDate: format(chartStepData.rightDateRange[0].startDate),
endDate: format(chartStepData.rightDateRange[0].endDate),
number: 0,
};
const rightDateRange_second = {
startDate: format(chartStepData.rightDateRange[1].startDate),
endDate: format(chartStepData.rightDateRange[1].endDate),
number: 1,
};
const errorDateRange = {
startDate: format(chartStepData.errorDateRange[0].startDate),
endDate: format(chartStepData.errorDateRange[0].endDate),
};

const noCardDateRange = {
const noCardDateRange_frist = {
startDate: format(chartStepData.noCardDateRange[0].startDate),
endDate: format(chartStepData.noCardDateRange[0].endDate),
number: 0,
};

const noCardDateRange_second = {
startDate: format(chartStepData.noCardDateRange[1].startDate),
endDate: format(chartStepData.noCardDateRange[1].endDate),
number: 1,
};
await homePage.goto();

Expand All @@ -34,26 +46,35 @@ test('Charting unhappy path on config and metri page', async ({ homePage, config
await configStep.addNewTimeRange();
await configStep.validateAddNewTimeRangeButtonNotClickable();
await configStep.validateNextButtonNotClickable();

await configStep.RemoveLastNewPipeline();
await configStep.RemoveLastNewPipeline();
await configStep.RemoveLastNewPipeline();
await configStep.RemoveLastNewPipeline();
await configStep.RemoveLastNewPipeline();
await configStep.validateRemoveTimeRangeButtonIsHidden();

await configStep.typeInDateRange(errorDateRange);
await configStep.checkErrorStratTimeMessage();
await configStep.checkErrorEndTimeMessage();
await configStep.validateNextButtonNotClickable();
await configStep.typeInDateRange(noCardDateRange);

await configStep.typeInDateRange(noCardDateRange_frist);
await configStep.addNewTimeRange();
await configStep.typeInDateRange(noCardDateRange_second);
await configStep.selectAllRequiredMetrics();
await configStep.selectBoardMetricsOnly();
await configStep.goToMetrics();
await metricsStep.waitForShown();
await configStep.validateNextButtonNotClickable();
await metricsStep.checkBoardNoCard();
await metricsStep.validateNextButtonNotClickable();
await metricsStep.goToPreviousStep();
await configStep.typeInDateRange(rightDateRange);

await configStep.typeInDateRange(rightDateRange_frist);
await configStep.typeInDateRange(rightDateRange_second);
await configStep.selectAllRequiredMetrics();
await configStep.goToMetrics();
await metricsStep.waitForShown();
await metricsStep.deselectBranch(chartStepData.unSelectBranch);
await metricsStep.addBranch(chartStepData.addNewBranch);
await metricsStep.checkBranchIsInvalid();
await configStep.validateNextButtonNotClickable();
await metricsStep.validateNextButtonNotClickable();
});
Loading