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

fix functional tests in services.spec #2781

Merged
merged 1 commit into from
Oct 25, 2024
Merged
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
49 changes: 22 additions & 27 deletions ui/src/__tests__/spec/tests/services.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ describe('services screen tests', () => {
await browser.switchToWindow(windowHandles[1]);
// verify the URL of the new tab
const url = await browser.getUrl();
expect(url).toContain('athenz-guide');
expect(
url.includes('athenz-guide') || url.includes('yo/service-instances')
).toBe(true);
Comment on lines +59 to +61
Copy link
Contributor Author

Choose a reason for hiding this comment

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

url can be either depending on whether the test is run locally or via SD

});

// after - runs after the last test in order of declaration
Expand All @@ -82,35 +84,28 @@ describe('services screen tests', () => {
await modalDeleteButton.click();
});

describe('services screen tests', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

duplicate 'describe' declaration removed, so most of the change here is just indentation fix

it('when clicking "Allow" button on a provider without having appropriate authorisation, the error should be displayed to the right of the button', async () => {
// open browser
await browser.newUser();
await browser.url(`/`);

// select domain
let domain = 'athenz.dev.test-non-admin';
let testDomain = await $(`a*=${domain}`);
await browser.waitUntil(async () => await testDomain.isClickable());
await testDomain.click();
it('when clicking "Allow" button on a provider without having appropriate authorisation, the error should be displayed to the right of the button', async () => {
await console.log(`testtesttest inside second test`)
// open browser
await browser.newUser();
await browser.url(`/domain/athenz.dev.test-non-admin/role`);
Comment on lines -92 to +91
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix of the second test - navigate to domain directly via url, since the user is not its memeber and thus domain is not visible in the list of domains on the right in ui


// open Services
let servicesDiv = await $('div*=Services');
await servicesDiv.click();
// open Services
let servicesDiv = await $('div*=Services');
await servicesDiv.click();

// click Providers
let providersButton = await $(`.//*[local-name()="svg" and @id="provider-test-service-providers"]`);
await providersButton.click();
// click Providers
let providersButton = await $(`.//*[local-name()="svg" and @id="provider-test-service-providers"]`);
await providersButton.click();

// click Azure provider
let awsProviderAllowButton = await $(`td[data-testid="provider-table"]`)
.$(`//td[text()="AWS EC2/EKS/Fargate launches instances for the service"]/following-sibling::td//button`);
await awsProviderAllowButton.click();
// click Azure provider
let awsProviderAllowButton = await $(`td[data-testid="provider-table"]`)
.$(`//td[text()="AWS EC2/EKS/Fargate launches instances for the service"]/following-sibling::td//button`);
await awsProviderAllowButton.click();

// warning should appear
let warning = await $(`td[data-testid="provider-table"]`)
.$(`//td[text()="AWS EC2/EKS/Fargate launches instances for the service"]/following-sibling::td//div[text()="Status: 403. Message: Forbidden"]`);
await expect(warning).toHaveText('Status: 403. Message: Forbidden');
});
// warning should appear
let warning = await $(`td[data-testid="provider-table"]`)
.$(`//td[text()="AWS EC2/EKS/Fargate launches instances for the service"]/following-sibling::td//div[text()="Status: 403. Message: Forbidden"]`);
await expect(warning).toHaveText('Status: 403. Message: Forbidden');
});
})
Loading