Skip to content

Commit

Permalink
test: define customColonyUrl variable locally where it's used
Browse files Browse the repository at this point in the history
  • Loading branch information
olgapod committed Oct 29, 2024
1 parent 18a8ca9 commit 2f5a7ce
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions playwright/e2e/create-colony.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ test.describe('Create Colony flow', () => {
const colonyName = 'testcolonyname';
let existingToken: string;
const invalidToken = 'invalidtoken';
let customColonyURL = '';

test.beforeAll(async () => {
customColonyURL = generateRandomString();
existingToken = await fetchFirstValidTokenAddress();
});

Expand Down Expand Up @@ -81,7 +80,7 @@ test.describe('Create Colony flow', () => {

// Fill in colony name and custom URL
await page.getByLabel(/colony Name/i).fill(colonyName);
await page.getByLabel(/custom colony URL/i).fill(customColonyURL);
await page.getByLabel(/custom colony URL/i).fill(generateRandomString());
await page.getByLabel(/custom colony URL/i).blur();

// Check if URL is available
Expand Down Expand Up @@ -177,7 +176,7 @@ test.describe('Create Colony flow', () => {
test.beforeEach(async ({ page }) => {
await fillColonyNameStep(page, {
nameFieldValue: colonyName,
urlFieldValue: customColonyURL,
urlFieldValue: generateRandomString(),
});
});

Expand Down Expand Up @@ -392,14 +391,11 @@ test.describe('Create Colony flow', () => {
});

test.describe('Confirmation step', () => {
test.beforeEach(async ({ page }) => {
test('Should render Confirmation step as expected', async ({ page }) => {
await fillColonyNameStep(page, {
nameFieldValue: colonyName,
urlFieldValue: customColonyURL,
urlFieldValue: generateRandomString(),
});
});

test('Should render Confirmation step as expected', async ({ page }) => {
await fillNativeTokenStepWithExistingToken(page, existingToken);
// Heading of the Step
await expect(
Expand Down Expand Up @@ -447,6 +443,12 @@ test.describe('Create Colony flow', () => {
test('Should navigate to Details step when Edit colony details is clicked', async ({
page,
}) => {
const customColonyURL = generateRandomString();
await fillColonyNameStep(page, {
nameFieldValue: colonyName,
urlFieldValue: customColonyURL,
});

await fillNativeTokenStepWithExistingToken(page, existingToken);

await page
Expand All @@ -465,6 +467,10 @@ test.describe('Create Colony flow', () => {
test('Should navigate to Native token step when Edit token is clicked', async ({
page,
}) => {
await fillColonyNameStep(page, {
nameFieldValue: colonyName,
urlFieldValue: generateRandomString(),
});
await fillNativeTokenStepWithExistingToken(page, existingToken);

await page
Expand All @@ -483,6 +489,11 @@ test.describe('Create Colony flow', () => {
}) => {
// This test awaits all the transactions and graphql operations on the final step of the Colony Creation to complete
test.slow();
const colonyURL = generateRandomString();
await fillColonyNameStep(page, {
nameFieldValue: colonyName,
urlFieldValue: colonyURL,
});
await fillNativeTokenStepWithExistingToken(page, existingToken);

await page.getByRole('button', { name: /continue/i }).click();
Expand All @@ -500,7 +511,7 @@ test.describe('Create Colony flow', () => {
).toBeVisible();

// Expect the transition to the newly created colony URL
await page.waitForURL(customColonyURL);
await page.waitForURL(colonyURL);

// Expect the Colony Created dialog to be visible
const colonyCreateDialog = page
Expand Down

0 comments on commit 2f5a7ce

Please sign in to comment.