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

O3 - 2199 : Add BDD steps on tests #40

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
30 changes: 17 additions & 13 deletions e2e/specs/openConceptLab.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,26 @@ test.beforeEach(async ({ api }) => {
test('should be able to setup a subscription and import concepts', async ({ page }) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test name should be renamed with the action. Check other repos.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const openConceptLabPage = new OpenConceptLabPage(page);

// Setup the subscription
await openConceptLabPage.goto();
await openConceptLabPage.addOclSubscription();
await test.step('When I setup the subscription', async () => {
await openConceptLabPage.goto();
await openConceptLabPage.addOclSubscription();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Piumal1999 @dilankavishka Since addOclSubscription function isn't reused anywhere, I think it would be better to move things back to here from the page.

Then break down it in to steps.
ex:

  • When I go to the "OCL module page"
  • And I enter the subscription URL
  • And I enter the token
  • And I click the save button
  • Then I should ....
  • When I click on the import tab
  • ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

});

// Start an Import
await openConceptLabPage.importTab().click();
await openConceptLabPage.startImport();
await test.step('And I starts an import', async () => {
await openConceptLabPage.importTab().click();
await openConceptLabPage.startImport();
});

// Check results of the import
await openConceptLabPage.goto();
await openConceptLabPage.previousImportsTab().click();
await expect(openConceptLabPage.previousImportsTable()).toHaveText(/\d+ items fetched/);
await test.step('Then the import results should appear in previous imports', async () => {
await openConceptLabPage.goto();
await openConceptLabPage.previousImportsTab().click();
await expect(openConceptLabPage.previousImportsTable()).toHaveText(/\d+ items fetched/);
});

// Unsubscribe
await openConceptLabPage.subscriptionTab().click();
await openConceptLabPage.unsubscribe();
await test.step('And I unsubscribe', async () => {
await openConceptLabPage.subscriptionTab().click();
await openConceptLabPage.unsubscribe();
});
Comment on lines +32 to +35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to expect anything after performing this step?

@Piumal1999 @dilankavishka

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jayasanka-sack
Do you mean that we can add "Click on that subscription tab" after this step?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I mean, what we can expect after unsubscribing? A success message?

I think an extra "Then" step would be nice to have.

});

test.afterEach(async ({ api }) => {
Expand Down
Loading